devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Herve Codina <herve.codina@bootlin.com>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	Ayush Singh <ayush@beagleboard.org>,
	 Luca Ceresoli <luca.ceresoli@bootlin.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	devicetree@vger.kernel.org,  Rob Herring <robh@kernel.org>,
	Jason Kridner <jkridner@gmail.com>,
	 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>,
	Andrew Davis <afd@ti.com>
Subject: Re: Device tree representation of (hotplug) connectors: discussion at ELCE
Date: Tue, 9 Sep 2025 15:04:49 +0200	[thread overview]
Message-ID: <CAMuHMdVarhTFEhQoYHWCnJp0iWRCjm0wh_ryP73aOdUwVa0X4Q@mail.gmail.com> (raw)
In-Reply-To: <20250909114126.219c57b8@bootlin.com>

Hi Hervé,

On Tue, 9 Sept 2025 at 11:41, Herve Codina <herve.codina@bootlin.com> wrote:
> On Tue, 9 Sep 2025 15:09:18 +1000
> David Gibson <david@gibson.dropbear.id.au> wrote:
> > > I think that a connector is something with a bunch of resources provided
> > > by the board where the connector is soldered. Those resources are wired
> > > to the connector and defined by the connector pinout.
> > >
> > >      3v3   ------- Pin 0
> > >   i2c_scl  ------- Pin 1
> > >   i2c_sda  ------- Pin 2
> > >     gpio A ------- Pin 3
> > >     gpio B ------- Pin 4
> > >      gnd   ------- Pin 5
> > >
> > > IMHO, this need to be described and defined in the base board and an addon can
> > > only reference resources wired and described by the connector node.
> >
> > Yes, that's exactly what I'm proposing too.
> >
> > > Now, questions are:
> > >   - 1) How to describe a connector?
> > >   - 2) How to reference resources provided at connector level from an add-on?
> >
> > Right.
> >
> > > Our current approach was:
> > > ---- base board DT ----
> > >   connector0 {
> > >     gpio-map = <0 &gpio0 12>, /* gpio A wired to gpio 12 of gpio0 controller */
> > >                    <1 &gpio2 10;  /* gpio B wired to gpio 10 of gpio2 controller */
> > >         i2c-one {
> > >             compatible = "i2c-bus-extension";
> > >             i2c-parent = <i2c5>; /* i2c-one wired to i2c5 controller */
> > >     };
> > >
> > >     i2c-two {
> > >             compatible = "i2c-bus-extension";
> > >             i2c-parent = <i2c6>; /* i2c-two wired to i2c6 controller */
> > >     };
> > >
> > >     /*
> > >          * From the addon we need to reference:
> > >          *    - The connector itself,
> > >          *    - Maybe some pinctrl related to signals wired to the connector,
> > >          *    - In some cases the i2c bus (HDMI, ddc-i2c-bus = <&i2c-two>;)
> > >          *
> > >          * This was solved introducing the controversial export-symbols node.
> > >          */
> >
> > I think the type of connector should also be named on both sides (with
> > 'compatible' or something like it).
>
> It makes sense.

Probably we also want header files under <dt/bindings/...> that define
the (sole) symbols that are provided by a connector, and can be consumed
by an attached board?  Cfr. C header files defining an API.
In case of multiple connectors (esp. of the same type), we need to
specify a prefix before including the header file (see also namespacing
below).

>
> >
> > >   };
> > >
> > > ---- addon board DT ----
> > >    {
> > >     some-node {
> > >             compatible = "foo,bar";
> > >             reset-gpios = <&connector 0>; /* gpio A used as a reset gpio */
> > >             ddc-i2c-bus = <&i2c-two>;
> > >         }
> > >
> > >         i2c-one {
> > >             eeprom@10 {
> > >                     compatible = "baz,eeprom"
> > >                     reg = 10;
> > >             };
> > >     };
> > >    };
> > >
> > > The addon board DT can only be applied at a connector node.
> >
> > Right.  This is not how overlays work now.  By the nature of how
> > they're built they apply global updates to the base tree.  That means
> > we need to spec a new way of describing addons that *is* restricted to
> > a particular connector slot (or slots, as Geert points out).  Since we
> > have that opportunity, we should _not_ try to make it a minimal
> > extension to existing overlay format, but define a new and better
> > encoding, designed to meet the problems you're looking to address.
>
> On the kernel side, overlays can be applied at a specific node.
> The node is chosen when the overlay is apply.
>   https://elixir.bootlin.com/linux/v6.16/source/drivers/of/overlay.c#L970
>
> This allows to apply an overlay to a specific node without any modification
> of the overlay dtb (dtbo).

