From: Hannu Koivisto <hannu.koivisto@xxxxxxxxx> Writing to SDMA_H_STATSTOP doesn't necessarily stop anything immediately - it just affects the next channel determination (and even that with a small delay) but the current channel may stay active. That is a problem because at least sdma_free_chan_resources() assumes that no interrupts are triggered after sdma_disable_channel() returns so that SDMA_H_INTR has a bit on for the disabled channel. And it's not just interrupts (and consequent access to freed memory on the ARM side) that are a problem - it can't be good if the SDMA script continues to access memory that is freed in sdma_free_chan_resources(). We solve the problem by forcing a reschedule after writing to SDMA_H_STATSTOP. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@xxxxxxxxxxxxxxx> --- drivers/dma/imx-sdma.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index 0f6fd42..52651ae 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -79,6 +79,9 @@ #define SDMA_CHNENBL0_IMX31 0x080 #define SDMA_CHNPRI_0 0x100 +/* Reset register bits */ +#define SDMA_H_RESET_RESCHED BIT(1) + /* * Buffer descriptor status values. */ @@ -906,6 +909,7 @@ static int sdma_disable_channel(struct dma_chan *chan) int channel = sdmac->channel; writel_relaxed(BIT(channel), sdma->regs + SDMA_H_STATSTOP); + writel(SDMA_H_RESET_RESCHED, sdma->regs + SDMA_H_RESET); sdmac->status = DMA_ERROR; return 0; -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe dmaengine" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html