UBIFS and hardware ECC of all FF pages of MLC NAND

Artem Bityutskiy dedekind at infradead.org
Sun Oct 11 04:39:17 EDT 2009


On Tue, 2009-09-29 at 06:26 -0700, Darwin Rambo wrote:
> A better error message would say something like:
> "UBI error: Data page incorrectly programmed to all 0xFFs with non-0xFF ECC."

Just FYI, I've created this FAQ section:

http://www.linux-mtd.infradead.org/faq/ubifs.html#L_why_ubiformat

Here is the full text in case someone would review:

Why I have to use ubiformat?
The first obvious reason is that ubiformat preserves erase counters, so
you do not lose your wear-leveling information when flashing new images.

The other reason is more subtle, and specific to NAND flashes which have
ECC calculation algorithm which produces ECC code not equivalent to all
0xFF bytes if the NAND page contains only 0xFF bytes. Consider an
example.

      * We erase whole flash, so everything is 0xFF'ed now.
      * We write an UBI/UBIFS image to flash using nandwrite.
      * Some eraseblocks in the UBIFS image may contain several empty
        NAND pages at the end, and UBIFS will write to them when it is
        run.
      * The nandwrite utility writes whole image, and it explicitely
        writes 0xFF bytes to those NAND pages.
      * The ECC checksums are calculated for these 0xFF'ed NAND pages
        and are stored in the OOB area. The ECC codes are not 0xFF'ed.
        This is often the case for HW ECC calculation engines, and it is
        difficult to fix this. Normally, ECC codes should be 0xFF'ed for
        such pages.
      * When later UBIFS runs, it writes data to these NAND pages, which
        means that a new ECC code is calculated, and written on top of
        the existing one (unsuccessfully, of course). This may trigger
        an error straight away, but usually at this point no error is
        triggered.
      * At some point UBIFS is trying to read from these pages, and gets
        and an ECC error (-EBADMSG = -74).

In fewer words, ubiformat makes sure that every NAND page is written
once and only once after the erasure. If you use nandwrite, some pages
are written twice - once by nandwrite, and once by UBIFS.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list