[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 1/4] arm: Uniquely name imx25 I2C buses.
From: |
Alastair D'Silva |
Subject: |
[Qemu-devel] [PATCH 1/4] arm: Uniquely name imx25 I2C buses. |
Date: |
Thu, 17 Nov 2016 15:36:37 +1100 |
From: Alastair D'Silva <address@hidden>
The imx25 chip provides 3 i2c buses, but they have all been named
"i2c", which makes it difficult to predict which bus a device will
be connected to when specified on the command line.
This patch addresses the issue by naming the buses uniquely:
i2c.0 i2c.1 i2c.2
Signed-off-by: Alastair D'Silva <address@hidden>
---
hw/arm/imx25_pdk.c | 2 +-
hw/i2c/imx_i2c.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
index 025b608..1f7512c 100644
--- a/hw/arm/imx25_pdk.c
+++ b/hw/arm/imx25_pdk.c
@@ -139,7 +139,7 @@ static void imx25_pdk_init(MachineState *machine)
* of simple qtest. See "make check" for details.
*/
i2c_create_slave((I2CBus *)qdev_get_child_bus(DEVICE(&s->soc.i2c[0]),
- "i2c"),
+ "i2c.0"),
"ds1338", 0x68);
}
}
diff --git a/hw/i2c/imx_i2c.c b/hw/i2c/imx_i2c.c
index 37e5a62..7be10fb 100644
--- a/hw/i2c/imx_i2c.c
+++ b/hw/i2c/imx_i2c.c
@@ -305,12 +305,16 @@ static const VMStateDescription imx_i2c_vmstate = {
static void imx_i2c_realize(DeviceState *dev, Error **errp)
{
IMXI2CState *s = IMX_I2C(dev);
+ static int bus_count;
+ char name[16];
+
+ snprintf(name, sizeof(name), "i2c.%d", bus_count++);
memory_region_init_io(&s->iomem, OBJECT(s), &imx_i2c_ops, s, TYPE_IMX_I2C,
IMX_I2C_MEM_SIZE);
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
- s->bus = i2c_init_bus(DEVICE(dev), "i2c");
+ s->bus = i2c_init_bus(DEVICE(dev), name);
}
static void imx_i2c_class_init(ObjectClass *klass, void *data)
--
2.7.4
- Re: [Qemu-devel] [Qemu-arm] [PATCH 2/4] qtest: Support named interrupts, (continued)
[Qemu-devel] [PATCH 3/4] hw/timer: Add Epson RX8900 RTC support, Alastair D'Silva, 2016/11/17
[Qemu-devel] [PATCH 1/4] arm: Uniquely name imx25 I2C buses.,
Alastair D'Silva <=
Re: [Qemu-devel] [PATCH 0/4] Add support for the Epson RX8900 RTC to the aspeed board, no-reply, 2016/11/17