[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b954c7b7-1094-48f9-afd9-00e386cd2443@ideasonboard.com>
Date: Tue, 26 Nov 2024 10:35:46 +0200
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Luca Ceresoli <luca.ceresoli@...tlin.com>
Cc: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Sakari Ailus <sakari.ailus@...ux.intel.com>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, Wolfram Sang <wsa@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Cosmin Tanislav <demonsingur@...il.com>,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>,
Romain Gantois <romain.gantois@...tlin.com>
Subject: Re: [PATCH v2 2/3] i2c: atr: Allow unmapped addresses from nested
ATRs
Hi Luca,
On 26/11/2024 10:16, Luca Ceresoli wrote:
> Hello Tomi,
>
> On Fri, 22 Nov 2024 14:26:19 +0200
> Tomi Valkeinen <tomi.valkeinen@...asonboard.com> wrote:
>
>> From: Cosmin Tanislav <demonsingur@...il.com>
>>
>> i2c-atr translates the i2c transactions and forwards them to its parent
>> i2c bus. Any transaction to an i2c address that has not been mapped on
>> the i2c-atr will be rejected with an error.
>>
>> However, if the parent i2c bus is another i2c-atr, the parent i2c-atr
>> gets a transaction to an i2c address that is not mapped in the parent
>> i2c-atr, and thus fails.
>
> Nested ATRs are "interesting", to say the least! :-)
>
> I must say I don't understand the problem here. If this is the picture:
>
> adapter ----> ATR1 ----> ATR2 ----> leaf device
> map: map: addr:
> alias addr alias addr 0x10
> 0x30 0x20 0x20 0x10
>
> Then I'd expect this:
>
> 1. the leaf device asks ATR2 for a transaction to 0x10
> 2. 0x10 is in ATR2 map, ATR2 translates address 0x10 to 0x20
> 3. ATR2 asks ATR1 for a transaction to 0x20
> 4. 0x20 is in ATR1 map, ATR1 translates address 0x20 to 0x30
> 5. ATR1 asks adapter for transaction on 0x30
>
> So ATR1 is never asked for 0x10.
Yes, that case would work. But in your example the ATR1 somehow has
created a mapping for ATR2's alias.
Generally speaking, ATR1 has aliases only for devices in its master bus
(i.e. the i2c bus where the ATR1 is the master, not slave), and
similarly for ATR2. Thus I think a more realistic example is:
adapter ----> ATR1 ----> ATR2 ----> leaf device
addr: 0x50 addr: 0x30
map: map: addr:
alias addr alias addr 0x10
0x40 0x30 0x20 0x10
So, both ATRs create the alias mapping based on the i2c-aliases given to
them in the DT, for the slave devices in their i2c bus. Assumption is,
of course, that the aliases are not otherwise used, and not overlapping.
Thus the aliases on ATR2 are not present in the alias table of ATR1.
Tomi
Powered by blists - more mailing lists