From patchwork Mon Feb 21 20:57:49 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 188 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:40:44 -0000 Delivered-To: patches@linaro.org Received: by 10.224.19.208 with SMTP id c16cs202821qab; Mon, 21 Feb 2011 12:57:59 -0800 (PST) Received: by 10.150.200.19 with SMTP id x19mr2291847ybf.109.1298321879119; Mon, 21 Feb 2011 12:57:59 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk [81.2.115.146]) by mx.google.com with ESMTPS id u35si4006450yba.23.2011.02.21.12.57.56 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 21 Feb 2011 12:57:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1PrcpN-0004Rh-NT; Mon, 21 Feb 2011 20:57:53 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH 1/5] hw/pl181: Implement GPIO output pins for card status Date: Mon, 21 Feb 2011 20:57:49 +0000 Message-Id: <1298321873-17064-2-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> Add two GPIO output pins to the PL181 model to indicate the card present and readonly status information. On ARM boards these usually are reflected in a system register. Signed-off-by: Peter Maydell --- hw/pl181.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/hw/pl181.c b/hw/pl181.c index 36d9d02..6bc79f5 100644 --- a/hw/pl181.c +++ b/hw/pl181.c @@ -47,6 +47,8 @@ typedef struct { int linux_hack; uint32_t fifo[PL181_FIFO_LEN]; qemu_irq irq[2]; + /* GPIO outputs for 'card is readonly' and 'card inserted' */ + qemu_irq cardstatus[2]; } pl181_state; #define PL181_CMD_INDEX 0x3f @@ -444,6 +446,9 @@ static void pl181_reset(void *opaque) s->linux_hack = 0; s->mask[0] = 0; s->mask[1] = 0; + + /* We can assume our GPIO outputs have been wired up now */ + sd_set_cb(s->card, s->cardstatus[0], s->cardstatus[1]); } static int pl181_init(SysBusDevice *dev) @@ -457,6 +462,7 @@ static int pl181_init(SysBusDevice *dev) sysbus_init_mmio(dev, 0x1000, iomemtype); sysbus_init_irq(dev, &s->irq[0]); sysbus_init_irq(dev, &s->irq[1]); + qdev_init_gpio_out(&s->busdev.qdev, s->cardstatus, 2); dinfo = drive_get_next(IF_SD); s->card = sd_init(dinfo ? dinfo->bdrv : NULL, 0); qemu_register_reset(pl181_reset, s);