aboutsummaryrefslogtreecommitdiff
path: root/hw/pl181.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-02-21 20:57:49 +0000
committerAurelien Jarno <aurelien@aurel32.net>2011-03-06 19:01:29 +0100
commitc31a4724e25ef867acda0eafc7ddb3999e4bb204 (patch)
treed419cc5051fb12fdb022c879d285d588495386e0 /hw/pl181.c
parent444dd39b5f226926e8b8a950821e6f48a5da3ccd (diff)
hw/pl181: Implement GPIO output pins for card status
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 <peter.maydell@linaro.org> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/pl181.c')
-rw-r--r--hw/pl181.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/pl181.c b/hw/pl181.c
index 36d9d02d6a..6bc79f5f7a 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);