[PATCH] spi: tegra114: re-assert CS after a mid-message cs_change

From: Roman Putintsev

Date: Wed Nov 18 2026 - 13:38:16 EST


When a transfer has cs_change set and is not the last one of a message,
tegra_spi_transfer_one_message() ends it with tegra_spi_transfer_end().
That function deasserts CS and stores the deasserted state in
tspi->command1_reg (SPI_CS_SW_VAL). The next transfer is not the first one
of the message, so tegra_spi_setup_transfer_one() reuses command1_reg
unchanged: the controller clocks that transfer out with CS inactive. The
slave never sees the data and no error is reported.

Every driver that splits a message into "write payload, toggle CS, write
trigger" hits this. mcp251xfd does it for every CAN frame, so an MCP2518FD
never transmits: the frame reaches the chip's RAM, but the write that sets
UINC|TXREQ in the TX FIFO control register is lost. Reception uses
single-transfer messages and still works.

Before commit f3e182c33e53 ("spi: tegra114: de-assert CS before SPI mode
change") the deassertion did not touch command1_reg and the next transfer
asserted CS on its own. Mark the following transfer as the first one of a
message again, so that it takes the setup path that asserts CS.

Tested on a reComputer Orin J40 Mini with an MCP2518FD on spi1.0. No frame
was transmitted before this change; with it CAN traffic runs in both
directions with no errors.

Fixes: f3e182c33e53 ("spi: tegra114: de-assert CS before SPI mode change")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Roman Putintsev <roman@xxxxxxxxxxxxx>
---
drivers/spi/spi-tegra114.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c
index f43f2df..d2fda21 100644
--- a/drivers/spi/spi-tegra114.c
+++ b/drivers/spi/spi-tegra114.c
@@ -1116,6 +1116,8 @@ complete_xfer:
} else if (xfer->cs_change) {
tegra_spi_transfer_end(spi);
spi_transfer_delay_exec(xfer);
+ /* CS was deasserted, assert it for the next transfer */
+ is_first_msg = true;
}

}

base-commit: 20eef29b7c8465ac98d7dd6d6f2ac07a8d8056ca