[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPACRllAorjG47L7@debian-BULLSEYE-live-builder-AMD64>
Date: Wed, 15 Oct 2025 17:21:26 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: David Lechner <dlechner@...libre.com>
Cc: Mark Brown <broonie@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Marcelo Schmitt <marcelo.schmitt@...log.com>,
Michael Hennerich <michael.hennerich@...log.com>,
Nuno Sá <nuno.sa@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Andy Shevchenko <andy@...nel.org>,
Sean Anderson <sean.anderson@...ux.dev>, linux-spi@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-iio@...r.kernel.org
Subject: Re: [PATCH 3/6] spi: add multi_bus_mode field to struct spi_transfer
On 10/14, David Lechner wrote:
> Add a new multi_bus_mode field to struct spi_transfer to allow
> peripherals that support multiple SPI buses to be used with a single
> SPI controller.
>
> This requires both the peripheral and the controller to have multiple
> serializers connected to separate data buses. It could also be used with
> a single controller and multiple peripherals that are functioning as a
> single logical device (similar to parallel memories).
>
> The possible values for this field have the following semantics:
>
> - SPI_MULTI_BUS_MODE_SINGLE: Only use the first bus. This means that it
> it is operating just like a conventional SPI bus. It is the default
> value so that existing drivers do not need to be modified.
>
> Example:
> tx_buf[0] = 0x88;
>
> struct spi_transfer xfer = {
> .tx_buf = tx_buf,
> .len = 1,
> };
>
> spi_sync_transfer(spi, &xfer, 1);
>
> controller > data bits > peripheral
> ---------- ---------------- ----------
> SDO 0 0-0-0-1-0-0-0-1 SDI 0
>
> - SPI_MULTI_BUS_MODE_MIRROR: Send a single data word over all of the
> buses at the same time. This only makes sense for writes and not
> for reads.
>
> Example:
> tx_buf[0] = 0x88;
>
> struct spi_transfer xfer = {
> .tx_buf = tx_buf,
> .len = 1,
> .multi_bus_mode = SPI_MULTI_BUS_MODE_MIRROR,
> };
>
> spi_sync_transfer(spi, &xfer, 1);
>
> controller > data bits > peripheral
> ---------- ---------------- ----------
> SDO 0 0-0-0-1-0-0-0-1 SDI 0
> SDO 1 0-0-0-1-0-0-0-1 SDI 1
>
> - SPI_MULTI_BUS_MODE_STRIPE: Send or receive two different data words at
> the same time, one on each bus.
>
> Example:
> struct spi_transfer xfer = {
> .rx_buf = rx_buf,
> .len = 2, /* must be multiple of number of buses */
> .multi_bus_mode = SPI_MULTI_BUS_MODE_STRIPE,
> };
>
> spi_sync_transfer(spi, &xfer, 1);
>
> controller < data bits < peripheral
> ---------- ---------------- ----------
> SDI 0 0-0-0-1-0-0-0-1 SDO 0
> SDI 1 1-0-0-0-1-0-0-0 SDO 1
>
> After the transfer, rx_buf[0] == 0x11 (word from SDO 0) and
> rx_buf[1] == 0x88 (word from SDO 1). If the transfer was longer,
> the data would continue in an alternating fashion.
>
Can the above explanation be added to the documentation?
Maybe spi-summary.rst or a new file?
> Signed-off-by: David Lechner <dlechner@...libre.com>
> ---
Nevertheless,
Acked-by: Marcelo Schmitt <marcelo.schmitt@...log.com>
Powered by blists - more mailing lists