Skip to contentSkip to conversation

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

PATCH In review Kyungmin Park 2 participants 3 messages Aug 27, 2010 – Aug 30, 2010 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs

From: Kyungmin Park <[email protected]>

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.

---
 drivers/mtd/onenand/samsung.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/mtd/onenand/samsung.c +5 -6
index 05329ba..69e48d0 100644
@@ -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;
Signature · 1 line
1.5.3.3
#1 lore raw
Quoted 22 lines · Kyungmin Park

From: Kyungmin Park <[email protected]>

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.

---
 drivers/mtd/onenand/samsung.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/mtd/onenand/samsung.c +4 -0
index 05329ba..69e48d0 100644
@@ -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;

drivers/mtd/onenand/samsung.c static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction) · line 564

Quoted 10 lines
drivers/mtd/onenand/samsung.c +1 -6
+		}
 	} 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);

You shoule also add timeout to the loop. Forever loops are bad. Please, while you are on it, fix the forever loop by doing something like this:
http://patchwork.ozlabs.org/patch/59180/
I mean, add timeout please.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
#2 lore raw
Quoted 26 lines · Artem Bityutskiy
Quoted 25 lines · Kyungmin Park

From: Kyungmin Park <[email protected]>

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.

---
 drivers/mtd/onenand/samsung.c |   11 +++++------

 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/mtd/onenand/samsung.c +5 -0
index 05329ba..69e48d0 100644
@@ -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));
 
Quoted 12 lines

drivers/mtd/onenand/samsung.c static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction) · line 564

Quoted 7 lines
drivers/mtd/onenand/samsung.c +0 -6
-     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);

You shoule also add timeout to the loop. Forever loops are bad. Please, while you are on it, fix the forever loop by doing something like this:
http://patchwork.ozlabs.org/patch/59180/
I mean, add timeout please.

No problem, I will update this patch tomorrow.

Thank you,
Kyungmin Park

Quoted 10 lines

--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/