[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/6] arm: Uniquely name imx25 I2C buses.
From: |
Alexey Kardashevskiy |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/6] arm: Uniquely name imx25 I2C buses. |
Date: |
Thu, 1 Dec 2016 14:10:39 +1100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 01/12/16 11:42, Alastair D'Silva wrote:
> On Wed, 2016-11-30 at 09:18 +0100, Cédric Le Goater wrote:
>> On 11/30/2016 06:36 AM, Alastair D'Silva wrote:
>>> 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
It is still not guaranteed that first in the command will get "i2c.0" name,
second - "i2c.1", etc.
Just pass id=i2cX via the command line explicitly when creating a i2c bus
device and use it as a bus id, and I am pretty sure QEMU will add a period
and a number itself.
>>>
>>> Signed-off-by: Alastair D'Silva <address@hidden>
>>> ---
>>> hw/arm/imx25_pdk.c | 4 +---
>>> hw/i2c/imx_i2c.c | 6 +++++-
>>> 2 files changed, 6 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/hw/arm/imx25_pdk.c b/hw/arm/imx25_pdk.c
>>> index 025b608..c6f04d3 100644
>>> --- a/hw/arm/imx25_pdk.c
>>> +++ b/hw/arm/imx25_pdk.c
>>> @@ -138,9 +138,7 @@ static void imx25_pdk_init(MachineState
>>> *machine)
>>> * We add it here (only on qtest usage) to be able to do a
>>> bit
>>> * of simple qtest. See "make check" for details.
>>> */
>>> - i2c_create_slave((I2CBus *)qdev_get_child_bus(DEVICE(&s-
>>>> soc.i2c[0]),
>>> - "i2c"),
>>> - "ds1338", 0x68);
>>> + i2c_create_slave(s->soc.i2c[0].bus, "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;
>>
>> hmm, the static is ugly :/
>>
>> Isn't there other ways to achieve this naming ?
>>
>> Thanks,
>>
>> C.
>>
>
> I'm not seeing an obvious way around it. The busses are realized
> independently (so I can't implement what we do with the aspeed i2c
> busses), and it is named before fsl-imx25:fsl_imx25_realize() can apply
> specific properties to the bus.
>
> If you have any suggestions, I'm all ears.
--
Alexey
- [Qemu-devel] [PATCH v2 0/6] Add support for the Epson RX8900 RTC to the aspeed board, Alastair D'Silva, 2016/11/30
- [Qemu-devel] [PATCH v2 5/6] tests: Test all implemented RX8900 functionality, Alastair D'Silva, 2016/11/30
- [Qemu-devel] [PATCH v2 4/6] hw/timer: Add Epson RX8900 RTC support, Alastair D'Silva, 2016/11/30
- Re: [Qemu-devel] [PATCH v2 0/6] Add support for the Epson RX8900 RTC to the aspeed board, no-reply, 2016/11/30
- Re: [Qemu-devel] [PATCH v2 0/6] Add support for the Epson RX8900 RTC to the aspeed board, Alastair D'Silva, 2016/11/30