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: ECC/OOB layout in the davinci_nand.c in linux-4.19.94

Part Number: OMAP-L138

Hi,

I am using the newest processor SDK(ti-processor-sdk-linux-omapl138-lcdk-06.03.00.106-Linux-x86-Install.bin) in one custom EVM board, so the u-boot version is 2019.01 and the Linux kernel version is 4.19.94.

In the old processor SDK (u-boot 2012.1 + linux 3.3), we can see the same "ecclayout" in the same file name(davinc_nand.c) in u-boot and Linux kernel. But when I switched the new SDK, I can see the ecclayout in u-boot is kept as the old one(u-boot-2019.01/drivers/mtd/nand/raw/davinci_nand.c):

static struct nand_ecclayout nand_davinci_4bit_layout_oobfirst = {
#if defined(CONFIG_SYS_NAND_PAGE_2K)
    .eccbytes = 40,
#ifdef CONFIG_NAND_6BYTES_OOB_FREE_10BYTES_ECC
    .eccpos = {
        6,   7,  8,  9, 10, 11, 12, 13, 14, 15,
        22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
        38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
        54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
    },
    .oobfree = {
        {2, 4}, {16, 6}, {32, 6}, {48, 6},
    },
#else


But in the Linux part (linux-4.19.94), I found it has been changed a lot:

        if (chunks == 1) {
            mtd_set_ooblayout(mtd, &hwecc4_small_ooblayout_ops);
        } else if (chunks == 4 || chunks == 8) {
            mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops);
            info->chip.ecc.mode = NAND_ECC_HW_OOB_FIRST;
        } else {
            return -EIO;
        }

In my EVM board, the case is "chunks ==4". For I am pretty new to Linux kernel, I am NOT sure if we can get the same ECC/OBB layout in this case (through the code "mtd_set_ooblayout(mtd, &nand_ooblayout_lp_ops)").

In recent days, I have been struggling with one curious question, and I suspected it was probably with the ECC/OOB layout.  Would anyone let me know if the ECC/OOB is the same in the new SDK? If not, how can I change the Linux kernel to make both are same?

Thanks a lot,
Songtao