linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fsldma: snooping is not enabled for last entry in descriptor chain
@ 2009-05-15 18:33 Ira Snyder
  0 siblings, 0 replies; only message in thread
From: Ira Snyder @ 2009-05-15 18:33 UTC (permalink / raw)
  To: Dan Williams, Li Yang, linuxppc-dev

On the 83xx controller, snooping is necessary for the DMA controller to
ensure cache coherence with the CPU when transferring to/from RAM.

The last descriptor in a chain will always have the End-of-Chain interrupt
bit set, so we can set the snoop bit while adding the End-of-Chain
interrupt bit.

Signed-off-by: Ira W. Snyder <iws@ovro.caltech.edu>
---

While working on adding the DMA_SLAVE feature, I noticed that the last
descriptor in a chain does not have the snoop bits enabled.

This is easily verified by doing the following:
1) set FSL_DMA_BCR_MAX_CNT = (1 << 18)
2) #define DEBUG 1
3) #define FSL_DMA_LD_DEBUG 1
4) setup a 1MB memcpy operation

The memcpy must be set up on an idle channel, and must be submitted
without any other transactions. dma_async_memcpy_issue_pending() must be
called without queueing any more transactions. You will see that the
snoop bit (bit 4) is not set in the last descriptor.

 drivers/dma/fsldma.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 4264c98..dba0b58 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -179,9 +179,14 @@ static void dma_halt(struct fsl_dma_chan *fsl_chan)
 static void set_ld_eol(struct fsl_dma_chan *fsl_chan,
 			struct fsl_desc_sw *desc)
 {
+	u64 snoop_bits;
+
+	snoop_bits = ((fsl_chan->feature & FSL_DMA_IP_MASK) == FSL_DMA_IP_83XX)
+		? FSL_DMA_SNEN : 0;
+
 	desc->hw.next_ln_addr = CPU_TO_DMA(fsl_chan,
-		DMA_TO_CPU(fsl_chan, desc->hw.next_ln_addr, 64)	| FSL_DMA_EOL,
-		64);
+		DMA_TO_CPU(fsl_chan, desc->hw.next_ln_addr, 64) | FSL_DMA_EOL
+			| snoop_bits, 64);
 }
 
 static void append_ld_queue(struct fsl_dma_chan *fsl_chan,
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-15 18:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 18:33 [PATCH] fsldma: snooping is not enabled for last entry in descriptor chain Ira Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).