devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Ayush Singh <ayush@beagleboard.org>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Herve Codina <herve.codina@bootlin.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Rob Herring <robh@kernel.org>, Andrew Davis <afd@ti.com>,
	Wolfram Sang <wsa+renesas@sang-engineering.com>,
	devicetree@vger.kernel.org, Jason Kridner <jkridner@gmail.com>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	devicetree-compiler@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: Device tree representation of (hotplug) connectors: discussion at ELCE
Date: Fri, 19 Sep 2025 17:20:36 +0200	[thread overview]
Message-ID: <20250919172036.2f2b4bab@booty> (raw)
In-Reply-To: <dcbeaff2-0147-4a27-bb46-e247e42810d7@beagleboard.org>

On Fri, 19 Sep 2025 10:47:17 +0530
Ayush Singh <ayush@beagleboard.org> wrote:

> On 9/19/25 10:22, David Gibson wrote:
> 
> > On Thu, Sep 18, 2025 at 09:44:09AM +0200, Herve Codina wrote:  
> >> Hi David,
> >>
> >> On Thu, 18 Sep 2025 13:16:32 +1000
> >> David Gibson <david@gibson.dropbear.id.au> wrote:
> >>
> >> ...
> >>  
> >>>>> Thoughts above suggest a different direction, but here's what I was
> >>>>> thinking before:
> >>>>>
> >>>>> base board:
> >>>>>
> >>>>> 	connector {
> >>>>> 		/export/ "i2c" &i2c0;
> >>>>> 	};
> >>>>>
> >>>>> addon:
> >>>>> 	eeprom@10 {
> >>>>> 		compatible = "foo,eeprom";
> >>>>> 		bus-reg = <&i2c 0x10>;
> >>>>> 	}
> >>>>>
> >>>>> Or, if the addon had multiple i2c devices, maybe something like:
> >>>>>
> >>>>> 	board-i2c {
> >>>>> 		compatible = "i2c-simple-bridge";
> >>>>> 		bus-ranges = <&i2c 0 0x3ff>; /* Whole addr space */
> >>>>> 		eeprom@10 {
> >>>>> 			compatible = "foo,eeprom";
> >>>>> 			reg = <0x10>;
> >>>>> 		}
> >>>>> 		widget@20 {
> >>>>> 			compatible = "vendor,widget";
> >>>>> 			reg = <0x20>;
> >>>>> 		}
> >>>>> 	}
> >>>>>
> >>>>> Writing that, I realise I2C introduces some complications for this.
> >>>>> Because it has #size-cells = <0>, ranges doesn't really work (without
> >>>>> listing every single address to be translated).  Likewise, because we
> >>>>> always need the parent bus phandle, we can't use the trick of an empty
> >>>>> 'ranges' to mean an identity mapping.
> >>>>>
> >>>>> We could invent encodings to address those, but given the addon with
> >>>>> multiple connectors case provides another incentive for a single
> >>>>> connector to allow adding nodes in multiple (but strictly enumerated)
> >>>>> places in the base device tree provides a better approach.  
> >>>> and the "place in base device tree" is the goal of the extension bus.
> >>>>
> >>>> The strict enumeration of nodes enumerated is done by two means:
> >>>>   - extension busses at connector level
> >>>>     Those extensions are described as connector sub-nodes.
> >>>>     The addon DT can only add nodes in those sub-nodes to describe devices
> >>>>     connected to the relared extension bus.
> >>>>   - export symbols
> >>>>     An addon DT can only use symbols exported to reference symbols outside
> >>>>     the addon DT itself.
> >>>>
> >>>> Can I assume that bus extensions we proposed (i2c-bus-extension and
> >>>> spi-bus-extension) could be a correct solution ?  
> >>> Maybe?  I prefer the idea of a universal mechanism, not one that's
> >>> defined per-bus-type.
> >>>
> >>>
> >>> Also, IIUC the way bus extension operates is a bit different - nodes
> >>> would be "physically" added under the bus extension node, but treated
> >>> logically as if they go under the main bus.  What I'm proposing here
> >>> is something at the actualy overlay application layer that allows
> >>> nodes to be added to different parts of the base device tree - so you
> >>> could add your i2c device under the main i2c bus.  
> >> I think we should avoid this kind of node dispatching here and there in
> >> the base DT.  
> > Until I saw Geert's multi-connector case, I would have agreed.  That
> > case makes me thing differently: in order to support that case we
> > already have to handle adding information in multiple places (under
> > all of the connectors the addon uses).  Given we have to handle that
> > anyway, I wonder if it makes more sense to lean into that, and allow
> > updates to multiple (strictly enumerated) places.  
> 
> Well, I don't love this idea. Here are my main qalms about the approach 
> of adding devices directly to the actual i2c/spi etc nodes.
> 
> 1. In boards with multiple connectors, they sometimes share the same 
> i2c. Now assume that someone decided to connect the same i2c device to 
> both the connectors. If we are using something like bus extension, while 
> the node would be added, it will fail in the registration since you 
> cannot add the same address device a second time. However, if we are 
> adding the device directly to the `main_i2c`, the overlay application 
> will just end up modifying the exact same device node. There is no 
> error, or even a 2nd device node in this case. It is just lost.

