[PATCH v2 3/6]nand/denali: Fixed driver r/w bug

Chuanxiao.Dong chuanxiao.dong at intel.com
Thu Aug 12 06:51:30 EDT 2010


From 2e36a92751c8002164396c003dd1472392af1b26 Mon Sep 17 00:00:00 2001
From: Chuanxiao Dong <chuanxiao.dong at intel.com>
Date: Thu, 12 Aug 2010 18:01:28 +0800
Subject: [PATCH 3/6] nand/denali: Fixed driver r/w bug

This issue is happened when using large NAND and some ONFI nand:
1) Large NAND need 32bits number to represent page id
2) Some Micro ONFI nand has a special OOB size

Signed-off-by: Chuanxiao Dong <chuanxiao.dong at intel.com>
---
 drivers/mtd/nand/denali.c |    6 +++++-
 drivers/mtd/nand/denali.h |    2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index a7d71e8..920c1cf 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -2021,7 +2021,11 @@ static int denali_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	 * MTD known nothing about multi nand,
 	 * so we should tell it the real pagesize
 	 * and anything necessery
-	 */
+	 * Some NAND chip has a spectial OOB size, so here do
+	 * a recheck
+	 * */
+	denali->mtd.oobsize = ioread32(denali->flash_reg +
+						DEVICE_SPARE_AREA_SIZE);
 	denali->devnum = ioread32(denali->flash_reg + DEVICES_CONNECTED);
 	denali->nand.chipsize <<= (denali->devnum - 1);
 	denali->nand.page_shift += (denali->devnum - 1);
diff --git a/drivers/mtd/nand/denali.h b/drivers/mtd/nand/denali.h
index 05f7415..9c244f7 100644
--- a/drivers/mtd/nand/denali.h
+++ b/drivers/mtd/nand/denali.h
@@ -744,7 +744,7 @@ struct denali_nand_info {
 	struct pci_dev *dev;
 	int total_used_banks;
 	uint32_t block;  /* stored for future use */
-	uint16_t page;
+	uint32_t page;
 	void __iomem *flash_reg;  /* Mapped io reg base address */
 	void __iomem *flash_mem;  /* Mapped io reg base address */
 
-- 
1.6.6.1




More information about the linux-mtd mailing list