Blackfin: add SSYNC to set_dma_sg() for descriptor fetching
authorSonic Zhang <sonic.zhang@analog.com>
Mon, 1 Jun 2009 04:49:32 +0000 (00:49 -0400)
committerMike Frysinger <vapier@gentoo.org>
Fri, 12 Jun 2009 10:11:57 +0000 (06:11 -0400)
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 <sonic.zhang@analog.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
arch/blackfin/include/asm/dma.h

index 46c56185417a337b92fc7e2e275ab660272d3f41..c9a59622e23f65d490087c64f26921ddaf545313 100644 (file)
@@ -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)