Title: [6903] trunk/arch/blackfin/kernel/bfin_dma_5xx.c: early_dma_memcpy: tweak config checking pointed out by Yi, and simplify/fix config resetting once we do have an available channel that was previously used
Revision
6903
Author
vapier
Date
2009-07-01 13:48:03 -0500 (Wed, 01 Jul 2009)

Log Message

early_dma_memcpy: tweak config checking pointed out by Yi, and simplify/fix config resetting once we do have an available channel that was previously used

Modified Paths

Diff

Modified: trunk/arch/blackfin/kernel/bfin_dma_5xx.c (6902 => 6903)


--- trunk/arch/blackfin/kernel/bfin_dma_5xx.c	2009-07-01 16:11:38 UTC (rev 6902)
+++ trunk/arch/blackfin/kernel/bfin_dma_5xx.c	2009-07-01 18:48:03 UTC (rev 6903)
@@ -253,32 +253,31 @@
 	BUG_ON(src % 4);
 	BUG_ON(size % 4);
 
-	/* Force a sync in case a previous config reset on this channel
-	 * occurred.  This is needed so subsequent writes to DMA registers
-	 * are not spuriously lost/corrupted.
-	 */
-	__builtin_bfin_ssync();
-
 	src_ch = 0;
 	/* Find an avalible memDMA channel */
 	while (1) {
-		if (!src_ch || src_ch == (struct dma_register *)MDMA_S1_NEXT_DESC_PTR) {
-			dst_ch = (struct dma_register *)MDMA_D0_NEXT_DESC_PTR;
-			src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR;
-		} else {
+		if (src_ch == (struct dma_register *)MDMA_S0_NEXT_DESC_PTR) {
 			dst_ch = (struct dma_register *)MDMA_D1_NEXT_DESC_PTR;
 			src_ch = (struct dma_register *)MDMA_S1_NEXT_DESC_PTR;
+		} else {
+			dst_ch = (struct dma_register *)MDMA_D0_NEXT_DESC_PTR;
+			src_ch = (struct dma_register *)MDMA_S0_NEXT_DESC_PTR;
 		}
 
-		if (!bfin_read16(&dst_ch->cfg)) {
+		if (!bfin_read16(&src_ch->cfg))
 			break;
-		} else {
-			if (bfin_read16(&dst_ch->irq_status) & DMA_DONE)
-				bfin_write16(&dst_ch->cfg, 0);
+		else if (bfin_read16(&dst_ch->irq_status) & DMA_DONE) {
+			bfin_write16(&src_ch->cfg, 0);
+			break;
 		}
-
 	}
 
+	/* Force a sync in case a previous config reset on this channel
+	 * occurred.  This is needed so subsequent writes to DMA registers
+	 * are not spuriously lost/corrupted.
+	 */
+	__builtin_bfin_ssync();
+
 	/* Destination */
 	bfin_write32(&dst_ch->start_addr, dst);
 	bfin_write16(&dst_ch->x_count, size >> 2);
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to