From: Sonic Zhang Date: Mon, 1 Jun 2009 04:49:32 +0000 (-0400) Subject: Blackfin: add SSYNC to set_dma_sg() for descriptor fetching X-Git-Tag: firefly_0821_release~13951^2~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ea8538a039607cd959d28ed10086484e051ce7db;p=firefly-linux-kernel-4.4.55.git Blackfin: add SSYNC to set_dma_sg() for descriptor fetching Make sure the internal core buffers are flushed before telling the DMA engine to fetch the descriptor structure so that it gets the right values. Signed-off-by: Sonic Zhang Signed-off-by: Mike Frysinger --- diff --git a/arch/blackfin/include/asm/dma.h b/arch/blackfin/include/asm/dma.h index 46c56185417a..c9a59622e23f 100644 --- a/arch/blackfin/include/asm/dma.h +++ b/arch/blackfin/include/asm/dma.h @@ -206,10 +206,16 @@ static inline unsigned long get_dma_curr_addr(unsigned int channel) static inline void set_dma_sg(unsigned int channel, struct dmasg *sg, int ndsize) { + /* Make sure the internal data buffers in the core are drained + * so that the DMA descriptors are completely written when the + * DMA engine goes to fetch them below. + */ + SSYNC(); + + dma_ch[channel].regs->next_desc_ptr = sg; dma_ch[channel].regs->cfg = (dma_ch[channel].regs->cfg & ~(0xf << 8)) | ((ndsize & 0xf) << 8); - dma_ch[channel].regs->next_desc_ptr = sg; } static inline int dma_channel_active(unsigned int channel)