Which currently supports a single node/connector.

> > > > > > 3) bus-reg / bus-ranges
> > > > > >
> > > > > > One thing that makes connector plugins a bit awkward is that they
> > > > > > often need to add things to multiple buses on the host system (MMIO &
> > > > > > i2c for a simple case).  This means that once resolved the plugin
> > > > > > isn't neatly a single subtree.  That's one factor making removal
> > >
> > > It can be a single subtree if decoupling is present at connector node available
> > > in the base device tree.
> >
> > Right - allowing that decoupling is exactly what I'm proposing bus-reg
> > for.  Note that the case of an addon that plugs into multiple
> > connectors that Geert pointed out complicates this again.
>
> Geert's use case needs to be clarified.
>
> Suppose a base board with 2 connectors:
>  - connA
>  - connB
>
> Case 1: Addons are independant
>                +--------+
>   connA <----> | AddonA |
>                +--------+
>                           +--------+
>   connB <---------------->| AddonB |
>                           +--------+
>
> With addonA and B two addon board each connected at one connector without any
> relationship between addon A and B
>
> Case 2: Only one Addons using ressources from both connector
>
>                 +------+
>   connA <-----> |Addon |
>                 |      |
>   connB <-----> |      |
>                 +------+
>
> The addon is connected to both connector and uses ressources from connA and
> connB in a dependent manner.
>
>
> The Case 2 can be solved using a connector that described both connA and connB.
> Having the split connA and connB is a mechanical point of view.
>
> Also adding and Addon on only one part (connA for instance) should not be an issue
> if the connector describe both parts.
>
> but well, here again I can miss something.
> Geert, can you provide details?

I think the above describes it well, thanks!

However, I am not so fond of having to describe yet another connector
that contains connA and connB.  E.g. a base board with 6 PMOD connectors
would need to describe 30 combinations...

> > > A reference to connector (&connector) from the addon will be resolve
> > > to a reference to &conn0 (phandle of the connector0 node.
> >
> > To handle the addon with multiple connectors we might want an
> > (optional) remapping / renaming on the addon side as well.  Or maybe
> > simpler, we could allow namespacing the references on the addon side.
>
> I think you talk about the Geert use case.
> Geert, an example should be welcome.
>
> The plan was to apply the DT related to an addon at a connector node.
> Maybe this will not fit well with Geert's use case but to know if it
> fits or not and to find the best way to handle this use case, an
> example is needed.

A PMOD Type 2A (expanded SPI) connector provides SPI and 4 GPIOS.
A PMOD Type 6A (expanded I2C) connector provides I2C and 4 GPIOS.
Hence a plug-in board that needs SPI, I2C, and a few GPIOs, would need
to plug into two PMOD connectors.

Or:
A PMOD Type 1A (expanded GPIO) connector provides 8 GPIOS.
Hence a non-multiplexed dual 7-segment LED display plug-in board needs
14 or 16 GPIOS, and thus would plug into two PMOD connectors.

To plug into two connectors, a mapping needs to provided between two
connectors on base and add-on board.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2025-09-09 13:05 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 [this message]
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
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=CAMuHMdVarhTFEhQoYHWCnJp0iWRCjm0wh_ryP73aOdUwVa0X4Q@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --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=herve.codina@bootlin.com \
    --cc=jkridner@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca.ceresoli@bootlin.com \
    --cc=robh@kernel.org \
    --cc=thomas.petazzoni@bootlin.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).