Skip to contentSkip to conversation

Fix 2k pagesize NAND on i.MX27

PATCH In review Eric Benard 2 participants 2 messages Jul 14, 2009 – Jul 15, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix 2k pagesize NAND on i.MX27

This patch allows i.MX27 to support 2k pagesize NAND flash. We are using a Micron 1.8V NAND flash : MT29F4G08ABDWP-ET Without this patch, all sectors are marked as bad eraseblock.

---
 drivers/mtd/nand/mxc_nand.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
drivers/mtd/nand/mxc_nand.c +15 -1
index 76beea4..65b26d5 100644
@@ -857,6 +857,17 @@ static void mxc_nand_command(struct mtd_info *mtd, unsigned command,
 	}
 }
 
+/* Define some generic bad / good block scan pattern which are used
+ * while scanning a device for factory marked good / bad blocks. */
+static uint8_t scan_ff_pattern[] = { 0xff, 0xff };
+
+static struct nand_bbt_descr smallpage_memorybased = {
+	.options = NAND_BBT_SCAN2NDPAGE,
+	.offs = 5,
+	.len = 1,
+	.pattern = scan_ff_pattern
+};
+
 static int __init mxcnd_probe(struct platform_device *pdev)
 {
 	struct nand_chip *this;
@@ -973,7 +984,10 @@ static int __init mxcnd_probe(struct platform_device *pdev)
 		goto escan;
 	}
 
-	host->pagesize_2k = (mtd->writesize == 2048) ? 1 : 0;
+	if (mtd->writesize == 2048) {
+		host->pagesize_2k = 1;
+		this->badblock_pattern = &smallpage_memorybased;
+	}
 
 	if (this->ecc.mode == NAND_ECC_HW) {
 		switch (mtd->oobsize) {
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 6 lines · Eric Benard

This patch allows i.MX27 to support 2k pagesize NAND flash. We are using a Micron 1.8V NAND flash : MT29F4G08ABDWP-ET Without this patch, all sectors are marked as bad eraseblock.

The previous version of your patch is sitting in l2-mtd-2.6.git and waiting for dwmw2 already.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)