]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
spi: microchip-core: prevent RX overflows when transmit size > FIFO size
authorConor Dooley <conor.dooley@microchip.com>
Mon, 3 Mar 2025 10:47:40 +0000 (10:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 22 Mar 2025 19:54:23 +0000 (12:54 -0700)
commit220e26960ef48632107a7d6bd3f3e974e2f0e546
treee382228e8095bb56fce15de0ff01ec5876c9257b
parent488ffc0cac38f203979f83634236ee53251ce593
spi: microchip-core: prevent RX overflows when transmit size > FIFO size

commit 91cf42c63f2d8a9c1bcdfe923218e079b32e1a69 upstream.

When the size of a transfer exceeds the size of the FIFO (32 bytes), RX
overflows will be generated and receive data will be corrupted and
warnings will be produced. For example, here's an error generated by a
transfer of 36 bytes:

  spi_master spi0: mchp_corespi_interrupt: RX OVERFLOW: rxlen: 4, txlen: 0

The driver is currently split between handling receiving in the
interrupt handler, and sending outside of it. Move all handling out of
the interrupt handling, and explicitly link the number of bytes read of
of the RX FIFO to the number written into the TX one. This both resolves
the overflow problems as well as simplifying the flow of the driver.

CC: stable@vger.kernel.org
Fixes: 9ac8d17694b6 ("spi: add support for microchip fpga spi controllers")
Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20250303-veal-snooper-712c1dfad336@wendy
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/spi/spi-microchip-core.c