mtd: OneNAND: Fix loop hang when DMA error at Samsung SoCs

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Sep 13 04:59:02 EDT 2010


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=53d1e137d5ddd8a1c5ec54c5375cb2832e1cbcd1
Commit:     53d1e137d5ddd8a1c5ec54c5375cb2832e1cbcd1
Parent:     9aba97ad004ed0cde9747a9daf5b1484edb746cd
Author:     Kyungmin Park <kyungmin.park at samsung.com>
AuthorDate: Fri Aug 27 11:55:37 2010 +0900
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Mon Sep 13 08:49:45 2010 +0100

    mtd: OneNAND: Fix loop hang when DMA error at Samsung SoCs
    
    When DMA error occurs. it's loop hang since it can't exit the loop.
    and it's the right DMA handling code as Spec.
    
    Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/onenand/samsung.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 094dfcb..a460f1b 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
 
 	do {
 		status = readl(base + S5PC110_DMA_TRANS_STATUS);
+		if (status & S5PC110_DMA_TRANS_STATUS_TE) {
+			writel(S5PC110_DMA_TRANS_CMD_TEC,
+					base + S5PC110_DMA_TRANS_CMD);
+			return -EIO;
+		}
 	} while (!(status & S5PC110_DMA_TRANS_STATUS_TD));
 
-	if (status & S5PC110_DMA_TRANS_STATUS_TE) {
-		writel(S5PC110_DMA_TRANS_CMD_TEC, base + S5PC110_DMA_TRANS_CMD);
-		writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
-		return -EIO;
-	}
-
 	writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
 
 	return 0;



More information about the linux-mtd-cvs mailing list