]> www.infradead.org Git - users/jedix/linux-maple.git/commit
spi: sh-msiof: Fix maximum DMA transfer size
authorGeert Uytterhoeven <geert+renesas@glider.be>
Fri, 16 May 2025 13:32:06 +0000 (15:32 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 19 May 2025 10:55:20 +0000 (11:55 +0100)
commit0941d5166629cb766000530945e54b4e49680c68
tree1c84a0d06815952b7e860c5ec4c71d9c5480c62e
parentee44d3fc9d8b882cbc98acf2d3c773aba971aa67
spi: sh-msiof: Fix maximum DMA transfer size

The maximum amount of data to transfer in a single DMA request is
calculated from the FIFO sizes (which is technically not 100% correct,
but a simplification, as it is limited by the maximum word count values
in the Transmit and Control Data Registers).  However, in case there is
both data to transmit and to receive, the transmit limit is overwritten
by the receive limit.

Fix this by using the minimum applicable FIFO size instead.  Move the
calculation outside the loop, so it is not repeated for each individual
DMA transfer.

As currently tx_fifo_size is always equal to rx_fifo_size, this bug had
no real impact.

Fixes: fe78d0b7691c0274 ("spi: sh-msiof: Fix FIFO size to 64 word from 256 word")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/d9961767a97758b2614f2ee8afe1bd56dc900a60.1747401908.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-sh-msiof.c