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.

OMAP-L138 NAND_ECC_HW and U-Boot

Other Parts Discussed in Thread: OMAP-L138

Hi

I'm a little bit confused about how OMAP-L138 hardware supports 4-bit ECC for NAND devices. NAND device in question is:

SAMSUNG K9F2G08UXA
- Page Program : (2K + 64)Byte
- Block Erase : (128K + 4K)Byte

By default, DaVinci-PSP-SDK-03.20.00.06 is configured in terms of NAND ECC as follows:

U-Boot:
#undef CONFIG_SYS_NAND_HW_ECC
#define CONFIG_SYS_NAND_4BIT_HW_ECC
#define CONFIG_SYS_NAND_USE_FLASH_BBT
#define CFG_DAVINCI_STD_NAND_LAYOUT

Linux:
static struct davinci_nand_pdata da850_evm_nandflash_data = {
    .parts        = da850_evm_nandflash_partition,
    .nr_parts    = ARRAY_SIZE(da850_evm_nandflash_partition),
    .ecc_mode    = NAND_ECC_HW,
    .ecc_bits    = 4,
    .options    = NAND_USE_FLASH_BBT,
};

However, it turns out that these definitions are not compatible with each other. When I flash a JFFS2 root filesystem on the NAND device, mounting it fails. Changing the above options to:

U-Boot:
#define CONFIG_SYS_NAND_HW_ECC
#define CONFIG_SYS_NAND_USE_FLASH_BBT
#define CFG_DAVINCI_STD_NAND_LAYOUT

Linux:
static struct davinci_nand_pdata da850_evm_nandflash_data = {
    .parts        = da850_evm_nandflash_partition,
    .nr_parts    = ARRAY_SIZE(da850_evm_nandflash_partition),
    .ecc_mode    = NAND_ECC_HW,
    .ecc_bits    = 1,
    .options    = NAND_USE_FLASH_BBT,
};

Allows my system to boot. Unfortunately, there is one problem with this. My device needs to be able to program the boot area (UBL etc.) directly from Linux. OMAP-L138 hardware boot supports only 4-bit ECC. Thus, my workaround is useless as programming the bootsector with 1-bit ECC won't work. My conclusions are:

- U-Boot porgrams the NAND Flash with 4bit ECC correctly (I'm able to flash the bootsector from U-Boot with no problems)
- Linux configuration/implementation for 4-bit ECC is broken

How canI solve my issue? Linux and U-Boot codes are based on DaVinci-PSP-SDK-03.20.00.06 software. Were there any patches in the more recent versions?

Regards
Szymon