public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading
@ 2008-04-11 11:05 Adrian Hunter
  2008-04-12  2:33 ` Kyungmin Park
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Hunter @ 2008-04-11 11:05 UTC (permalink / raw)
  To: Kyungmin Park; +Cc: linux-mtd@lists.infradead.org

Controller errors while reading can be caused by
corruption caused by a previous powerloss. Because
upper level software like JFFS2 treat -EIO as fatal,
it is necessary to treat the error as an ECC error.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
 drivers/mtd/onenand/onenand_base.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 15a62db..daf1965 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -329,6 +329,16 @@ static int onenand_wait(struct mtd_info *mtd, int state)
 		printk(KERN_ERR "onenand_wait: controller error = 0x%04x\n", ctrl);
 		if (ctrl & ONENAND_CTRL_LOCK)
 			printk(KERN_ERR "onenand_wait: it's locked error.\n");
+		if (state == FL_READING) {
+			/*
+			 * Controller errors while reading can be caused by
+			 * corruption caused by a previous powerloss. Because
+			 * upper level software like JFFS2 treat -EIO as fatal,
+			 * it is necessary to treat the error as an ECC error.
+			 */
+			mtd->ecc_stats.failed++;
+			return -EBADMSG;
+		}
 		return -EIO;
 	}
 
-- 
1.5.2.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading
  2008-04-11 11:05 [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading Adrian Hunter
@ 2008-04-12  2:33 ` Kyungmin Park
  2008-04-14  7:04   ` Adrian Hunter
  2008-04-14  7:42   ` Adrian Hunter
  0 siblings, 2 replies; 4+ messages in thread
From: Kyungmin Park @ 2008-04-12  2:33 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mtd@lists.infradead.org

Hi,

On Fri, Apr 11, 2008 at 8:05 PM, Adrian Hunter
<ext-adrian.hunter@nokia.com> wrote:
> Controller errors while reading can be caused by
>  corruption caused by a previous powerloss. Because
>  upper level software like JFFS2 treat -EIO as fatal,
>  it is necessary to treat the error as an ECC error.
>

Umm interesting. You mean it occurs controller error before ecc error
at power loss case.
And it needs to define the terminology the Sudden Power Off Recovery
or POR shortly.
I'm not sure a previous powerloss means POR.

Anyway could you show the controller error value? Since it needs to
distinguish others e.g., initial bad blocks condition.

Thank you,
Kyungmin Park

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading
  2008-04-12  2:33 ` Kyungmin Park
@ 2008-04-14  7:04   ` Adrian Hunter
  2008-04-14  7:42   ` Adrian Hunter
  1 sibling, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2008-04-14  7:04 UTC (permalink / raw)
  To: ext Kyungmin Park; +Cc: linux-mtd@lists.infradead.org

Kyungmin Park wrote:
> On Fri, Apr 11, 2008 at 8:05 PM, Adrian Hunter
> <ext-adrian.hunter@nokia.com> wrote:
>> Controller errors while reading can be caused by
>>  corruption caused by a previous powerloss. Because
>>  upper level software like JFFS2 treat -EIO as fatal,
>>  it is necessary to treat the error as an ECC error.
>>
> 
> Umm interesting. You mean it occurs controller error before ecc error
> at power loss case.
> And it needs to define the terminology the Sudden Power Off Recovery
> or POR shortly.
> I'm not sure a previous powerloss means POR.

No it is not what I meant.  I have sent another patch which I hope is
clearer.

> Anyway could you show the controller error value?

The controller error value is still printed.

> Since it needs to
> distinguish others e.g., initial bad blocks condition.

The bbt scan has its own wait function - I guess it is
possible to get a controller error while reading oob
from an eraseblock that is not actually a bad block.
I am not sure how it would be possible to tell the
difference.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading
  2008-04-12  2:33 ` Kyungmin Park
  2008-04-14  7:04   ` Adrian Hunter
@ 2008-04-14  7:42   ` Adrian Hunter
  1 sibling, 0 replies; 4+ messages in thread
From: Adrian Hunter @ 2008-04-14  7:42 UTC (permalink / raw)
  To: ext Kyungmin Park; +Cc: linux-mtd@lists.infradead.org

Kyungmin Park wrote:
> Hi,
> 
> On Fri, Apr 11, 2008 at 8:05 PM, Adrian Hunter
> <ext-adrian.hunter@nokia.com> wrote:
>> Controller errors while reading can be caused by
>>  corruption caused by a previous powerloss. Because
>>  upper level software like JFFS2 treat -EIO as fatal,
>>  it is necessary to treat the error as an ECC error.
>>
> 
> Umm interesting. You mean it occurs controller error before ecc error
> at power loss case.
> And it needs to define the terminology the Sudden Power Off Recovery
> or POR shortly.
> I'm not sure a previous powerloss means POR.
> 
> Anyway could you show the controller error value? 

0x2440

Since it needs to
> distinguish others e.g., initial bad blocks condition.
> 
> Thank you,
> Kyungmin Park

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-04-14  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-11 11:05 [PATCHJ] [MTD] [OneNAND] Allow for controller errors when reading Adrian Hunter
2008-04-12  2:33 ` Kyungmin Park
2008-04-14  7:04   ` Adrian Hunter
2008-04-14  7:42   ` Adrian Hunter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox