The default Linux BSP has issues to support the 8GB NAND, the attached is the patch to fix it, all modified codes are marked with flag "qiang_debug".
Both uboot. kernel and mtd-utilis need be updated.
In Uboot, "nand erase" can erase the whole NAND.
Nand partition in mx53_evk.c is:
static struct mtd_partition nand_flash_partitions[] = {
/* MX53 ROM require the boot FCB/DBBT support which need
* more space to store such info on NAND boot partition.
* 16M should cover all kind of NAND boot support on MX53.
*/
{
.name = "bootloader",
.offset = 0,
.size = 16 * 1024 * 1024},
{
.name = "nand.kernel",
.offset = MTDPART_OFS_APPEND,
.size = 5 * 1024 * 1024},
{
.name = "nand.rootfs",
.offset = MTDPART_OFS_APPEND,
.size = 256 * 1024 * 1024},
{
.name = "nand.userfs1",
.offset = MTDPART_OFS_APPEND,
.size = 256 * 1024 * 1024},
{
.name = "nand.userfs2",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL},
};
In linux rootfs, I used the followed commands for NAND:
flash_eraseall /dev/mtd2
ubiattach /dev/ubi_ctrl -m 2 -d 2
ubimkvol /dev/ubi2 -n 0 -N rootfs -m
mkdir -p /mnt/ubi2; mount -t ubifs ubi2_0 /mnt/ubi2
flash_eraseall /dev/mtd3
ubiattach /dev/ubi_ctrl -m 3 -d 3
ubimkvol /dev/ubi3 -n 0 -N userfs1 -m
mkdir -p /mnt/ubi3; mount -t ubifs ubi3_0 /mnt/ubi3
flash_eraseall /dev/mtd4
ubiattach /dev/ubi_ctrl -m 4 -d 4
ubimkvol /dev/ubi4 -n 0 -N userfs2 -m
mkdir -p /mnt/ubi4; mount -t ubifs ubi4_0 /mnt/ubi4
Original Attachment has been moved to: R10.3.2-Code-update-for-large-NAND_0413.zip
Maybe you need double check the timing parameters. They can be found in the NAND datasheet.
.data_setup_in_ns = 10,
.data_hold_in_ns = 5,
.address_setup_in_ns = 10,
Hi Qiang
I am working on a customized board based on iMX53 QSB and enabling
MT29F2G08ABBEAH4 NAND via PATA I/F in u-boot. Wondering if you could help.
Here are chip info:
Single-level cell (SLC) technology
• Organization
– Page size x8: 2112 bytes (2048 + 64 bytes)
– Page size x16: 1056 words (1024 + 32 words)
– Block size: 64 pages (128K + 4K bytes)
– Plane size: 2 planes x 1024 blocks per plane
– Device size: 2Gb: 2048 blocks
And nand_device_info_table_type_7[] in drivers/mtd/nand/nand_device_info.c
{
.end_of_table = false,
.manufacturer_code = 0x2c,
.device_code = 0xaa,
.cell_technology = NAND_DEVICE_CELL_TECH_SLC,
.chip_size_in_bytes = 256LL*SZ_1M,
.block_size_in_pages = 64,
.page_total_size_in_bytes = 2*SZ_1K + 64,
.ecc_strength_in_bits = 4,
.ecc_size_in_bytes = 512,
.data_setup_in_ns = 10,
.data_hold_in_ns = 5,
.address_setup_in_ns = 10,
.gpmi_sample_delay_in_ns = 6,
.tREA_in_ns = -1,
.tRLOH_in_ns = -1,
.tRHOH_in_ns = -1,
"MT29F2G08ABBEAH4",
},
What i got is NAND probe is OK but read/write/erase are all failed:
MX53-CSSU U-Boot > nand device
Device 0: NAND 256MiB 1,8V 8-bit, sector size 128 KiB
MX53-CSSU U-Boot > nand erase 0x20000 0x20000
NAND erase: device 0 offset 0x20000, size 0x20000
NAND 256MiB 1,8V 8-bit: MTD Erase failure: -5
OK
MX53-CSSU U-Boot > nand write 0xf8006000 0x0 0x20000
NAND write: device 0 offset 0x0, size 0x20000
nand_do_write_ops: Device is write protected NAND write to offset 0 failed -5
0 bytes written: ERROR
MX53-CSSU U-Boot > nand read 0xf8006000 0x0 0x20000
NAND read: device 0 offset 0x0, size 0x20000
UnCorrectable RS-ECC Error
UnCorrectable RS-ECC Error
UnCorrectable RS-ECC Error
UnCorrectable RS-ECC Error
...
UnCorrectable RS-ECC Error
131072 bytes read: OK
Do you have any hints? Thanks in advance,
Hui