From patchwork Fri Aug 14 20:23:17 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit Canet X-Patchwork-Id: 31438 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id E33CCB6F1E for ; Sat, 15 Aug 2009 06:34:27 +1000 (EST) Received: from localhost ([127.0.0.1]:37960 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mc3Tj-0001DX-Fa for incoming@patchwork.ozlabs.org; Fri, 14 Aug 2009 16:34:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mc3JL-0006uh-0E for qemu-devel@nongnu.org; Fri, 14 Aug 2009 16:23:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mc3JG-0006so-2M for qemu-devel@nongnu.org; Fri, 14 Aug 2009 16:23:38 -0400 Received: from [199.232.76.173] (port=36912 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mc3JF-0006sg-Qc for qemu-devel@nongnu.org; Fri, 14 Aug 2009 16:23:33 -0400 Received: from mail-ew0-f210.google.com ([209.85.219.210]:50862) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mc3JF-0007yO-2Y for qemu-devel@nongnu.org; Fri, 14 Aug 2009 16:23:33 -0400 Received: by mail-ew0-f210.google.com with SMTP id 6so1941639ewy.34 for ; Fri, 14 Aug 2009 13:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=jX5QrYGJb2KgItFtcqT9+0PyqH6oN8nzBCwh+ZGh4cE=; b=SOFVZ8zOEcHnO62PNy33bDskOb8EltCs7F7zAh71pGckn/Z9iHc+ynOkidcAzc+non ynRt8J8QYBjRLXe6bQcv6LGS1uux//zwwImq11bli73OghKdv5cjBEYEBDT9BejQEM8q 22AJwcrmQnVBirN9uDvO67rjkiit0ikXREvl0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=C9eykJDbS8Z/7aaOLCUpTV+o/GRBx62NXHY7NjGPrvpZRytQBIGaEIRCn+S8W9blDb Lx/KtPzewRiIqdny0NjSCh42fTiD4f/NLvYM7QjSAowBE2SvrGRbjqI9JLbcx3VeZ13/ osGoLliF4P4W5OBLBW56y94eVqiDAz5jIx0dI= Received: by 10.211.195.3 with SMTP id x3mr3682316ebp.7.1250281412430; Fri, 14 Aug 2009 13:23:32 -0700 (PDT) Received: from localhost.localdomain (AMontsouris-157-1-68-201.w90-46.abo.wanadoo.fr [90.46.59.201]) by mx.google.com with ESMTPS id 10sm1145045eyd.35.2009.08.14.13.23.31 (version=SSLv3 cipher=RC4-MD5); Fri, 14 Aug 2009 13:23:31 -0700 (PDT) From: Benoit Canet To: qemu-devel@nongnu.org Date: Fri, 14 Aug 2009 22:23:17 +0200 Message-Id: <1250281397-7660-7-git-send-email-benoit.canet@gmail.com> X-Mailer: git-send-email 1.6.0.4 In-Reply-To: <1250281397-7660-6-git-send-email-benoit.canet@gmail.com> References: <1250281397-7660-1-git-send-email-benoit.canet@gmail.com> <1250281397-7660-2-git-send-email-benoit.canet@gmail.com> <1250281397-7660-3-git-send-email-benoit.canet@gmail.com> <1250281397-7660-4-git-send-email-benoit.canet@gmail.com> <1250281397-7660-5-git-send-email-benoit.canet@gmail.com> <1250281397-7660-6-git-send-email-benoit.canet@gmail.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Benoit Canet Subject: [Qemu-devel] [PATCH 6/9] Add the Versatile I2C device to versatilepb.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Benoit Canet --- hw/versatilepb.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/hw/versatilepb.c b/hw/versatilepb.c index 3371121..afc473d 100644 --- a/hw/versatilepb.c +++ b/hw/versatilepb.c @@ -9,6 +9,7 @@ #include "sysbus.h" #include "arm-misc.h" +#include "i2c.h" #include "primecell.h" #include "devices.h" #include "net.h" @@ -170,6 +171,9 @@ static void versatile_init(ram_addr_t ram_size, NICInfo *nd; int n; int done_smc = 0; + DeviceState *bitbang_i2c_dev; + DeviceState *i2c_dev; + i2c_bus *i2c; if (!cpu_model) cpu_model = "arm926"; @@ -224,6 +228,15 @@ static void versatile_init(ram_addr_t ram_size, n--; } + bitbang_i2c_dev = sysbus_create_varargs("bitbang_i2c", 0, NULL); + i2c = (i2c_bus *)qdev_get_child_bus(bitbang_i2c_dev, "i2c"); + + i2c_dev = sysbus_create_varargs("versatile,i2c", 0x10002000, NULL); + + qdev_connect_gpio_out(bitbang_i2c_dev, 0, qdev_get_gpio_in(i2c_dev, 0)); + qdev_connect_gpio_out(i2c_dev, 0, qdev_get_gpio_in(bitbang_i2c_dev, 0)); + qdev_connect_gpio_out(i2c_dev, 1, qdev_get_gpio_in(bitbang_i2c_dev, 1)); + sysbus_create_simple("pl011", 0x101f1000, pic[12]); sysbus_create_simple("pl011", 0x101f2000, pic[13]); sysbus_create_simple("pl011", 0x101f3000, pic[14]); @@ -243,6 +256,9 @@ static void versatile_init(ram_addr_t ram_size, /* Add PL031 Real Time Clock. */ sysbus_create_simple("pl031", 0x101e8000, pic[10]); + dev = sysbus_create_simple("bitbang_i2c", 0, NULL); + i2c = (i2c_bus *)qdev_get_child_bus(i2c_dev, "i2c"); + /* Memory map for Versatile/PB: */ /* 0x10000000 System registers. */ /* 0x10001000 PCI controller config registers. */