Re: Device tree representation of (hotplug) connectors: discussion at ELCE
David Gibson <[email protected]> Thu, 18 Sep 2025 13:16:32 +1000
| Newsgroups | org.kernel.vger.devicetree-compiler,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <aMt5kEI_WRDOf-Hw@zatzit> |
On Tue, Sep 16, 2025 at 08:46:31AM +0200, Herve Codina wrote: > Hi David, > > +CC Wolfram > > On Mon, 15 Sep 2025 14:51:41 +1000 > David Gibson <[email protected]> wrote: > > > On Thu, Sep 11, 2025 at 10:48:28AM +0200, Herve Codina wrote: [snip] > > > I have the feeling that the choice of physical connectors to which the addon > > > board is connected to is a human choice when the board is connected. > > > > Yes. Although if the addons have an EEPROM, or some other sort of ID > > register, it may be possible for some connector drivers to probe this. > > Right, I think we agree that a driver is needed to help in the mapping at > least when multiple connectors are involved. Yes. Although it's likely this could be handled by a single, trivial driver for cases where there's nothing probeable and you just rely on being told the right thing by the user. This is kind of the connector equivalent of "simple-bus". [snip] > > 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. That approach does complicate removal, but its not as bad as overlays at the moment, because a) it could be limited to adding new nodes, not modifying existing ones and b) the connector would specify exactly the places that additions are allowed. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmjLeY8ACgkQzQJF27ox 2GfLnQ//aL2zBwNsdL6Pt1LINGg0apRypnqJml52TNFjhvTkDFCWqsdkXwtkfLmP JWDXTzMQxP+SOYyZhQevy5CYezuc2G0kHkrXVVXNL/ZNQpZPgEJ3ePhihATWbGYp ATEhFyPwevYQ8swmlhEZ/I+JPenf0BPgDt+cjuz+wam/LizFbnNqYhq5KQ8WNVqG 5xf1SBXa3QIkJf2Z+/l1iMowbHPq8JAee5Dt2DYfxSkSSbND4+wiugiUbyG+nvZB XLhOGAu/PjLBDXxV4DzOMBs7YYLoo/kc3Ou2Fdz3+4sINQLzXdYMCC8bxxiCDtUi zNZ+nkpa5DHw6Ggv7WCGurhT3vZPhnN2CT2XUo/sLNJzOc5MVvxm0XQVmHjT9SEw HezNev/sclWp73hg5TrdXeMID2qlo5lXgQlQQ6TQK5YnxoprzFBwMZ+VL8dntACe Qc4ErVww388b6nbQuUw5nOO7vs1PReVLeKzv2i93qj+f7xUb/SIX6+w2UtvceXWP t51EFDF3D8Z9DpAX69GGs73MjejMkXPdFoJiyyd/oiYdWmZeWrLL185pXJphz0kV eySvVq9LTovKn725Z2qTUEq1El1ALhJRgqVuZa+DT+SWQJejpuHyMBFPEHTbhOak 6I9AGQCgqFcveg8e8dY0cnTbVy2oSk6H3J8lkpNie+CZkVb4f14= =2VAy -----END PGP SIGNATURE-----