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 <tomas.alvarez-vanoli@hitachienergy.com>
This commit is contained in:
Tomas Alvarez Vanoli
2026-03-24 18:02:12 +01:00
committed by Fabio Estevam
parent c42db5019d
commit 7917c2e356

View File

@@ -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;