[U-Boot] Why data corrected by ecc are not rewrite to the flash? Why data corrected by ecc are not rewrite to the flash?
Wolfgang Denk
wd at denx.de
Tue Jun 15 13:40:03 CEST 2010
Dear Ivan Nardi,
In message <AANLkTikV1wyzcjLr2lIr4cPAvf_vw-pnmO361mWk2_lL at 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.
More information about the U-Boot
mailing list