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.

Linux/AM5K2E04: Can't detect 2GB nand which has two cs siginals.

Part Number: AM5K2E04

Tool/software: Linux

We use MT29F16G08AJADAWP as our nand chip which has two cs signals. So we modified the device tree in k2e sdk as below:

&aemif {
    cs0 {
        #address-cells = <2>;
        #size-cells = <1>;
        clock-ranges;
        ranges;

        ti,cs-chipselect = <0>;
        /* all timings in nanoseconds */
        ti,cs-min-turnaround-ns = <12>;
        ti,cs-read-hold-ns = <6>;
        ti,cs-read-strobe-ns = <23>;
        ti,cs-read-setup-ns = <9>;
        ti,cs-write-hold-ns = <8>;
        ti,cs-write-strobe-ns = <23>;
        ti,cs-write-setup-ns = <8>;

        nand@0,0x0 {
            compatible = "ti,keystone-nand","ti,davinci-nand";
            #address-cells = <1>;
            #size-cells = <1>;
            reg = <0 0 0x4000000
                               1 0 0x00000100>;

            ti,davinci-chipselect = <0>;
            ti,davinci-mask-ale = <0x2000>;
            ti,davinci-mask-cle = <0x4000>;
            ti,davinci-mask-chipsel = <0>;
            nand-ecc-mode = "hw";
            ti,davinci-ecc-bits = <4>;
            nand-on-flash-bbt;

            partition@0 {
                label = "u-boot";
                reg = <0x0 0x100000>;
                read-only;
            };

            partition@100000 {
                label = "params";
                reg = <0x100000 0x80000>;
                read-only;
            };

            partition@180000 {
                label = "ubifs";
                reg = <0x180000 0x3FE80000>;
            };
        };
    };
    cs1 {
        #address-cells = <2>;
        #size-cells = <1>;
        clock-ranges;
        ranges;

        ti,cs-chipselect = <1>;
        /* all timings in nanoseconds */
        ti,cs-min-turnaround-ns = <12>;
        ti,cs-read-hold-ns = <6>;
        ti,cs-read-strobe-ns = <23>;
        ti,cs-read-setup-ns = <9>;
        ti,cs-write-hold-ns = <8>;
        ti,cs-write-strobe-ns = <23>;
        ti,cs-write-setup-ns = <8>;

        nand@0,0x4000000 {
            compatible = "ti,keystone-nand","ti,davinci-nand";
            #address-cells = <1>;
            #size-cells = <1>;
            reg = <0 0x4000000 0x4000000
                                1 0 0x00000100>;

            ti,davinci-chipselect = <1>;
            ti,davinci-mask-ale = <0x2000>;
            ti,davinci-mask-cle = <0x4000>;
            ti,davinci-mask-chipsel = <0>;
            nand-ecc-mode = "hw";
            ti,davinci-ecc-bits = <4>;
            nand-on-flash-bbt;

            partition@40000000 {
                label = "nand2";
                reg = <0x40000000 0x40000000>;
                
            };
        };
    };
};

When we burn the nand and start the kernel, we get the error : nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xd3
[   17.057983] nand: Micron MT29F16G08AJADAWP
[   17.062086] nand: 2048 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[   17.070063] Bad block table found at page 1048512, version 0x01
[   17.076513] Bad block table found at page 1048448, version 0x01
[   17.082999] nand_read_bbt: bad block at 0x000024820000
[   17.088258] 3 ofpart partitions found on MTD device 30000000.nand
[   17.094362] Creating 3 MTD partitions on "30000000.nand":
[   17.099783] 0x000000000000-0x000000100000 : "u-boot"
[   17.105530] 0x000000100000-0x000000180000 : "params"
[   17.111217] 0x000000180000-0x000040000000 : "ubifs"
[   17.117544] davinci_nand 30000000.nand: controller rev. 2.5
[   17.123883] davinci_nand: probe of 34000000.nand failed with error -16
[   17.131063] platform snd-soc-dummy: set dma_pfn_offset00780000
[   17.138020] NET: Registered protocol family 10
[   17.143121] sit: IPv6 over IPv4 tunneling driver
[   17.148172] NET: Registered protocol family 17
[   17.152775] Key type dns_resolver registered
[   17.157174] Registering SWP/SWPB emulation handler
[   17.163238] ubi0: attaching mtd4
[   17.354977] (NULL net_device): Link is Down
[   17.359168] (NULL net_device): Link is Down
[   17.363357] (NULL net_device): Link is Down
[   17.367557] (NULL net_device): Link is Down
[   17.371746] (NULL net_device): Link is Down
[   17.375944] (NULL net_device): Link is Down
[   21.454044] ubi0 error: scan_peb: bad image sequence number 1864223580 in PEB 8176, expected 1078639942
[   21.463471] Erase counter header dump:
[   21.467235]  magic          0x55424923
[   21.470987]  version        1
[   21.473954]  ec             1
[   21.476933]  vid_hdr_offset 2048
[   21.480162]  data_offset    4096
[   21.483391]  image_seq      1864223580
[   21.487152]  hdr_crc        0xf63135e2
[   21.490903] erase counter header hexdump:
[   21.497589] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[   21.504663] UBI error: cannot attach mtd4
[   21.508661] hctosys: unable to open rtc device (rtc0)
[   21.524950] ALSA device list:
[   21.527933]   No soundcards found.
[   21.531787] UBIFS error (pid: 1): cannot open "ubi0:rootfs", error -19VFS: Cannot open root device "ubi0:rootfs" or unknown-block(0,0): error -19


How do we modify the device tree correctly.