Thinking out loud: what about preventing loading any overlay that does
more than just adding nodes? IOW forbidding to create properties in
nodes already in the live tree, and modifying existing properties.

I think being very restrictive in terms of overlays the implementation
can accept is a good idea in general. A requirement can be relaxed in
the future, but forbidding what used to be allowed would be a nightmare.

Best regards,
Luca

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

  reply	other threads:[~2025-09-19 15:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  8:57 Device tree representation of (hotplug) connectors: discussion at ELCE Luca Ceresoli
2025-09-04  5:23 ` David Gibson
2025-09-04  5:45   ` Ayush Singh
2025-09-08  4:36     ` David Gibson
2025-09-08  9:01       ` Geert Uytterhoeven
2025-09-09  2:44         ` David Gibson
2025-09-08 12:51       ` Herve Codina
2025-09-09  5:09         ` David Gibson
2025-09-09  9:41           ` Herve Codina
2025-09-09 13:04             ` Geert Uytterhoeven
2025-09-10  4:36               ` David Gibson
2025-09-11 10:11                 ` Herve Codina
2025-09-12  9:40                   ` Luca Ceresoli
2025-09-10  4:33             ` David Gibson
2025-09-11  8:48               ` Herve Codina
2025-09-11  8:54                 ` Geert Uytterhoeven
2025-09-11 10:23                   ` Herve Codina
2025-09-11 12:15                     ` Ayush Singh
2025-09-11 12:45                       ` Herve Codina
2025-09-11 13:08                         ` Geert Uytterhoeven
2025-09-11 13:58                           ` Herve Codina
2025-09-15  4:51                 ` David Gibson
2025-09-16  6:46                   ` Herve Codina
2025-09-16 10:14                     ` Geert Uytterhoeven
2025-09-16 12:22                       ` Ayush Singh
2025-09-16 13:34                         ` Geert Uytterhoeven
2025-09-16 14:25                           ` Herve Codina
2025-09-16 15:35                           ` Ayush Singh
2025-09-18  3:16                     ` David Gibson
2025-09-18  7:44                       ` Herve Codina
2025-09-18  8:06                         ` Herve Codina
2025-09-19  4:52                         ` David Gibson
2025-09-19  5:17                           ` Ayush Singh
2025-09-19 15:20                             ` Luca Ceresoli [this message]
2025-09-23  8:09                             ` David Gibson
2025-09-23  9:48                               ` Herve Codina
2025-09-23 10:29                                 ` Geert Uytterhoeven
2025-09-23 13:36                                   ` Herve Codina
2025-09-23 16:47                                     ` Andrew Davis
2025-09-24  4:17                                       ` David Gibson
2025-09-24  4:11                                   ` David Gibson
2025-09-24 17:03                                     ` Ayush Singh
2025-09-30  4:07                                       ` David Gibson
2025-09-30  7:52                                         ` Geert Uytterhoeven
2025-10-10  7:58                                           ` David Gibson
2025-10-10 16:31                                             ` Herve Codina
2025-09-24  3:54                                 ` David Gibson
2025-09-24 12:31                                   ` Herve Codina
2025-09-29  9:23                                     ` David Gibson
2025-09-30  7:09                                       ` Herve Codina

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=20250919172036.2f2b4bab@booty \
    --to=luca.ceresoli@bootlin.com \
    --cc=afd@ti.com \
    --cc=ayush@beagleboard.org \
    --cc=conor+dt@kernel.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=herve.codina@bootlin.com \
    --cc=jkridner@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.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).