]> git.ipfire.org Git - thirdparty/u-boot.git/commit
spi: fsl_espi: fix read transactions
authorMichael Walle <mwalle@kernel.org>
Wed, 6 May 2026 12:34:12 +0000 (14:34 +0200)
committerPeng Fan <peng.fan@nxp.com>
Fri, 15 May 2026 11:28:30 +0000 (19:28 +0800)
commitcae1cfe2ca0ef61d237d13ebaf82851915ea9996
tree57bc95ea056855b12afd4109e502d7783bbd5887
parent09bc47cc337522b4b8fe8ed037676d1601547f91
spi: fsl_espi: fix read transactions

Since commit 7917c2e35604 ("spi: fsl_espi: fix din offset") MTD is
basically broken because any read transaction will get wrong data. While
the commit in question will fix simple transfers (where both
SPI_XFER_BEGIN and SPI_XFER_END is set), it will break the most common
case, where opcode and address is send first and then data comes as a
second transfer.

This basically reverts commit 7917c2e35604 ("spi: fsl_espi: fix din
offset") and make the fix particular for this simple case. Instead of
providing two buffers for reading and writing, just malloc one which is
used for both. This will work because the data is first written on the
SPI bus and then it will be read (and overwite the written data) into
the same buffer.

Suggested-by: Tomas Alvarez Vanoli <tomas.alvarez-vanoli@hitachienergy.com>
Fixes: 7917c2e35604 ("spi: fsl_espi: fix din offset")
Signed-off-by: Michael Walle <mwalle@kernel.org>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/spi/fsl_espi.c