devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Romain Gantois <romain.gantois@bootlin.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Kory Maincent <kory.maincent@bootlin.com>,
	linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, linux-media@vger.kernel.org,
	linux-gpio@vger.kernel.org,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Derek Kiernan <derek.kiernan@amd.com>,
	Dragan Cvetic <dragan.cvetic@amd.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Cosmin Tanislav <demonsingur@gmail.com>
Subject: Re: [PATCH v3 0/9] misc: Support TI FPC202 dual-port controller
Date: Tue, 3 Dec 2024 10:36:36 +0100	[thread overview]
Message-ID: <20241203103636.32c80ce0@booty> (raw)
In-Reply-To: <2843405.KjTqZUKg7o@fw-rgant>

Hello Romain, Tomi,

On Tue, 03 Dec 2024 09:42:07 +0100
Romain Gantois <romain.gantois@bootlin.com> wrote:

> Hi Tomi,
> 
> On vendredi 29 novembre 2024 13:01:58 heure normale d’Europe centrale Tomi Valkeinen wrote:
> > Hi,
> > 
> > On 25/11/2024 10:45, Romain Gantois wrote:  
> > > Hello everyone,
> > > 
> > > This is version three of my series which adds support for the TI FPC202
> > > dual-port controller. This is an unusual kind of device which is used as a
> > > low-speed signal aggregator for various types of SFP-like hardware ports.
> > > 
> > > The FPC202 exposes an I2C, or SPI (not supported in this series) control
> > > interface, which can be used to access two downstream I2C busses, along
> > > with a set of low-speed GPIO signals for each port. It also has I2C
> > > address
> > > translation (ATR) features, which allow multiple I2C devices with the same
> > > address (e.g. SFP EEPROMs at address 0x50) to be accessed from the
> > > upstream
> > > control interface on different addresses.
> > > 
> > > I've chosen to add this driver to the misc subsystem, as it doesn't
> > > strictly belong in either the i2c or gpio sybsystem, and as far as I know
> > > it is the first device of its kind to be added to the kernel.
> > > 
> > > Along with the FPC202 driver itself, this series also adds support for
> > > dynamic address translation to the i2c-atr module. This allows I2C address
> > > translators to update their translation table on-the-fly when they receive
> > > transactions to unmapped clients. This feature is needed by the FPC202
> > > driver to access up to three logical I2C devices per-port, given that the
> > > FPC202 address translation table only has two address slots.  
> > 
> > While the FPD-Link devices are quite different than the TPC202, I wonder
> > what's the difference wrt. the ATR... Afaics, the difference is that the
> > FPC202 has 2 slots whereas UB960 has 8. So if you have 3+ remote devices
> > on FPC202, you get problems, or if you have 9+ devices on UB960, you get
> > problems.
> > 
> > Yet this series adds a I2C_ATR_FLAG_DYNAMIC_C2A flag which the driver
> > needs to set, and the i2c-atr has different code paths depending on the
> > flag. In other words, either the driver author (if it's a hardcoded
> > flag) or the driver (if it's set dynamically) is assumed to know how
> > many remote devices there are, and whether that flag is needed.
> > 
> > On the other hand, if I consider I2C_ATR_FLAG_DYNAMIC_C2A meaning that
> > the device can support dynamically changing the ATR, then it makes more
> > sense, and also UB960 should set the flag.
> >   
> 
> Indeed, the need for dynamic address translation isn't solely determined by
> the ATR model. It's also determined by the number of logical I2C devices
> connected to the downstream ports. In that sense, hardcoding the flag in the
> ATR driver doesn't seem completely appropriate.
> 
> However, you could reasonably imagine that some future ATR models won't
> support hot-swapping aliases at runtime. In this case, this flag will be
> necessary at the very least as a capability flag i.e. "this ATR model can do
> dynamic translation but it's not necessarily activated by default".
> 
> > But then I wonder, do we even have cases with ATRs that need to be
> > programmed once at init time, and cannot be changed afterwards? If not,
> > then the I2C_ATR_FLAG_DYNAMIC_C2A can be the default, and the
> > non-I2C_ATR_FLAG_DYNAMIC_C2A code can be dropped. Actually, even the
> > current upstream i2c-atr is dynamic in a sense: the clients are attached
> > via the i2c_atr_bus_notifier_call(), one by one.
> >   
> 
> Indeed, if an ATR component doesn't support hot-swapping of aliases, then
> it will be broken anyway if a device attaches after the ATR's been initialized.
> Maybe we should just assume that all supported ATR's should be capable of
> modifying their translation table after initialization then.

I think this is a reasonable assumption, and so we should not implement
support for "non-dynamic ATRs" unless (until?) there is a valid use
case.

Luca

-- 
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

      reply	other threads:[~2024-12-03  9:36 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25  8:45 [PATCH v3 0/9] misc: Support TI FPC202 dual-port controller Romain Gantois
2024-11-25  8:45 ` [PATCH v3 1/9] dt-bindings: misc: Describe TI FPC202 dual port controller Romain Gantois
2024-11-25 18:26   ` Conor Dooley
2024-11-26  8:05     ` Romain Gantois
2024-11-26 18:09       ` Conor Dooley
2024-11-27  8:20         ` Romain Gantois
2024-11-25  8:45 ` [PATCH v3 2/9] media: i2c: ds90ub960: Replace aliased clients list with bitmap Romain Gantois
2024-11-29 13:46   ` Tomi Valkeinen
2024-12-03  8:48     ` Romain Gantois
2024-11-25  8:45 ` [PATCH v3 3/9] media: i2c: ds90ub960: Protect alias_use_mask with a mutex Romain Gantois
2024-11-25  8:45 ` [PATCH v3 4/9] i2c: use client addresses directly in ATR interface Romain Gantois
2024-11-25  8:45 ` [PATCH v3 5/9] i2c: move ATR alias pool to a separate struct Romain Gantois
2024-11-25  8:45 ` [PATCH v3 6/9] i2c: rename field 'alias_list' of struct i2c_atr_chan to 'alias_pairs' Romain Gantois
2024-11-25  8:45 ` [PATCH v3 7/9] i2c: support per-channel ATR alias pools Romain Gantois
2024-11-25  8:45 ` [PATCH v3 8/9] i2c: Support dynamic address translation Romain Gantois
2024-11-29  9:54   ` Tomi Valkeinen
2024-12-03  8:59     ` Romain Gantois
2024-12-09 12:42     ` Romain Gantois
2024-12-10 15:21       ` Romain Gantois
2024-11-25  8:45 ` [PATCH v3 9/9] misc: add FPC202 dual port controller driver Romain Gantois
2024-11-29 12:01 ` [PATCH v3 0/9] misc: Support TI FPC202 dual-port controller Tomi Valkeinen
2024-12-03  8:42   ` Romain Gantois
2024-12-03  9:36     ` Luca Ceresoli [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241203103636.32c80ce0@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=andi.shyti@kernel.org \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=demonsingur@gmail.com \
    --cc=derek.kiernan@amd.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragan.cvetic@amd.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kory.maincent@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=robh@kernel.org \
    --cc=romain.gantois@bootlin.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).