MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs
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
@@ -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
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.
Signed-off-by Kyungmin Park <[email protected]>--- drivers/mtd/onenand/samsung.c | 11 +++++------ 1 files changed, 5 insertions(+), 6 deletions(-)drivers/mtd/onenand/samsung.c +4
-0@@ -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 (Битюцкий Артём)
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.
Signed-off-by Kyungmin Park <[email protected]>---
drivers/mtd/onenand/samsung.c | 11 +++++------1 files changed, 5 insertions(+), 6 deletions(-)drivers/mtd/onenand/samsung.c +5
-0@@ -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/