summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2009-09-18 20:51:23 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-05 09:32:43 -0500
commitce2fa762a44c963725c1d497e10b08c6ef0c8356 (patch)
treef933bef1ae9b42377e494e4c68ca6d5202006011 /hw
parent5716bb75ffea63ed6a7681b30e2bc30b0177b22a (diff)
downloadqemu-ce2fa762a44c963725c1d497e10b08c6ef0c8356.tar.gz
qemu-ce2fa762a44c963725c1d497e10b08c6ef0c8356.tar.bz2
qemu-ce2fa762a44c963725c1d497e10b08c6ef0c8356.zip
musicpal: True reset support for GPIO
Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/musicpal.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/hw/musicpal.c b/hw/musicpal.c
index efc20a4065..d4e797aac6 100644
--- a/hw/musicpal.c
+++ b/hw/musicpal.c
@@ -1128,8 +1128,12 @@ static CPUWriteMemoryFunc * const musicpal_gpio_writefn[] = {
musicpal_gpio_write,
};
-static void musicpal_gpio_reset(musicpal_gpio_state *s)
+static void musicpal_gpio_reset(void *opaque)
{
+ musicpal_gpio_state *s = opaque;
+
+ s->lcd_brightness = 0;
+ s->out_state = 0;
s->in_state = 0xffffffff;
s->ier = 0;
s->imr = 0;
@@ -1147,6 +1151,7 @@ static int musicpal_gpio_init(SysBusDevice *dev)
musicpal_gpio_writefn, s);
sysbus_init_mmio(dev, MP_GPIO_SIZE, iomemtype);
+ qemu_register_reset(musicpal_gpio_reset, s);
musicpal_gpio_reset(s);
qdev_init_gpio_out(&dev->qdev, s->out, ARRAY_SIZE(s->out));
@@ -1156,6 +1161,13 @@ static int musicpal_gpio_init(SysBusDevice *dev)
return 0;
}
+static SysBusDeviceInfo musicpal_gpio_info = {
+ .init = musicpal_gpio_init,
+ .qdev.name = "musicpal_gpio",
+ .qdev.size = sizeof(musicpal_gpio_state),
+ .qdev.reset = musicpal_gpio_reset,
+};
+
/* Keyboard codes & masks */
#define KEY_RELEASED 0x80
#define KEY_CODE 0x7f
@@ -1446,8 +1458,7 @@ static void musicpal_register_devices(void)
mv88w8618_wlan_init);
sysbus_register_dev("musicpal_lcd", sizeof(musicpal_lcd_state),
musicpal_lcd_init);
- sysbus_register_dev("musicpal_gpio", sizeof(musicpal_gpio_state),
- musicpal_gpio_init);
+ sysbus_register_withprop(&musicpal_gpio_info);
sysbus_register_dev("musicpal_key", sizeof(musicpal_key_state),
musicpal_key_init);
}