diff mbox series

[1/2] dmaengine: stm32-dma: fix stm32_dma_prep_slave_sg in case of MDMA chaining

Message ID 20231004155024.2609531-1-amelie.delaunay@foss.st.com (mailing list archive)
State Accepted
Commit 2df467e908ce463cff1431ca1b00f650f7a514b4
Headers show
Series [1/2] dmaengine: stm32-dma: fix stm32_dma_prep_slave_sg in case of MDMA chaining | expand

Commit Message

Amelie Delaunay Oct. 4, 2023, 3:50 p.m. UTC
Current Target (CT) have to be reset when starting an MDMA chaining use
case, as Double Buffer mode is activated. It ensures the DMA will start
processing the first memory target (pointed with SxM0AR).

Fixes: 723795173ce1 ("dmaengine: stm32-dma: add support to trigger STM32 MDMA")
Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com>
Cc: stable@vger.kernel.org
---
 drivers/dma/stm32-dma.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Vinod Koul Oct. 9, 2023, 6:12 a.m. UTC | #1
On Wed, 04 Oct 2023 17:50:23 +0200, Amelie Delaunay wrote:
> Current Target (CT) have to be reset when starting an MDMA chaining use
> case, as Double Buffer mode is activated. It ensures the DMA will start
> processing the first memory target (pointed with SxM0AR).
> 
> 

Applied, thanks!

[1/2] dmaengine: stm32-dma: fix stm32_dma_prep_slave_sg in case of MDMA chaining
      commit: 2df467e908ce463cff1431ca1b00f650f7a514b4
[2/2] dmaengine: stm32-dma: fix residue in case of MDMA chaining
      commit: 67e13e89742c3b21ce177f612bf9ef32caae6047

Best regards,
diff mbox series

Patch

diff --git a/drivers/dma/stm32-dma.c b/drivers/dma/stm32-dma.c
index 5c36811aa134..7427acc82259 100644
--- a/drivers/dma/stm32-dma.c
+++ b/drivers/dma/stm32-dma.c
@@ -1113,8 +1113,10 @@  static struct dma_async_tx_descriptor *stm32_dma_prep_slave_sg(
 		chan->chan_reg.dma_scr &= ~STM32_DMA_SCR_PFCTRL;
 
 	/* Activate Double Buffer Mode if DMA triggers STM32 MDMA and more than 1 sg */
-	if (chan->trig_mdma && sg_len > 1)
+	if (chan->trig_mdma && sg_len > 1) {
 		chan->chan_reg.dma_scr |= STM32_DMA_SCR_DBM;
+		chan->chan_reg.dma_scr &= ~STM32_DMA_SCR_CT;
+	}
 
 	for_each_sg(sgl, sg, sg_len, i) {
 		ret = stm32_dma_set_xfer_param(chan, direction, &buswidth,