Skip to contentSkip to conversation

mtd/ifc: Add support of 8K page size NAND flash

PATCH Superseded Prabhakar Kushwaha 1 participant 1 message Oct 3, 2013

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 2/3 mtd/ifc: Add support of 8K page size NAND flash

Current IFC driver supports till 4K page size NAND flash. Add support of 8K NAND flash
- Program Spare region size in csor_ext
- Add nand_ecclayout for 4 bit & 8 bit ecc
- Defines constants
- Add support of 8K NAND boot.

---
Changes for v2: sending as it is
Changes for v3: Incorporated Liu Po's commetns
- Updated fsl_ifc_spl 8K if conditional check
Changes for v4: fix SPL 8K condition check

 arch/powerpc/cpu/mpc8xxx/fsl_ifc.c |   24 +++++++++++
 arch/powerpc/include/asm/fsl_ifc.h |    2 +
 drivers/mtd/nand/fsl_ifc_nand.c    |   78 ++++++++++++++++++++++++++++++++++++
 drivers/mtd/nand/fsl_ifc_spl.c     |    5 ++-
 4 files changed, 108 insertions(+), 1 deletion(-)
arch/powerpc/cpu/mpc8xxx/fsl_ifc.c +24 -0
index 2d0fb43..64a5225 100644
@@ -34,6 +34,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR0_EXT
 	set_ifc_cspr_ext(IFC_CS0, CONFIG_SYS_CSPR0_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR0_EXT
+	set_ifc_csor_ext(IFC_CS0, CONFIG_SYS_CSOR0_EXT);
+#endif
 	set_ifc_cspr(IFC_CS0, CONFIG_SYS_CSPR0);
 	set_ifc_amask(IFC_CS0, CONFIG_SYS_AMASK0);
 	set_ifc_csor(IFC_CS0, CONFIG_SYS_CSOR0);
@@ -43,6 +46,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR1_EXT
 	set_ifc_cspr_ext(IFC_CS1, CONFIG_SYS_CSPR1_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR1_EXT
+	set_ifc_csor_ext(IFC_CS1, CONFIG_SYS_CSOR1_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR1) && defined(CONFIG_SYS_CSOR1)
 	set_ifc_ftim(IFC_CS1, IFC_FTIM0, CONFIG_SYS_CS1_FTIM0);
 	set_ifc_ftim(IFC_CS1, IFC_FTIM1, CONFIG_SYS_CS1_FTIM1);
@@ -57,6 +63,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR2_EXT
 	set_ifc_cspr_ext(IFC_CS2, CONFIG_SYS_CSPR2_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR2_EXT
+	set_ifc_csor_ext(IFC_CS2, CONFIG_SYS_CSOR2_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR2) && defined(CONFIG_SYS_CSOR2)
 	set_ifc_ftim(IFC_CS2, IFC_FTIM0, CONFIG_SYS_CS2_FTIM0);
 	set_ifc_ftim(IFC_CS2, IFC_FTIM1, CONFIG_SYS_CS2_FTIM1);
@@ -71,6 +80,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR3_EXT
 	set_ifc_cspr_ext(IFC_CS3, CONFIG_SYS_CSPR3_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR3_EXT
+	set_ifc_csor_ext(IFC_CS3, CONFIG_SYS_CSOR3_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR3) && defined(CONFIG_SYS_CSOR3)
 	set_ifc_ftim(IFC_CS3, IFC_FTIM0, CONFIG_SYS_CS3_FTIM0);
 	set_ifc_ftim(IFC_CS3, IFC_FTIM1, CONFIG_SYS_CS3_FTIM1);
@@ -85,6 +97,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR4_EXT
 	set_ifc_cspr_ext(IFC_CS4, CONFIG_SYS_CSPR4_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR4_EXT
+	set_ifc_csor_ext(IFC_CS4, CONFIG_SYS_CSOR4_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR4) && defined(CONFIG_SYS_CSOR4)
 	set_ifc_ftim(IFC_CS4, IFC_FTIM0, CONFIG_SYS_CS4_FTIM0);
 	set_ifc_ftim(IFC_CS4, IFC_FTIM1, CONFIG_SYS_CS4_FTIM1);
@@ -99,6 +114,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR5_EXT
 	set_ifc_cspr_ext(IFC_CS5, CONFIG_SYS_CSPR5_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR5_EXT
+	set_ifc_csor_ext(IFC_CS5, CONFIG_SYS_CSOR5_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR5) && defined(CONFIG_SYS_CSOR5)
 	set_ifc_ftim(IFC_CS5, IFC_FTIM0, CONFIG_SYS_CS5_FTIM0);
 	set_ifc_ftim(IFC_CS5, IFC_FTIM1, CONFIG_SYS_CS5_FTIM1);
@@ -113,6 +131,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR6_EXT
 	set_ifc_cspr_ext(IFC_CS6, CONFIG_SYS_CSPR6_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR6_EXT
+	set_ifc_csor_ext(IFC_CS6, CONFIG_SYS_CSOR6_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR6) && defined(CONFIG_SYS_CSOR6)
 	set_ifc_ftim(IFC_CS6, IFC_FTIM0, CONFIG_SYS_CS6_FTIM0);
 	set_ifc_ftim(IFC_CS6, IFC_FTIM1, CONFIG_SYS_CS6_FTIM1);
@@ -127,6 +148,9 @@ void init_early_memctl_regs(void)
 #ifdef CONFIG_SYS_CSPR7_EXT
 	set_ifc_cspr_ext(IFC_CS7, CONFIG_SYS_CSPR7_EXT);
 #endif
+#ifdef CONFIG_SYS_CSOR7_EXT
+	set_ifc_csor_ext(IFC_CS7, CONFIG_SYS_CSOR7_EXT);
+#endif
 #if defined(CONFIG_SYS_CSPR7) && defined(CONFIG_SYS_CSOR7)
 	set_ifc_ftim(IFC_CS7, IFC_FTIM0, CONFIG_SYS_CS7_FTIM0);
 	set_ifc_ftim(IFC_CS7, IFC_FTIM1, CONFIG_SYS_CS7_FTIM1);
arch/powerpc/include/asm/fsl_ifc.h +2 -0
index a945e4b..182b1a6 100644
@@ -77,6 +77,7 @@
 #define CSOR_NAND_PGS_512		0x00000000
 #define CSOR_NAND_PGS_2K		0x00080000
 #define CSOR_NAND_PGS_4K		0x00100000
+#define CSOR_NAND_PGS_8K		0x00180000
 /* Spare region Size */
 #define CSOR_NAND_SPRZ_MASK		0x0000E000
 #define CSOR_NAND_SPRZ_SHIFT		13
@@ -86,6 +87,7 @@
 #define CSOR_NAND_SPRZ_210		0x00006000
 #define CSOR_NAND_SPRZ_218		0x00008000
 #define CSOR_NAND_SPRZ_224		0x0000A000
+#define CSOR_NAND_SPRZ_CSOR_EXT	0x0000C000
 /* Pages Per Block */
 #define CSOR_NAND_PB_MASK		0x00000700
 #define CSOR_NAND_PB_SHIFT		8
drivers/mtd/nand/fsl_ifc_nand.c +78 -0

90 lines not on this page · raw message

drivers/mtd/nand/fsl_ifc_spl.c +4 -1
index d462265..ccad2a4 100644
@@ -112,7 +112,10 @@ static void nand_load(unsigned int offs, int uboot_size, uchar *dst)
 
 	port_size = (cspr & CSPR_PORT_SIZE_16) ? 16 : 8;
 
-	if (csor & CSOR_NAND_PGS_4K) {
+	if (csor & CSOR_NAND_PGS_8K == CSOR_NAND_PGS_8K) {
+		page_size = 8192;
+		bufnum_mask = 0x0;
+	} else if (csor & CSOR_NAND_PGS_4K) {
 		page_size = 4096;
 		bufnum_mask = 0x1;
 	} else if (csor & CSOR_NAND_PGS_2K) {
Signature · 1 line
1.7.9.5