]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs
authorAmelie Delaunay <amelie.delaunay@foss.st.com>
Tue, 24 Jun 2025 07:31:37 +0000 (09:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Aug 2025 14:26:00 +0000 (16:26 +0200)
commit9923fde7bf562d4f88b93d1a0f390b22ee630236
treebe9ca4f4dbdf39c996d30c1d96a8d652ceb47530
parent06f6a0b1ba059e0e2b549c3c9a10738fd5475e7a
dmaengine: stm32-dma: configure next sg only if there are more than 2 sgs

[ Upstream commit e19bdbaa31082b43dab1d936e20efcebc30aa73d ]

DMA operates in Double Buffer Mode (DBM) when the transfer is cyclic and
there are at least two periods.
When DBM is enabled, the DMA toggles between two memory targets (SxM0AR and
SxM1AR), indicated by the SxSCR.CT bit (Current Target).
There is no need to update the next memory address if two periods are
configured, as SxM0AR and SxM1AR are already properly set up before the
transfer begins in the stm32_dma_start_transfer() function.
This avoids unnecessary updates to SxM0AR/SxM1AR, thereby preventing
potential Transfer Errors. Specifically, when the channel is enabled,
SxM0AR and SxM1AR can only be written if SxSCR.CT=1 and SxSCR.CT=0,
respectively. Otherwise, a Transfer Error interrupt is triggered, and the
stream is automatically disabled.

Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Link: https://lore.kernel.org/r/20250624-stm32_dma_dbm_fix-v1-1-337c40d6c93e@foss.st.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/stm32-dma.c