spi: stm32: use STM32 DMA with STM32 MDMA to enhance DDR use
authorClément Le Goffic <clement.legoffic@foss.st.com>
Mon, 16 Jun 2025 09:21:05 +0000 (11:21 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 24 Jun 2025 15:43:00 +0000 (16:43 +0100)
commitd17dd2f1d8a1d919e39c6302b024f135a2f90773
treec2a3261242713250316a1774df3f2e3d595b6dc0
parent21f1c800f6620e43f31dfd76709dbac8ebaa5a16
spi: stm32: use STM32 DMA with STM32 MDMA to enhance DDR use

The STM32 DMA doesn't have the ability to generate convenient burst
transfer on the DDR, ensuring the best load of the AXI & DDR.
To avoid this bad load of the AXI & DDR, STM32 MDMA can be used to transfer
data to the DDR, being triggered by STM32 DMA channel transfer
completion.
An SRAM buffer is used between DMA and MDMA. So the MDMA always does
MEM_TO_MEM transfers (from/to SRAM to/from DDR), and the DMA uses SRAM
instead of DDR with DEV_TO_MEM transfers.
SPI RX DMA (DEV_TO_MEM) becomes:
SPI RX FIFO ==DMA==> SRAM ==MDMA==> DDR

In RX (DEV_TO_MEM), EOT interrupt is used to pause the DMA channel (which
will raise a transfer complete) to trigger the MDMA to flush the SRAM (when
transfer length is not aligned on SRAM period).
TX remains on the former implementation.

Signed-off-by: Clément Le Goffic <clement.legoffic@foss.st.com>
Link: https://patch.msgid.link/20250616-spi-upstream-v1-4-7e8593f3f75d@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-stm32.c