From c9be3dd387a2d24494198206af16a404ed37e056 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Wed, 23 May 2018 20:29:20 -0600 Subject: [PATCH] arch/arm/src/imxrt/imxrt_edma.c: Fix some issues with adding a new TCD to the end of a scatter/gather chain: Was not correctly writing back the new tail pointer; Need to flush the previous TCD in the chain whose fields were modify to link to the new TCD. --- arch/arm/src/imxrt/imxrt_edma.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm/src/imxrt/imxrt_edma.c b/arch/arm/src/imxrt/imxrt_edma.c index 883fa68d6c..af174588c9 100644 --- a/arch/arm/src/imxrt/imxrt_edma.c +++ b/arch/arm/src/imxrt/imxrt_edma.c @@ -518,7 +518,7 @@ static void imxrt_dmaterminate(struct imxrt_dmach_s *dmach, int result) regaddr = IMXRT_EDMA_TCD_CSR(chan); putreg16(0, regaddr); - /* Cancel all next TCD transfer. */ + /* Cancel next TCD transfer. */ regaddr = IMXRT_EDMA_TCD_DLASTSGA(chan); putreg16(0, regaddr); @@ -1101,6 +1101,11 @@ int imxrt_dmach_xfrsetup(DMACH_HANDLE *handle, prev->csr = regval16; prev->dlastsga = (uint32_t)tcd; + dmach->tail = tcd; + + /* Clean cache associated with the previous TCD memory */ + + arch_clean_dcache(prev, sizeof(struct imxrt_edmatcd_s)); /* Check if the TCD block in the DMA channel registers is the same as * the previous previous TCD. This can happen if the previous TCD was