mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Santos <Jonathan.Santos@analog.com>
To: <linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Jonathan Santos <Jonathan.Santos@analog.com>,
	<dlechner@baylibre.com>, <nuno.sa@analog.com>,
	<michael.hennerich@analog.com>, <broonie@kernel.org>,
	<jonath4nns@gmail.com>, <marcelo.schmitt1@gmail.com>,
	<andy@kernel.org>
Subject: [PATCH 5/6] spi: add rx and tx lane mask to spi_transfer struct
Date: Tue, 14 Jul 2026 02:56:46 -0300	[thread overview]
Message-ID: <a0b2db6f6e436dc0413e61335b2d1e2ec2f6f018.1783729282.git.Jonathan.Santos@analog.com> (raw)
In-Reply-To: <cover.1783729282.git.Jonathan.Santos@analog.com>

In SPI_MULTI_LANE_MODE_STRIPE mode, a transfer currently activates all
available lanes, but some use cases require operating over a subset of
lanes per transfer.

Enable dynamic lane selection for tx and rx by adding new fields to the
spi_transfer struct. Controllers that support multi-lane selection must
parse the transfer struct to update the rx and tx mask lane-wise.

Peripherals need to set values to the new fields only if multi_lane_mode
is set to SPI_MULTI_LANE_MODE_STRIPE and they need to enable at least one
lane, not necessary for enabling all lanes.

Signed-off-by: Jonathan Santos <Jonathan.Santos@analog.com>
---
 include/linux/spi/spi.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index a9988db3fe2f..f4473d53b6b5 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -986,6 +986,12 @@ struct spi_res {
  *      (SPI_NBITS_SINGLE) is used.
  * @multi_lane_mode: How to serialize data on multiple lanes. One of the
  *      SPI_MULTI_LANE_MODE_* values.
+ * @rx_lane_mask: Bitmask of lanes to use for receive in
+ *      SPI_MULTI_LANE_MODE_STRIPE mode. Each set bit enables the corresponding
+ *      lane. If 0 all available lanes are used.
+ * @tx_lane_mask: Bitmask of lanes to use for transmit in
+ *      SPI_MULTI_LANE_MODE_STRIPE mode. Each set bit enables the corresponding
+ *      lane. If 0 all available lanes are used.
  * @len: size of rx and tx buffers (in bytes)
  * @speed_hz: Select a speed other than the device default for this
  *      transfer. If 0 the default (from @spi_device) is used.
@@ -1131,6 +1137,8 @@ struct spi_transfer {
 #define SPI_MULTI_LANE_MODE_STRIPE	1 /* one data word per lane */
 #define SPI_MULTI_LANE_MODE_MIRROR	2 /* same word sent on all lanes */
 	unsigned	multi_lane_mode: 2;
+	unsigned	rx_lane_mask: 8;
+	unsigned	tx_lane_mask: 8;
 
 	unsigned	timestamped:1;
 	bool		dtr_mode;
-- 
2.34.1


  parent reply	other threads:[~2026-07-14  2:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  5:55 [PATCH 0/6] spi: add multi-CS and per-transfer lane mask support Jonathan Santos
2026-07-14  5:55 ` [PATCH 1/6] spi: support simultaneous assertion of multiple CS Jonathan Santos
2026-07-14  9:06   ` Andy Shevchenko
2026-07-14  9:08   ` Nuno Sá
2026-07-14  5:56 ` [PATCH 2/6] spi: add per-transfer CS mask Jonathan Santos
2026-07-14  9:12   ` Nuno Sá
2026-07-14  9:23   ` Andy Shevchenko
2026-07-14  5:56 ` [PATCH 3/6] spi: spi-engine-ex: Add support for multi-CS devices Jonathan Santos
2026-07-14  9:17   ` Andy Shevchenko
2026-07-14  5:56 ` [PATCH 4/6] spi: Documentation: multiple-data-lanes: describe rx and tx lane mask Jonathan Santos
2026-07-14  5:56 ` Jonathan Santos [this message]
2026-07-14  9:22   ` [PATCH 5/6] spi: add rx and tx lane mask to spi_transfer struct Nuno Sá
2026-07-14  9:26   ` Andy Shevchenko
2026-07-14 15:18   ` David Lechner
2026-07-15 10:23     ` Nuno Sá
2026-07-14  5:57 ` [PATCH 6/6] spi: axi-spi-engine: add support for dynamic multi-lane selection Jonathan Santos
2026-07-14 10:29   ` Nuno Sá
2026-07-14  8:57 ` [PATCH 0/6] spi: add multi-CS and per-transfer lane mask support Andy Shevchenko
2026-07-14 14:09   ` David Lechner
2026-07-14 14:26     ` Andy Shevchenko
2026-07-14 14:44       ` David Lechner
2026-07-14 10:29 ` Nuno Sá
2026-07-14 15:02   ` David Lechner
2026-07-16 16:50     ` Jonathan Santos

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=a0b2db6f6e436dc0413e61335b2d1e2ec2f6f018.1783729282.git.Jonathan.Santos@analog.com \
    --to=jonathan.santos@analog.com \
    --cc=andy@kernel.org \
    --cc=broonie@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jonath4nns@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=marcelo.schmitt1@gmail.com \
    --cc=michael.hennerich@analog.com \
    --cc=nuno.sa@analog.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