Commit 637957551c0ac80de8dfc7650d320c5a98c2c0c0

Authored by Matthieu CASTET
Committed by David Woodhouse
1 parent 452380efbd

mtd: support ONFI multi lun NAND

With onfi a flash is organized into one or more logical units (LUNs).
A logical unit (LUN) is the minimum unit that can independently execute
commands and report status.

Mtd does not exploit LUN, so make it see a big single flash where size is
lun_size * number_of_lun.

Without this patch MT29F8G08ADBDAH4 size is 512MiB instead of 1GiB.

Artem: split long line on 2 shorter ones.

Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com>
Acked-by: Florian Fainelli <ffainelli@freebox.fr>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff

drivers/mtd/nand/nand_base.c
... ... @@ -2893,7 +2893,8 @@
2893 2893 mtd->writesize = le32_to_cpu(p->byte_per_page);
2894 2894 mtd->erasesize = le32_to_cpu(p->pages_per_block) * mtd->writesize;
2895 2895 mtd->oobsize = le16_to_cpu(p->spare_bytes_per_page);
2896   - chip->chipsize = (uint64_t)le32_to_cpu(p->blocks_per_lun) * mtd->erasesize;
  2896 + chip->chipsize = le32_to_cpu(p->blocks_per_lun);
  2897 + chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count;
2897 2898 *busw = 0;
2898 2899 if (le16_to_cpu(p->features) & 1)
2899 2900 *busw = NAND_BUSWIDTH_16;