summaryrefslogtreecommitdiff
path: root/hw/stellaris.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-23 00:05:19 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-23 00:13:41 +0100
commit02e2da45c4601909d5105838323d5c529ec7010b (patch)
treee9b1099baa55c3f8084110feb28f57ede8d2de3a /hw/stellaris.c
parent4856fcff8af1ba349baaf063af00f5e5d87a99f4 (diff)
Add common BusState
Implement and use a common device bus state. The main side-effect is that creating a bus and attaching it to a parent device are no longer separate operations. For legacy code we allow a NULL parent, but that should go away eventually. Also tweak creation code to veriry theat a device in on the right bus. Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/stellaris.c')
-rw-r--r--hw/stellaris.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/stellaris.c b/hw/stellaris.c
index e7f3604f78..a107db7465 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -874,11 +874,11 @@ static int stellaris_i2c_load(QEMUFile *f, void *opaque, int version_id)
static void stellaris_i2c_init(SysBusDevice * dev)
{
stellaris_i2c_state *s = FROM_SYSBUS(stellaris_i2c_state, dev);
- i2c_bus *bus = i2c_init_bus();
+ i2c_bus *bus;
int iomemtype;
sysbus_init_irq(dev, &s->irq);
- qdev_attach_child_bus(&dev->qdev, "i2c", bus);
+ bus = i2c_init_bus(&dev->qdev, "i2c");
s->bus = bus;
iomemtype = cpu_register_io_memory(0, stellaris_i2c_readfn,
@@ -1239,10 +1239,8 @@ static void stellaris_ssi_bus_init(SSISlave *dev)
{
stellaris_ssi_bus_state *s = FROM_SSI_SLAVE(stellaris_ssi_bus_state, dev);
- s->bus[0] = ssi_create_bus();
- qdev_attach_child_bus(&dev->qdev, "ssi0", s->bus[0]);
- s->bus[1] = ssi_create_bus();
- qdev_attach_child_bus(&dev->qdev, "ssi1", s->bus[1]);
+ s->bus[0] = ssi_create_bus(&dev->qdev, "ssi0");
+ s->bus[1] = ssi_create_bus(&dev->qdev, "ssi1");
qdev_init_gpio_in(&dev->qdev, stellaris_ssi_bus_select, 1);
register_savevm("stellaris_ssi_bus", -1, 1,
@@ -1320,7 +1318,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
if (board->dc2 & (1 << 12)) {
DeviceState *dev;
dev = sysbus_create_simple("stellaris-i2c", 0x40020000, pic[8]);
- i2c = qdev_get_child_bus(dev, "i2c");
+ i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
if (board->peripherals & BP_OLED_I2C) {
i2c_create_slave(i2c, "ssd0303", 0x3d);
}