Tool/software:
We have recently successfully been able to boot from NAND on a custom board with this NAND flash:MT29F2G08ABB. We recently switched to the 4Gb size NAND (MT29F4G08ABBDAH4), and are having troubles with the NANDBoot. See below how we are writing NAND Flash. The only difference between these two NAND pieces are the size is doubled, and the OOB size is smaller at OOB size of 64. Previously for the smaller flash we had to write the MLO in BCH16 because the OOB size was 128. For this new flash we are just writing in BCH8.
=> mtdparts
device nand0 <nand.0>, # parts = 10
#: name size offset mask_flags
0: NAND.SPL 0x00020000 0x00000000 0
1: NAND.SPL.backup1 0x00020000 0x00020000 0
2: NAND.SPL.backup2 0x00020000 0x00040000 0
3: NAND.SPL.backup3 0x00020000 0x00060000 0
4: NAND.u-boot-spl-os 0x00040000 0x00080000 0
5: NAND.u-boot 0x00100000 0x000c0000 0
6: NAND.u-boot-env 0x00020000 0x001c0000 0
7: NAND.u-boot-env.backup10x00020000 0x001e0000 0
8: NAND.kernel 0x00800000 0x00200000 0
9: NAND.file-system 0x1f600000 0x00a00000 0
active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000
defaults:
mtdids : nand0=nand.0
mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.ba )
=> nand write 0x82000000 0x0 0x20000
NAND write: device 0 offset 0x0, size 0x20000
131072 bytes written: OK
=> nand write 0x82000000 0x20000 0x20000
NAND write: device 0 offset 0x20000, size 0x20000
131072 bytes written: OK
=> nand write 0x82000000 0x80000 0x40000
NAND write: device 0 offset 0x80000, size 0x40000
262144 bytes written: OK
=> nand write 0x82000000 0xc0000 0x100000
NAND write: device 0 offset 0xc0000, size 0x100000
1048576 bytes written: OK
=> nand write 0x82000000 0x200000 0x800000
NAND write: device 0 offset 0x200000, size 0x800000
8388608 bytes written: OK
=> nand write 0x82000000 0x00a00000 0xf600000
NAND write: device 0 offset 0xa00000, size 0xf600000
257949696 bytes written: OK
Nand-boot seems to have trouble. See below the crash log we are seeing. I figured this should be a drop in replacement so I am not sure what else we could be missing from the nand firmware side of things.
[ 2.857547] nand: device found, Manufacturer ID: 0x2c, Chip ID: 0xac
[ 2.863960] nand: Micron MT29F4G08ABBDAH4
[ 2.868282] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[ 2.876033] nand: using OMAP_ECC_BCH8_CODE_HW ECC scheme
[ 2.881643] 10 fixed-partitions partitions found on MTD device omap2-nand.0
[ 2.888685] Creating 10 MTD partitions on "omap2-nand.0":
[ 2.894113] 0x000000000000-0x000000020000 : "NAND.SPL"
[ 2.900862] 0x000000020000-0x000000040000 : "NAND.SPL.backup1"
[ 2.906885] 8<--- cut here ---
[ 2.909953] Unable to handle kernel NULL pointer dereference at virtual address 00000000
[ 2.918093] [00000000] *pgd=00000000
[ 2.921699] Internal error: Oops: 805 [#1] PREEMPT ARM
[ 2.926862] Modules linked in:
[ 2.929934] CPU: 0 PID: 30 Comm: kworker/u2:3 Not tainted 6.1.46-00001-g50c291694ae5-dirty #6
[ 2.938499] Hardware name: Generic AM33XX (Flattened Device Tree)
[ 2.944619] Workqueue: events_unbound deferred_probe_work_func
[ 2.950500] PC is at add_mtd_partitions+0xc4/0x174
[ 2.955321] LR is at add_mtd_partitions+0xa8/0x174
[ 2.960133] pc : [<c074c534>] lr : [<c074c518>] psr: 60000113
[ 2.966426] sp : e0081d08 ip : c1a16580 fp : 00000000
[ 2.971670] r10: c2891c00 r9 : c1ffa338 r8 : 0000000a
[ 2.976915] r7 : c28b1828 r6 : c1ffa040 r5 : c1ffa040 r4 : 00000001
[ 2.983469] r3 : c1a16580 r2 : 00000000 r1 : c2891ed8 r0 : c1ffa338
[ 2.990024] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 2.997192] Control: 10c5387d Table: 80004019 DAC: 00000051
[ 3.002958] Register r0 information: slab kmalloc-2k start c1ffa000 pointer offset 824 size 2048
[ 3.011807] Register r1 information: slab kmalloc-1k start c2891c00 pointer offset 728 size 1024
[ 3.020645] Register r2 information: NULL pointer
[ 3.025372] Register r3 information: slab task_struct start c1a16580 pointer offset 0
[ 3.033247] Register r4 information: non-paged memory
[ 3.038319] Register r5 information: slab kmalloc-2k start c1ffa000 pointer offset 64 size 2048
[ 3.047069] Register r6 information: slab kmalloc-2k start c1ffa000 pointer offset 64 size 2048
[ 3.055819] Register r7 information: slab kmalloc-512 start c28b1800 pointer offset 40 size 512
[ 3.064569] Register r8 information: non-paged memory
[ 3.069642] Register r9 information: slab kmalloc-2k start c1ffa000 pointer offset 824 size 2048
[ 3.078478] Register r10 information: slab kmalloc-1k start c2891c00 pointer offset 0 size 1024
[ 3.087228] Register r11 information: NULL pointer
[ 3.092039] Register r12 information: slab task_struct start c1a16580 pointer offset 0
[ 3.100002] Process kworker/u2:3 (pid: 30, stack limit = 0xb222b861)
[ 3.106389] Stack: (0xe0081d08 to 0xe0082000)
[ 3.110767] 1d00: 00020000 00000000 e0081d34 c0e746cc 0000000a c1220f8c
[ 3.118982] 1d20: 0000000a 00000000 00000000 c1ffa040 00000000 00000000 c1805600 c074c430
[ 3.127197] 1d40: 00000000 00000000 c0ca14d0 c288cc10 c1a16580 c0e05b20 00000800 00000000
[ 3.135412] 1d60: c0e74048 c0ebc720 c28b1800 0000000a c1220f8c 83ad3361 c288cc10 c1ffa040
[ 3.143628] 1d80: 00000000 00000000 00000000 00000000 c288cc10 ff8fb054 c1805600 c0749af8
[ 3.151842] 1da0: c1ffa040 00000000 c288cc00 c1a16580 c288cc10 c12b3a84 ff8fb054 c076e1ec
[ 3.160057] 1dc0: 00000000 e0081dd4 c1895db4 ff8fb054 00000000 df9c2d18 00000000 00000000
[ 3.168273] 1de0: 00000000 c1a16580 c181200d c09bd8f4 ffffffff c0305b44 00000000 00000000
[ 3.176487] 1e00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 83ad3361
[ 3.184702] 1e20: 00000000 c288cc10 c1222038 00000000 00000000 c1a16580 c181200d c06bdd6c
[ 3.192918] 1e40: c288cc10 00000000 c1222038 c06bb65c c288cc10 c1222038 c288cc10 00000067
[ 3.201133] 1e60: 00000000 c06bb908 60000113 c1a16580 c12b3090 c1222038 c288cc10 00000067
[ 3.209348] 1e80: 00000000 c06bba50 00000001 c1222038 e0081ee4 c288cc10 00000000 c06bc058
[ 3.217563] 1ea0: 00000000 e0081ee4 c1a16580 c06bbfc4 00000000 c06b97a8 60000113 c18c51dc
[ 3.225778] 1ec0: c1d5feb4 83ad3361 c1805600 c288cc10 00000001 c1a16580 c288cc54 c06bbcfc
[ 3.233993] 1ee0: c288cc10 c288cc10 00000001 83ad3361 00000000 c288cc10 c1212558 c288cc10
[ 3.242208] 1f00: 00000000 c06ba954 c288cc10 c12122d4 c12122e0 c06bad98 c1212304 c1aadc80
[ 3.250423] 1f20: c1263e40 c1812000 00000000 c0147558 c1805600 c1805600 c1805618 c1aadc80
[ 3.258639] 1f40: c1805600 c1aadc98 c1805618 c1187ae0 00000088 c1a16580 c1805600 c0147a88
[ 3.266854] 1f60: c1aadc80 c12634c6 60000113 c1ab4f40 c1a16580 c0147858 c1aadc80 c1aa7e80
[ 3.275070] 1f80: e006dec0 00000000 00000000 c014e520 c1ab4f40 c014e448 00000000 00000000
[ 3.283284] 1fa0: 00000000 00000000 00000000 c0100148 00000000 00000000 00000000 00000000
[ 3.291499] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 3.299714] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[ 3.307936] add_mtd_partitions from parse_mtd_partitions+0x4e4/0x524
[ 3.314416] parse_mtd_partitions from mtd_device_parse_register+0xe0/0x2c0
[ 3.321416] mtd_device_parse_register from omap_nand_probe+0x258/0x4d4
[ 3.328081] omap_nand_probe from platform_probe+0x5c/0xbc
[ 3.333609] platform_probe from really_probe+0xc8/0x2ec
[ 3.338953] really_probe from __driver_probe_device+0x88/0x1a0
[ 3.344904] __driver_probe_device from driver_probe_device+0x30/0x104
[ 3.351467] driver_probe_device from __device_attach_driver+0x94/0x108
[ 3.358118] __device_attach_driver from bus_for_each_drv+0x7c/0xc0
[ 3.364419] bus_for_each_drv from __device_attach+0xa8/0x1d8
[ 3.370196] __device_attach from bus_probe_device+0x84/0x8c
[ 3.375887] bus_probe_device from deferred_probe_work_func+0x78/0xa4
[ 3.382362] deferred_probe_work_func from process_one_work+0x1c0/0x4c0
[ 3.389029] process_one_work from worker_thread+0x230/0x584
[ 3.394728] worker_thread from kthread+0xd8/0x108
[ 3.399558] kthread from ret_from_fork+0x14/0x2c
[ 3.404291] Exception stack(0xe0081fb0 to 0xe0081ff8)
[ 3.409364] 1fa0: 00000000 00000000 00000000 00000000
[ 3.417579] 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 3.425793] 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 3.432441] Code: e58612d4 e58a22dc e58a02d8 e1a00009 (e5821000)
[ 3.438776] ---[ end trace 0000000000000000 ]---