mtd: support ONFI multi lun NAND

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Mar 26 20:59:20 EDT 2012


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=637957551c0ac80de8dfc7650d320c5a98c2c0c0
Commit:     637957551c0ac80de8dfc7650d320c5a98c2c0c0
Parent:     452380efbd72d8d41f53ea64c8a6ea1fedc4394d
Author:     Matthieu CASTET <matthieu.castet at parrot.com>
AuthorDate: Mon Mar 19 15:35:25 2012 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Tue Mar 27 01:01:43 2012 +0100

    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 at parrot.com>
    Acked-by: Florian Fainelli <ffainelli at freebox.fr>
    Signed-off-by: Artem Bityutskiy <artem.bityutskiy at linux.intel.com>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/nand_base.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 8008853..0bcc715 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2893,7 +2893,8 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip,
 	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);
+	chip->chipsize *= (uint64_t)mtd->erasesize * p->lun_count;
 	*busw = 0;
 	if (le16_to_cpu(p->features) & 1)
 		*busw = NAND_BUSWIDTH_16;



More information about the linux-mtd-cvs mailing list