From: Luca Ceresoli <luca.ceresoli@bootlin.com>
To: Krzysztof Kozlowski <krzk@kernel.org>
Cc: Ayush Singh <ayush@beagleboard.org>,
Mark Brown <broonie@kernel.org>,
herve.codina@bootlin.com, conor+dt@kernel.org,
Jason Kridner <jkridner@beagleboard.org>,
Deepak Khatri <lorforlinux@beagleboard.org>,
Dhruva Gole <d-gole@ti.com>,
Robert Nelson <robertcnelson@beagleboard.org>,
Andrew Davis <afd@ti.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 4/4] devicetree: bindings: spi: Introduce SPI bus extensions
Date: Wed, 30 Jul 2025 17:45:53 +0200 [thread overview]
Message-ID: <20250730174553.4df8037b@booty> (raw)
In-Reply-To: <c65d26d0-51b8-4131-a755-6c72b7dea549@kernel.org>
On Tue, 29 Jul 2025 14:52:00 +0200
Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On 29/07/2025 11:51, Ayush Singh wrote:
> > An SPI bus can be wired to the connector and allows an add-on board to
> > connect additional SPI devices to this bus.
> >
>
> ... so I found the binding. Not marked by my filters due to non-standard
> subject.
>
> Please use subject prefixes matching the subsystem. You can get them for
> example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
> your patch is touching. For bindings, the preferred subjects are
> explained here:
> https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters
>
> > Those additional SPI devices could be described as sub-nodes of the SPI
> > bus controller node however for hotplug connectors described via device
> > tree overlays there is additional level of indirection, which is needed
> > to decouple the overlay and the base tree:
> >
> > --- base device tree ---
> >
> > spi1: spi@abcd0000 {
> > compatible = "xyz,foo";
> > spi-bus-extension@0 {
> > spi-bus = <&spi_ctrl>;
> > };
> > ...
> > };
> >
> > spi5: spi@cafe0000 {
> > compatible = "xyz,bar";
> > spi-bus-extension@0 {
> > spi-bus = <&spi_sensors>;
> > };
> > ...
> > };
> >
> > connector {
> > spi_ctrl: spi-ctrl {
> > spi-parent = <&spi1>;
> > #address-cells = <1>;
> > #size-cells = <0>;
> > };
> >
> > spi_sensors: spi-sensors {
> > spi-parent = <&spi5>;
> > #address-cells = <1>;
> > #size-cells = <0>;
> > };
> > };
>
> It looks like you are re-doing I2C work. Please wait till I2C discussion
> finishes, so we won't have to comment on the same in multiple places.
>
> >
> > --- device tree overlay ---
> >
> > ...
> > // This node will overlay on the spi-ctrl node of the base tree
> > spi-ctrl {
> > eeprom@50 { compatible = "atmel,24c64"; ... };
> > };
> > ...
> >
> > --- resulting device tree ---
> >
> > spi1: spi@abcd0000 {
> > compatible = "xyz,foo";
> > spi-bus-extension@0 {
> > spi-bus = <&spi_ctrl>;
> > };
> > ...
> > };
> >
> > spi5: spi@cafe0000 {
> > compatible = "xyz,bar";
> > spi-bus-extension@0 {
> > spi-bus = <&spi_sensors>;
> > };
> > ...
> > };
> >
> > connector {
> > spi_ctrl: spi-ctrl {
> > spi-parent = <&spi1>;
> > #address-cells = <1>;
> > #size-cells = <0>;
> >
> > device@1 { compatible = "xyz,foo"; ... };
> > };
> >
> > spi_sensors: spi-sensors {
> > spi-parent = <&spi5>;
> > #address-cells = <1>;
> > #size-cells = <0>;
> > };
> > };
> >
> > Here spi-ctrl (same goes for spi-sensors) represent the part of SPI bus
> > that is on the hot-pluggable add-on. On hot-plugging it will physically
> > connect to the SPI adapter on the base board. Let's call the 'spi-ctrl'
> > node an "extension node".
> >
> > In order to decouple the overlay from the base tree, the SPI adapter
> > (spi@abcd0000) and the extension node (spi-ctrl) are separate nodes.
> >
> > The extension node is linked to the SPI bus controller in two ways. The
> > first one with the spi-bus-extension available in SPI controller
> > sub-node and the second one with the spi-parent property available in
> > the extension node itself.
> >
> > The purpose of those two links is to provide the link in both direction
> > from the SPI controller to the SPI extension and from the SPI extension
> > to the SPI controller.
> >
> > Signed-off-by: Ayush Singh <ayush@beagleboard.org>
> > ---
> > .../devicetree/bindings/spi/spi-controller.yaml | 66 +++++++++++++++++++++-
> > 1 file changed, 65 insertions(+), 1 deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml
> > index 82d051f7bd6e09dab9809c85ff13475d2b118efd..9b44ce4542f9552c94cb0658ffe3f6d3f29bc434 100644
> > --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml
> > +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml
> > @@ -25,6 +25,13 @@ properties:
> > "#size-cells":
> > const: 0
> >
> > + spi-parent:
> > + $ref: /schemas/types.yaml#/definitions/phandle
> > + description:
> > + In case of an SPI bus extension, reference to the SPI bus controller
> > + this extension is connected to. In other word, reference the SPI bus
> > + controller on the fixed side that drives the bus extension.
> > +
> > cs-gpios:
> > description: |
> > GPIOs used as chip selects.
> > @@ -111,7 +118,26 @@ properties:
> > - compatible
> >
> > patternProperties:
> > - "^.*@[0-9a-f]+$":
> > + 'spi-bus-extension@[0-9a-f]+$':
> > + type: object
> > + description:
> > + An SPI bus extension connected to an SPI bus. Those extensions allow to
> > + decouple SPI busses when they are wired to connectors.
>
> I really do not get why you need separate two-way phandles for marking
> parent child relationship. IOW, if you need two way, then why not graphs?
>
> Or why not just making the device@2 a child of SPI, since it is coming
> from overlay.
For the same reason as in I2C (and the proposed solution is the same).
As you wrote above, Ayush could wait for the I2C discussion to finish.
Problem is, the I2C discussion is not moving forward: Hervé is sending
proposals but there is no feedback on the core of the proposal, and no
feedback at all on the latest iteration. In case your filters missed it:
https://lore.kernel.org/all/20250618082313.549140-1-herve.codina@bootlin.com/
I think Ayush's series is useful anyway in that it shows the approach
Hervé proposed works unmodified for another subsystem and is useful for
a different use case.
Luca
--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2025-07-30 15:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-29 9:50 [PATCH 0/4] spi: Introduce spi bus extensions Ayush Singh
2025-07-29 9:51 ` [PATCH 1/4] spi: Follow spi-parent when retrieving a controller from node Ayush Singh
2025-07-29 9:51 ` [PATCH 2/4] spi: Move children registration in a dedicated function Ayush Singh
2025-07-29 9:51 ` [PATCH 3/4] spi: Handle spi bus extension Ayush Singh
2025-07-29 12:46 ` Krzysztof Kozlowski
2025-07-29 12:52 ` Ayush Singh
2025-07-29 13:09 ` Krzysztof Kozlowski
2025-07-29 9:51 ` [PATCH 4/4] devicetree: bindings: spi: Introduce SPI bus extensions Ayush Singh
2025-07-29 12:52 ` Krzysztof Kozlowski
2025-07-30 15:45 ` Luca Ceresoli [this message]
2025-07-30 18:30 ` Andrew Davis
2025-07-29 13:12 ` Rob Herring (Arm)
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=20250730174553.4df8037b@booty \
--to=luca.ceresoli@bootlin.com \
--cc=afd@ti.com \
--cc=ayush@beagleboard.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=d-gole@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=herve.codina@bootlin.com \
--cc=jkridner@beagleboard.org \
--cc=krzk+dt@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=lorforlinux@beagleboard.org \
--cc=robertcnelson@beagleboard.org \
--cc=robh@kernel.org \
/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).