From 7917c2e356042505c7dea469c358f07b6e424fa2 Mon Sep 17 00:00:00 2001 From: Tomas Alvarez Vanoli Date: Tue, 24 Mar 2026 18:02:12 +0100 Subject: [PATCH] spi: fsl_espi: fix din offset In the case of SPI_XFER_BEGIN | SPI_XFER_END, the function creates a buffer of double the size of the transaction, so that it can write the data in into the second half. It sets the rx_offset to len, and in the while loop we are setting an internal "din" to buffer + rx_offset. However, at the end of each loop, the driver copies "buffer + 2 * cmd_len" back to the data_in pointer. This commit changes the source of the data to buffer + rx_offset. Signed-off-by: Tomas Alvarez Vanoli --- drivers/spi/fsl_espi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7ed35aa3e66..117e36376b7 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -275,7 +275,7 @@ int espi_xfer(struct fsl_spi_slave *fsl, uint cs, unsigned int bitlen, } } if (data_in) { - memcpy(data_in, buffer + 2 * cmd_len, tran_len); + memcpy(data_in, buffer + rx_offset, tran_len); if (*buffer == 0x0b) { data_in += tran_len; data_len -= tran_len; -- 2.47.3