Title: [8867] trunk/drivers/mtd/nand/bf5xx_nand.c: bfin-nand: add waiting for WR_DONE to fix dma page writing flow
Revision
8867
Author
bhsong
Date
2010-06-01 04:18:03 -0400 (Tue, 01 Jun 2010)

Log Message

bfin-nand: add waiting for WR_DONE to fix dma page writing flow

When the DMA generates an interrupt on completion, the WR_DONE
bit should be checked to verify the last transfer is complete, then
the core reads the ECC register values and writes those values to
the spare bytes of the page.

Modified Paths

Diff

Modified: trunk/drivers/mtd/nand/bf5xx_nand.c (8866 => 8867)


--- trunk/drivers/mtd/nand/bf5xx_nand.c	2010-06-01 06:58:42 UTC (rev 8866)
+++ trunk/drivers/mtd/nand/bf5xx_nand.c	2010-06-01 08:18:03 UTC (rev 8867)
@@ -539,11 +539,20 @@
 	enable_dma(CH_NFC);
 
 	/* Start PAGE read/write operation */
-	if (is_read)
+	if (is_read) {
 		bfin_write_NFC_PGCTL(PG_RD_START);
-	else
+		wait_for_completion(&info->dma_completion);
+	} else {
 		bfin_write_NFC_PGCTL(PG_WR_START);
-	wait_for_completion(&info->dma_completion);
+		wait_for_completion(&info->dma_completion);
+		/*
+		 * When the DMA generates an interrupt on completion, the WR_DONE
+		 * bit should be checked to verify the last transfer is complete
+		 */
+		while ((bfin_read_NFC_IRQSTAT() & WR_DONE) != WR_DONE)
+			cpu_relax();
+		bfin_write_NFC_IRQSTAT(WR_DONE);
+	}
 }
 
 static void bf5xx_nand_dma_read_buf(struct mtd_info *mtd,
_______________________________________________
Linux-kernel-commits mailing list
[email protected]
https://blackfin.uclinux.org/mailman/listinfo/linux-kernel-commits

Reply via email to