* [PATCH v2] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs
@ 2010-08-30 23:48 Kyungmin Park
2010-08-31 23:02 ` Artem Bityutskiy
0 siblings, 1 reply; 3+ messages in thread
From: Kyungmin Park @ 2010-08-30 23:48 UTC (permalink / raw)
To: linux-mtd; +Cc: Artem.Bityutskiy, dwmw2
From: Kyungmin Park <kyungmin.park@samsung.com>
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@samsung.com>
---
Changelog v1
Add the timeout as Artem comment
drivers/mtd/onenand/samsung.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index d604629..bdaa228 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -535,6 +535,7 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
{
void __iomem *base = onenand->dma_addr;
int status;
+ unsigned long timeout;
writel(src, base + S5PC110_DMA_SRC_ADDR);
writel(dst, base + S5PC110_DMA_DST_ADDR);
@@ -552,15 +553,17 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
writel(S5PC110_DMA_TRANS_CMD_TR, base + S5PC110_DMA_TRANS_CMD);
+ timeout = jiffies + msec_to_jiffies(20);
+
do {
status = readl(base + S5PC110_DMA_TRANS_STATUS);
- } 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;
- }
+ 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) &&
+ time_before(jiffies, timeout));
writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
--
1.5.3.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs
2010-08-30 23:48 [PATCH v2] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs Kyungmin Park
@ 2010-08-31 23:02 ` Artem Bityutskiy
2010-09-01 2:28 ` Kyungmin Park
0 siblings, 1 reply; 3+ messages in thread
From: Artem Bityutskiy @ 2010-08-31 23:02 UTC (permalink / raw)
To: Kyungmin Park; +Cc: Artem.Bityutskiy, linux-mtd, dwmw2
On Tue, 2010-08-31 at 08:48 +0900, Kyungmin Park wrote:
> writel(S5PC110_DMA_TRANS_CMD_TR, base + S5PC110_DMA_TRANS_CMD);
>
> + timeout = jiffies + msec_to_jiffies(20);
Are you completely absolutely 100% totally sure 20msecs is enough?
--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs
2010-08-31 23:02 ` Artem Bityutskiy
@ 2010-09-01 2:28 ` Kyungmin Park
0 siblings, 0 replies; 3+ messages in thread
From: Kyungmin Park @ 2010-09-01 2:28 UTC (permalink / raw)
To: dedekind1; +Cc: Artem.Bityutskiy, linux-mtd, dwmw2
On Wed, Sep 1, 2010 at 8:02 AM, Artem Bityutskiy <dedekind1@gmail.com> wrote:
> On Tue, 2010-08-31 at 08:48 +0900, Kyungmin Park wrote:
>> writel(S5PC110_DMA_TRANS_CMD_TR, base + S5PC110_DMA_TRANS_CMD);
>>
>> + timeout = jiffies + msec_to_jiffies(20);
>
> Are you completely absolutely 100% totally sure 20msecs is enough?
Actually there's no mention about the timeout time in the Spec. but I
tested it both s5pc110 and s5pc210. and working well.
No matter increase the time but I give the 4 chance to the DMA
routine. since we got the 5msec times. and in case of s5pc110 it's
implemented the HRT. so it's really enough.
If the DMA takes more time than 20msec, it's really slow devices and
can't use it. as you know the real transfer size is 2KiB or 4KiB.
Thank you,
Kyungmin Park
>
> --
> Best Regards,
> Artem Bityutskiy (Битюцкий Артём)
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-01 2:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 23:48 [PATCH v2] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs Kyungmin Park
2010-08-31 23:02 ` Artem Bityutskiy
2010-09-01 2:28 ` Kyungmin Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).