This bug affects linux version (and U-BOOT) where the implementation of the fsl_elbc_nand driver supports reading of ONFI parameters. The issue is related to NAND flash devices organized into more logical units.
A logical unit (LUN) is the minimum unit that can independently execute commands and report status.
A LUN contains at least one page register and a Flash array.
The function nand_flash_detect_onfi function in mtd/nand detects the NAND flash device size using ONFI parameters but LUN count is not taken into account and a wrong size for devices that have more than one LUN is detected.
--- linux-2.6.38.origin/drivers/mtd/nand/nand_base.c 2011-05-22 00:13:59.000000000 +0200
+++ linux-2.6.38/drivers/mtd/nand/nand_base.c 2012-08-31 12:24:50.321266000 +0200
@@ -2891,7 +2891,7 @@
mtd->writesize = le32_to_cpu(p->byte_per_page);
mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
- chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
+ chip->chipsize = le32_to_cpu(p->blocks_per_lun) * ((uint64_t)mtd->erasesize *
busw = 0;
if (le16_to_cpu(p->features) & 1)
busw = NAND_BUSWIDTH_16;