Patchwork Bug in MTD NAND ONFI chipsize detection

login
register
mail settings
Submitter Nitin Garg
Date May 12, 2011, 7:05 a.m.
Message ID <BANLkTinGFDHj4s6nAXMiq8dYW_UO6W+YXg@mail.gmail.com>
Download mbox | patch
Permalink /patch/95263/
State New
Headers show

Comments

Nitin Garg - May 12, 2011, 7:05 a.m.
Here is the tested patch, pls apply.

From 1a73f1c3d066a491d0c806883788ab9abdc736f3 Mon Sep 17 00:00:00 2001
From: Nitin Garg <nitingarg98@gmail.com>
Date: Thu, 12 May 2011 01:31:53 -0500
Subject: [PATCH] Fix ONFI NAND flash size detection by using number of
Logical Units in device

Signed-off-by: Nitin Garg <nitingarg98@gmail.com>
---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
       busw = 0;
       if (le16_to_cpu(p->features) & 1)
               busw = NAND_BUSWIDTH_16;
--
1.5.5.6

Patch

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c54a4cb..cdf6015 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -2892,7 +2892,7 @@  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 = (uint64_t)le32_to_cpu(p->blocks_per_lun) *
le32_to_cpu(p->lun_count) * mtd->erasesize;