Thank you for your replay and for your interest. You are right: rewriting the corrected data may be a critical operation that may fail and having an untouch flash content is useful to prevent damages from buggy algorithms.
Yet I was thinking about a particular scenario. If flash memory is wearing a little at a time (ie, the first time I read a page I find 1 bit wrong, then I found 2 errors in the same page and so on until I am not able to correct data) rewrite corrected data may be useful. Is this scenario so unlikely? On 15 June 2010 13:01, Albert ARIBAUD <[email protected]> wrote: > Le 15/06/2010 12:42, Ivan Nardi a écrit : >> Hello! >> >> 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. >> >> 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. >> >> Nobody is interested in this feature? Or is it more difficult than I think? >> >> Thanks a lot! > > Let me play the devil's advocate here: what would be the interest of > writing back corrected data to the flash? Here's my take at the pros and > cons of writing ECC-corrected data back to flash: > > Cons: > > - risk of the write failing more or less critically; > > - performance hit (albeit marginal hopefully); > > - risk of spurious data corruption: if the ECC detection/correction or > write decision code is buggy, you may end up with a write-back where > unnecessary, and possibly write the wrong data back to flash. The > current situation, at least, guarantees that the Flash content is > preserved even if ECC detection/correction gets it wrong. > > Pros: > > - marginal performance gain for subsequent reads of ECC, assuming the > data is read frequently enough that the correction time becomes > significant wrt all the rest of the bootloader execution. > > But the bottom line is: there is no benefit as far as the data itself is > concerned since it is correct without writing it back to Flash. > > Amicalement, > -- > Albert. > _______________________________________________ > U-Boot mailing list > [email protected] > http://lists.denx.de/mailman/listinfo/u-boot > _______________________________________________ U-Boot mailing list [email protected] http://lists.denx.de/mailman/listinfo/u-boot

