This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

NAND ECC on AM335x

I need some help related to u-boot and linux kernel’s use of NAND ECC schemes on the AM335x.  It looks like 8-bit BCH ECC scheme is used across ROM, u-boot, Kernel and File System, but 1-bit ECC Hamming scheme is used on the u-boot environment.  That mixed ECC scheme is a problem in the kernel because it expects only one scheme, 8-bit BCH ECC, to be used across the whole NAND flash.  My u-boot environment is on the NAND flash and I sometimes require it to be modified with the fw_setenv user space application.   Fw_setenv utilizes the kernel’s MTD device driver to modify the u-boot environment.  But since the kernel uses 8-bit BCH ECC, instead of the 1-bit ECC Hamming scheme across all of NAND flash, it writes ECC data that u-boot sees as invalid the next time it runs.

I tried modifying u-boot to use 8-bit BCH ECC scheme on the u-boot environment in NAND, but I get “ECC: uncorrectable” errors.   The following comments are in the u-boot code where that “ECC: uncorrectable” errors occurs:

            /* This currently sees all pages as being completely full of

             * uncorrectable errors.  The suspicion is that this is due

             * to limitations in the elm support we have in U-Boot today

             */

I also see a comment in the u-boot code that says “For undocumented reasons we need to currently keep our environment in 1-bit ECC so we configure ourself thusly.”  Since the kernel is set to use 8-bit BCH ECC scheme and mixed ECC schemes are not supported, I’d like to get some help with enabling the 8-bit BCH ECC scheme on the u-boot environment.

Thank you,

Peggy