From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Conor Dooley" <conor@kernel.org>,
"Janani Sunil" <janani.sunil@analog.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Mark Brown" <broonie@kernel.org>,
"Marius Cristea" <marius.cristea@microchip.com>,
"Marcus Folkesson" <marcus.folkesson@gmail.com>,
"Kent Gustavsson" <kent@minoris.se>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
"Janani Sunil" <jan.sun97@gmail.com>,
linux-spi@vger.kernel.org, "Kent Gustavsson" <nedo80@gmail.com>
Subject: Re: [PATCH v7 1/7] spi: dt-bindings: Add spi-device-addr peripheral property
Date: Tue, 28 Jul 2026 22:05:44 +0100 [thread overview]
Message-ID: <20260728220544.5c65bc50@jic23-huawei> (raw)
In-Reply-To: <e1f977a8-ab38-4dc6-a82b-b955545550a0@baylibre.com>
On Tue, 28 Jul 2026 13:39:20 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On 7/28/26 11:10 AM, Conor Dooley wrote:
> > On Sat, Jul 25, 2026 at 11:04:45PM +0100, Jonathan Cameron wrote:
> >> On Sat, 25 Jul 2026 15:55:01 -0500
> >> David Lechner <dlechner@baylibre.com> wrote:
> >>
> >>> On 7/22/26 2:54 AM, Janani Sunil wrote:
> >>>> Some SPI devices support sharing a single chip select across multiple
> >>>> physical chips by encoding a device address in the SPI frame itself.
> >>>> Add the generic spi-device-addr property for describing these hardware
> >>>> addresses. The property is placed on the SPI peripheral node and may
> >>>> contain multiple addresses.
> >>>>
> >>>> Signed-off-by: Janani Sunil <janani.sunil@analog.com>
> >>>> ---
> >>>> Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml | 7 +++++++
> >>>> 1 file changed, 7 insertions(+)
> >>>>
> >>>> diff --git a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
> >>>> index 880a9f624566..b59d047cf117 100644
> >>>> --- a/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
> >>>> +++ b/Documentation/devicetree/bindings/spi/spi-peripheral-props.yaml
> >>>> @@ -142,6 +142,13 @@ properties:
> >>>> minItems: 2
> >>>> maxItems: 4
> >>>>
> >>>> + spi-device-addr:
> >>>> + $ref: /schemas/types.yaml#/definitions/uint32-array
> >>>> + description:
> >>>> + Device addresses used when multiple peripherals share a single chip
> >>>> + select. The array allows one logical peripheral to comprise multiple
> >>>> + physical devices, with one address per device.
> >>>
> >>> "per physical device" for clarity.
> >>>
> >>
> >> We may end up relaxing that again if multichip packages start doing this.
> >> Fine to add that clarification for now. We can revisit when / if it ever
> >> needs that relaxing.
> >>
> >>>> +
> >>>> st,spi-midi-ns:
> >>>> deprecated: true
> >>>> description: |
> >>>>
> >>>
> >>> If there is nothing useful the SPI core code can do with this information,
> >>> I'm not entirely convinced that this needs to be a common property.
> >>
> >> I think being common does make some sense from a standarization point of
> >> view and it isn't obvious where to put it other than under spi.
> >>
> >>>
> >>> And this only allows for one logical device. If we wanted to treat each
> >>> address as a logical device (all with same CS), we would need #address-cells = <2>;
> >>> instead where the DT "address" is two values, the CS and the device address.
> >>
> >> Ah. Good point for the adc@address or similar needing to match a combination
> >> of CS and spi-device-addr. Conor any thoughts on how this would be done?
> >
> > I'm sorry, I don't quite understand. Why do you want to support both of
> > these representations? Hardware wise both of these things would be
> > describing the same setup, so allowing this alternate "multiple logical
> > device" typically is not permitted. What even is the use case of it?
The microchip parts. They are entirely independent. The device address is
just a way to save pins. That is contrasting those with the one in this
series where the design assumes you want to treat them as a large logical
device in a similar way to spi device chaining.
> > Does it matter at all if you have one or more logical devices from a
> > consumer perspective?
> >
> > I do have an idea of how to solve the adc@address problem (you can do
> > adc@address,spi-device-address like some other devices) but as I said I
> > don't get why it would be needed.
I think we should often do this because there are some confusing cases
otherwise. See below.
>
> I would expect that if such a device was intended to be used as individual
> logical devices that they would just be wired up each with their own chip
> select rather than sharing one.
>
> The only reason I can think of actually needing adc@address,spi-device-address
> would be on a system that was really short on pins on the MCU.
>
> So not saying that we need it right now. Just wanted to make sure we were
> intentional about saying we don't need it if we don't.
To enumerate the cases:
1. One CS has multiple spi-device-address and needs to be a combined device.
Given this ADC does some fun stuff to include messages with no
spi-device-address that are meant to be received by all such
devices we pretty much have to map any that share a CS to one
logical device - we have to bind one driver. This is kind of
similar to SPI device chaining.
address == cs. spi-device-address property not used for that.
- This one can be normal SPI style.
2. One CS has multiple spi-device-address but logically separate otherwise.
This is the microchip devices I think. For those the device-address
is just a pin saving exercise.
address == spi-device-address. CS not needed as there is only one.
2b. Same as 2, but there is another normal ADC with a chip select.
How do we know adc@spi-device-address vs adc@cs given they could
easily take same address value by coincidence?
2c. Basically Case as 2 but * N CS all on same SPI bus.
As David calls out this is the pin count minimization case.
E.g. I want 8 devices each of which has 2 pin straps to set the
device address. So I have to use at least 2 CS.
For this I need both cs and device-address and Conor's suggestion works.
There is a case of 1 + 2 with different device types but result is same
as 2c.
Now, to me the question is whether we say that if spi-device-address is
present you always do adc@cs,spi-device-address or do we allow for not
doing so for the composite devices where nothing else is sharing the CS
(like this driver).
My inclination is standardize on always doing it for these devices.
Jonathan
>
>
next prev parent reply other threads:[~2026-07-28 21:05 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 7:54 [PATCH v7 0/7] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-22 7:54 ` [PATCH v7 1/7] spi: dt-bindings: Add spi-device-addr peripheral property Janani Sunil
2026-07-22 16:39 ` Conor Dooley
2026-07-23 5:48 ` Marcus Folkesson
2026-07-24 23:32 ` Jonathan Cameron
2026-07-25 20:55 ` David Lechner
2026-07-25 22:04 ` Jonathan Cameron
2026-07-28 16:10 ` Conor Dooley
2026-07-28 17:06 ` Nuno Sá
2026-07-28 17:17 ` Conor Dooley
2026-07-28 18:39 ` David Lechner
2026-07-28 21:05 ` Jonathan Cameron [this message]
2026-07-28 21:46 ` David Lechner
2026-07-28 16:55 ` Nuno Sá
2026-07-22 7:54 ` [PATCH v7 2/7] dt-bindings: iio: adc: microchip,mcp3564: Add spi-device-addr Janani Sunil
2026-07-22 16:40 ` Conor Dooley
2026-07-25 20:57 ` David Lechner
2026-07-25 22:07 ` Jonathan Cameron
2026-07-28 16:00 ` Conor Dooley
2026-07-28 21:17 ` Jonathan Cameron
2026-07-22 7:54 ` [PATCH v7 3/7] iio: adc: mcp3564: Add support for spi-device-addr Janani Sunil
2026-07-22 16:45 ` Conor Dooley
2026-07-22 17:02 ` Marius.Cristea
2026-07-22 17:12 ` Conor Dooley
2026-07-22 17:06 ` Marius.Cristea
2026-07-22 7:54 ` [PATCH v7 4/7] dt-bindings: iio: adc: microchip,mcp3911: Add spi-device-addr Janani Sunil
2026-07-22 16:41 ` Conor Dooley
2026-07-23 5:46 ` Marcus Folkesson
2026-07-22 7:54 ` [PATCH v7 5/7] iio: adc: mcp3911: Add support for spi-device-addr Janani Sunil
2026-07-22 16:41 ` Conor Dooley
2026-07-22 16:43 ` Conor Dooley
2026-07-22 17:18 ` Marius.Cristea
2026-07-22 17:19 ` Marius.Cristea
2026-07-23 5:44 ` Marcus Folkesson
2026-07-22 7:54 ` [PATCH v7 6/7] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-22 16:39 ` Conor Dooley
2026-07-25 20:38 ` David Lechner
2026-07-22 7:54 ` [PATCH v7 7/7] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-07-24 23:57 ` Jonathan Cameron
2026-07-25 21:24 ` David Lechner
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=20260728220544.5c65bc50@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=conor@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jan.sun97@gmail.com \
--cc=janani.sunil@analog.com \
--cc=kent@minoris.se \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marcus.folkesson@gmail.com \
--cc=marius.cristea@microchip.com \
--cc=nedo80@gmail.com \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.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