public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] Why data corrected by ecc are not rewrite to the flash? Why data corrected by ecc are not rewrite to the flash?
Date: Tue, 15 Jun 2010 13:40:03 +0200	[thread overview]
Message-ID: <20100615114003.1F654153659@gemini.denx.de> (raw)
In-Reply-To: <AANLkTikV1wyzcjLr2lIr4cPAvf_vw-pnmO361mWk2_lL@mail.gmail.com>

Dear Ivan Nardi,

In message <AANLkTikV1wyzcjLr2lIr4cPAvf_vw-pnmO361mWk2_lL@mail.gmail.com> you wrote:
> 
> I'am having a look at the ecc algorithms in nand code and I observe (both in
> kernel and in u-boot) that when ecc corrects some data, corrected data are
> given to the user, but the data storage in the nand do not change. In other
> words, I expected the flash would be written with the new (corrected) data.

Where exactly have you been looking? At plain simple NAND flash
drivers? These provide only the lowest software layer to access NAND
storage. Recovery from error situations like these requires a little
more intelligence and is typically implemented in higer software
layers.

> Why data corrected by ecc are not rewrite to the flash?
> 
> I think that it should be easy achieve this goal. In the read function, if
> ecc corrects some data on a page, I read the entire block, erase it and
> write back (correct) data to the flash.

Such a simple approach would be way too dangerous. ECC errors are an
indication that this sector has problems. But you can still read the
data. What would you do if the write-back of the data fails? Now you
still have the data, but where to store these if the original block
cannot be written any more? 

> Nobody is interested in this feature? Or is it more difficult than I think?

It is more difficult than you think, but there is definitely interest
in such things, and actually the problem has been solved a long time
ago.  The name of the solution is UBI.  U-Boot supports UBI, so you
just have to enable it in your board configuration.

Note that for reliable booting from NAND you want to read the U-Boot
image from a (static) UBI volume, which is kind of challenging for the
1st stage NAND boot loader that usually must fit in very small memory
such as 4 KiB or so.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Teenagers are people who express a burning desire to be different by
dressing exactly alike.
There are some strings. They're just not attached.

  parent reply	other threads:[~2010-06-15 11:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-15 10:42 [U-Boot] Why data corrected by ecc are not rewrite to the flash? Ivan Nardi
2010-06-15 11:01 ` Albert ARIBAUD
2010-06-15 12:52   ` Ivan Nardi
2010-06-15 11:40 ` Wolfgang Denk [this message]
2010-06-15 12:56   ` [U-Boot] Why data corrected by ecc are not rewrite to the flash? " Ivan Nardi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100615114003.1F654153659@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox