[PATCH 09/10] spi: cadence-xspi: Advance tx pointer between Marvell b0 chunks

From: Lee Jones

Date: Thu Nov 19 2026 - 04:22:04 EST


cdns_xspi_transfer_one_message_b0() splits transfers which are larger
than MRVL_XFER_MAX_LEN into chunks, but never advances txd between
them. For every chunk after the first, the leading byte is sent from
txd[0] again, and a short trailing chunk retransmits the start of the
buffer instead of its tail. The out_buffer pointer used for the rest
of each chunk is advanced correctly, so the data on the bus ends up
inconsistent.

Advance txd by the size of each chunk when the transfer carries TX data.
TX-less transfers continue to use the zeroed scratch buffer, which is
only ever as large as a single chunk.

Fixes: 931e389ded0f ("spi: cadence: Add Marvell xfer operation support")
Closes: https://sashiko.dev/#/bug/linux-e2ba3b72-ead8-4562-bdb2-4992253c59b4
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Lee Jones <lee@xxxxxxxxxx>
---
drivers/spi/spi-cadence-xspi.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-cadence-xspi.c b/drivers/spi/spi-cadence-xspi.c
index c4fcbf5ae091..4c9af6146a5d 100644
--- a/drivers/spi/spi-cadence-xspi.c
+++ b/drivers/spi/spi-cadence-xspi.c
@@ -1319,6 +1319,8 @@ static int cdns_xspi_transfer_one_message_b0(struct spi_controller *controller,
cdns_xspi->current_xfer_qword %= MRVL_XFER_QWORD_COUNT;
}
cs_change = t->cs_change;
+ if (t->tx_buf)
+ txd += current_transfer_len;
t->len -= current_transfer_len;
}
spi_transfer_delay_exec(t);
--
2.56.1.708.g77570a6a1d-goog