nand_imx 4k support ?

Eric Bénard eric at eukrea.com
Mon Apr 2 05:08:57 EDT 2012


Le Mon, 2 Apr 2012 11:03:06 +0200,
Gabriel Tisan <gabriel.tisan at gmail.com> a écrit :

> Yes, Baruch I meant write support, especially ECC layout for 4K flashes.
> 
> Actually the 4k flashes could have 128 or 218 bytes OOB.
> 
> Could you point me to some docs about this layout ? I use a flash with
> 218 bytes spare.
> 
here is a (dirty) patch which force the NFC configuration :

diff --git a/drivers/mtd/nand/nand_imx.c b/drivers/mtd/nand/nand_imx.c
index 85cfbed..182a7ff 100644
--- a/drivers/mtd/nand/nand_imx.c
+++ b/drivers/mtd/nand/nand_imx.c
@@ -805,7 +812,7 @@ static void preset_v3(struct mtd_info *mtd)
 		config2 |= NFC_V3_CONFIG2_PS_2048;
 		config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
 	} else if (mtd->writesize == 4096) {
-		config2 |= NFC_V3_CONFIG2_PS_4096;
+		config2 |= NFC_V3_CONFIG2_PS_4096 | 1;
 		config2 |= NFC_V3_CONFIG2_NUM_ADDR_PHASE1(addr_phases);
 	} else {
 		config2 |= NFC_V3_CONFIG2_PS_512;
@@ -817,13 +824,14 @@ static void preset_v3(struct mtd_info *mtd)
 			config2 |= NFC_V3_MX51_CONFIG2_PPB(
 					ffs(mtd->erasesize /
mtd->writesize) - 6); else
-			config2 |= NFC_V3_MX53_CONFIG2_PPB(
-					ffs(mtd->erasesize /
mtd->writesize) - 6);
+			config2 |= 0x200; /*NFC_V3_MX53_CONFIG2_PPB(
+					ffs(mtd->erasesize /
mtd->writesize) - 6);*/ host->eccsize = get_eccsize(mtd);
-		if (host->eccsize == 8)
+//		if (host->eccsize == 8)
 			config2 |= NFC_V3_CONFIG2_ECC_MODE_8;
 	}
-
+	printf("config2 : %x\n", config2);
+	config2 = 0x706da17A;
 	writel(config2, NFC_V3_CONFIG2);
 
 	config3 = NFC_V3_CONFIG3_NUM_OF_DEVICES(0) |
@@ -835,6 +843,8 @@ static void preset_v3(struct mtd_info *mtd)
 	if (!(chip->options & NAND_BUSWIDTH_16))
 		config3 |= NFC_V3_CONFIG3_FW8;
 
+	printf("config3 : %x\n", config3);
+	config3= 0x1a8608;
 	writel(config3, NFC_V3_CONFIG3);
 
 	writel(0, NFC_V3_DELAY_LINE);
@@ -1064,7 +1074,7 @@ static int __init imxnd_probe(struct device_d
*dev) host->main_area0 = host->base;
 		host->regs = host->base + 0xe00;
 		host->spare0 = host->base + 0x800;
-		host->spare_len = 16;
+		host->spare_len = 64;
 		oob_smallpage = &nandv1_hw_eccoob_smallpage;
 		oob_largepage = &nandv1_hw_eccoob_largepage;
 	} else if (nfc_is_v3_2()) {



More information about the barebox mailing list