dmaengine: stm32-dma: fix residue calculation in stm32-dma
authorArnaud Pouliquen <arnaud.pouliquen@st.com>
Thu, 2 May 2019 09:28:42 +0000 (11:28 +0200)
committerVinod Koul <vkoul@kernel.org>
Sat, 4 May 2019 10:16:58 +0000 (15:46 +0530)
commit2a4885abf5fbc2dde4be91a11b00cbce2c923f47
tree2e2522bcea427a249000ea93600d6a38a7c37170
parent66c30aa679172df624cd68b0e1cfe757f6d1bc72
dmaengine: stm32-dma: fix residue calculation in stm32-dma

In double buffer mode, during residue calculation, the DMA can
automatically switch to the next transfer. Indeed the CT bit that
gives position in the double buffer can has been updated by the
hardware, during calculation.
In this case the SxNDTR register value can not be trusted.
If a transition is detected we consider that the DMA has switched to
the beginning of next sg.

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/dma/stm32-dma.c