From patchwork Mon Feb 21 20:57:53 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 83881 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 ozlabs.org (Postfix) with ESMTPS id E8CD6B7063 for ; Tue, 22 Feb 2011 08:21:09 +1100 (EST) Received: from localhost ([127.0.0.1]:53979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrdBr-0003UX-5l for incoming@patchwork.ozlabs.org; Mon, 21 Feb 2011 16:21:07 -0500 Received: from [140.186.70.92] (port=42945 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Prd5c-0000Gc-9C for qemu-devel@nongnu.org; Mon, 21 Feb 2011 16:14:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Prd5b-0004ya-Ip for qemu-devel@nongnu.org; Mon, 21 Feb 2011 16:14:40 -0500 Received: from mnementh.archaic.org.uk ([81.2.115.146]:60832) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Prd5b-0004yP-Av for qemu-devel@nongnu.org; Mon, 21 Feb 2011 16:14:39 -0500 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1PrcpN-0004Rp-Pd; Mon, 21 Feb 2011 20:57:53 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 21 Feb 2011 20:57:53 +0000 Message-Id: <1298321873-17064-6-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.3 In-Reply-To: <1298321873-17064-1-git-send-email-peter.maydell@linaro.org> References: <1298321873-17064-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: patches@linaro.org Subject: [Qemu-devel] [PATCH 5/5] hw/realview: Wire up the MMC card status 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 Instantiate the three PL061 GPIO modules the realview boards have. Connect the MMC card status outputs of the PL181 MMC controller to both the system registers and the GPIO module which handles internal devices. Signed-off-by: Peter Maydell --- hw/realview.c | 29 ++++++++++++++++++++++++++--- 1 files changed, 26 insertions(+), 3 deletions(-) diff --git a/hw/realview.c b/hw/realview.c index 6eb6c6a..466b210 100644 --- a/hw/realview.c +++ b/hw/realview.c @@ -138,10 +138,11 @@ static void realview_init(ram_addr_t ram_size, { CPUState *env = NULL; ram_addr_t ram_offset; - DeviceState *dev; + DeviceState *dev, *sysctl, *gpio2; SysBusDevice *busdev; qemu_irq *irqp; qemu_irq pic[64]; + qemu_irq mmc_irq[2]; PCIBus *pci_bus; NICInfo *nd; i2c_bus *i2c; @@ -218,7 +219,11 @@ static void realview_init(ram_addr_t ram_size, } sys_id = is_pb ? 0x01780500 : 0xc1400400; - arm_sysctl_init(0x10000000, sys_id, proc_id); + sysctl = qdev_create(NULL, "realview_sysctl"); + qdev_prop_set_uint32(sysctl, "sys_id", sys_id); + qdev_init_nofail(sysctl); + qdev_prop_set_uint32(sysctl, "proc_id", proc_id); + sysbus_mmio_map(sysbus_from_qdev(sysctl), 0, 0x10000000); if (is_mpcore) { dev = qdev_create(NULL, is_pb ? "a9mpcore_priv": "realview_mpcore"); @@ -257,9 +262,27 @@ static void realview_init(ram_addr_t ram_size, sysbus_create_simple("sp804", 0x10011000, pic[4]); sysbus_create_simple("sp804", 0x10012000, pic[5]); + sysbus_create_simple("pl061", 0x10013000, pic[6]); + sysbus_create_simple("pl061", 0x10014000, pic[7]); + gpio2 = sysbus_create_simple("pl061", 0x10015000, pic[8]); + sysbus_create_simple("pl110_versatile", 0x10020000, pic[23]); - sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL); + dev = sysbus_create_varargs("pl181", 0x10005000, pic[17], pic[18], NULL); + /* Wire up MMC card detect and read-only signals. These have + * to go to both the PL061 GPIO and the sysctl register. + * Note that the PL181 orders these lines (readonly,inserted) + * and the PL061 has them the other way about. Also the card + * detect line is inverted. + */ + mmc_irq[0] = qemu_irq_split( + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_WPROT), + qdev_get_gpio_in(gpio2, 1)); + mmc_irq[1] = qemu_irq_split( + qdev_get_gpio_in(sysctl, ARM_SYSCTL_GPIO_MMC_CARDIN), + qemu_irq_invert(qdev_get_gpio_in(gpio2, 0))); + qdev_connect_gpio_out(dev, 0, mmc_irq[0]); + qdev_connect_gpio_out(dev, 1, mmc_irq[1]); sysbus_create_simple("pl031", 0x10017000, pic[10]);