[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BANLkTi=_Aw5zZY8PTX3RnBzGNLsTb-fqZA@mail.gmail.com>
Date: Thu, 12 May 2011 10:19:43 -0500
From: Nitin Garg <nitingarg98@...il.com>
To: dedekind1@...il.com
Cc: Matthieu CASTET <matthieu.castet@...rot.com>,
David Woodhouse <dwmw2@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-mtd@...ts.infradead.org" <linux-mtd@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Bug in MTD NAND ONFI chipsize detection
I hope this is better and acceptable, pls review.
As per ONFI standard, the size of NAND Flash device is Number of
data bytes per page * Number of pages per block * Number of blocks
per logical unit * Number of logical units. The nand_flash_detect_onfi
function is missing the Number of logical units due to which the kernel
detects wrong size of Micron MT29F8G08ADADAH4 NAND Flash as
it has 2 logical units. This patch fixes this issue by multiplying
p->lun_count for chipsize.
Signed-off-by: Nitin Garg <nitingarg98@...il.com>
---
drivers/mtd/nand/nand_base.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
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;
busw = 0;
if (le16_to_cpu(p->features) & 1)
busw = NAND_BUSWIDTH_16;
--
1.5.5.6
Download attachment "onfi_nand_flash_chipsize.patch" of type "application/octet-stream" (1465 bytes)
Powered by blists - more mailing lists