question about write/read sub-page with BCH algorithm or disable sub-page operation when using ubifs

Matthieu CASTET matthieu.castet at parrot.com
Tue Jul 31 03:37:57 EDT 2012


Hi,
> Hello,
> I have a question about sub-page when using ubifs, so ask help from here.
> 
> Let me take a 2048-size page with 4 sub-page Nand as example.
> 
> The documentation said, "To write a sub-page, the driver may actually
> write whole NAND page, but put 0xFF bytes to the sub-pages which are
> not relevant to this operation."
> It's OK for some ECC algorithms such as Hamming algorithm, because the
> ECC codes generated by Hamming algorithm for the 0xFF data are still
> 0xFF'ed. However, if we use BCH algorithm, the generated ECC codes for
> 0xFF data will be not 0xFF'ed, and they will overwrite the previous
> OOB data, so error will be happened when reading next time.
It depends of your ecc algorithm. The software BCH algo in kernel take care of
generate code such as 0xFF data give 0xFF ecc.

This can be done by XORing the ecc before writing/after reading.

This may not possible on some controller that compute and send ecc without
software intervention.


> 
> I try to resolve this issue by disabling sub-page operation, so I add
> NAND_NO_SUBPAGE_WRITE into chip->options, but chip->options will be
> flushed in nand_get_flash_type() funtion (chip->options &=
> ~NAND_CHIPOPTIONS_MSK).

You may better define chip->ecc.steps == 1

Matthieu



More information about the linux-mtd mailing list