Skip to contentSkip to conversation

ppc4xx: Move definition for PPC4xx NAND FLASH controller to header

PATCH New Stefan Roese 2 participants 5 messages May 20, 2009 – May 23, 2009

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

PATCH 1/3 ppc4xx: Move definition for PPC4xx NAND FLASH controller to header

This patch moves the definition for the PPC4xx NAND FLASH controller (NDFC) CONFIG_NAND_NDFC into include/ppc4xx.h. This is needed for the upcoming fix for the ECC byte ordering of the NDFC driver.

---
Scott, please review this patchset. It fixes a problem with the 4xx NDFC and it's compatibility with the Linux driver. I would really like to get this into this 2009-06 release. Since this patchset also touches a file in drivers/mtd/nand, how should we handle those patches? Should I push those patches (after your ACK) via my ppc4xx repository?

BTW: My plan is to move this 4xx NAND driver to drivers/mtd/nand after the next release.

Thanks,
Stefan

 cpu/ppc4xx/ndfc.c |    9 +++------
 include/ppc4xx.h  |    7 +++++++
 2 files changed, 10 insertions(+), 6 deletions(-)
cpu/ppc4xx/ndfc.c +3 -6
index 3a5af12..ba481ad 100644
@@ -1,9 +1,9 @@
 /*
  * Overview:
  *   Platform independend driver for NDFC (NanD Flash Controller)
- *   integrated into EP440 cores
+ *   integrated into IBM/AMCC PPC4xx cores
  *
- * (C) Copyright 2006-2007
+ * (C) Copyright 2006-2009
  * Stefan Roese, DENX Software Engineering, sr at denx.de.
  *
  * Based on original work by
@@ -32,10 +32,7 @@
 #include <common.h>
 
 #if defined(CONFIG_CMD_NAND) && !defined(CONFIG_NAND_LEGACY) && \
-	(defined(CONFIG_440EP) || defined(CONFIG_440GR) ||	     \
-	 defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||	     \
-	 defined(CONFIG_405EZ) || defined(CONFIG_405EX) ||	     \
-	 defined(CONFIG_460EX) || defined(CONFIG_460GT))
+    defined(CONFIG_NAND_NDFC)
 
 #include <nand.h>
 #include <linux/mtd/ndfc.h>
include/ppc4xx.h +7 -0
index f147885..55ff323 100644
@@ -46,6 +46,13 @@
 #define CONFIG_SDRAM_PPC4xx_IBM_DDR2	/* IBM DDR(2) controller */
 #endif
 
+#if defined(CONFIG_440EP) || defined(CONFIG_440GR) ||	\
+    defined(CONFIG_440EPX) || defined(CONFIG_440GRX) ||	\
+    defined(CONFIG_405EZ) || defined(CONFIG_405EX) ||	\
+    defined(CONFIG_460EX) || defined(CONFIG_460GT)
+#define CONFIG_NAND_NDFC
+#endif
+
 /* PLB4 CrossBar Arbiter Core supported across PPC4xx families */
 #if defined(CONFIG_405EX) || \
     defined(CONFIG_440EP) || defined(CONFIG_440EPX) || \
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 2/3 ppc4xx: Fix problem with ECC ordering for PPC4xx NDFC platforms

This patch now uses the correct ECC byte order (Smart Media - SMC) to be used on the 4xx NAND FLASH driver. Without this patch we have incompatible ECC byte ordering to the Linux kernel NDFC driver.

Please note that we also have to enable CONFIG_MTD_NAND_ECC_SMC in drivers/mtd/nand/nand_ecc.c for correct operation. This is done with a seperate patch.

---
 cpu/ppc4xx/ndfc.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
cpu/ppc4xx/ndfc.c +2 -2
index ba481ad..971e2ae 100644
@@ -93,8 +93,8 @@ static int ndfc_calculate_ecc(struct mtd_info *mtdinfo,
 
 	/* The NDFC uses Smart Media (SMC) bytes order
 	 */
-	ecc_code[0] = p[1];
-	ecc_code[1] = p[2];
+	ecc_code[0] = p[2];
+	ecc_code[1] = p[1];
 	ecc_code[2] = p[3];
 
 	return 0;
Signature · 1 line
1.6.2.5
#2 lore raw

PATCH 3/3 nand: Fix problem with ECC ordering for PPC4xx NDFC platforms

In reply to Stefan Roese

This patch enables Smart Media (SMC) ECC byte ordering which is used on the PPC4xx NAND FLASH controller (NDFC). Without this patch we have incompatible ECC byte ordering to the Linux kernel NDFC driver.

---
 drivers/mtd/nand/nand_ecc.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/mtd/nand/nand_ecc.c +5 -0
index 94923b9..463f9cb 100644
@@ -48,6 +48,11 @@
 #include <asm/errno.h>
 #include <linux/mtd/mtd.h>
 
+/* The PPC4xx NDFC uses Smart Media (SMC) bytes order */
+#ifdef CONFIG_NAND_NDFC
+#define CONFIG_MTD_NAND_ECC_SMC
+#endif
+
 /*
  * NAND-SPL has no sofware ECC for now, so don't include nand_calculate_ecc(),
  * only nand_correct_data() is needed
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH 1/3 ppc4xx: Move definition for PPC4xx NAND FLASH controller to header

In reply to Stefan Roese
Quoted 4 lines · Stefan Roese

This patch moves the definition for the PPC4xx NAND FLASH controller (NDFC) CONFIG_NAND_NDFC into include/ppc4xx.h. This is needed for the upcoming fix for the ECC byte ordering of the NDFC driver.

Quoted 8 lines

---
Scott, please review this patchset. It fixes a problem with the 4xx NDFC and it's compatibility with the Linux driver. I would really like to get this into this 2009-06 release. Since this patchset also touches a file in drivers/mtd/nand, how should we handle those patches? Should I push those patches (after your ACK) via my ppc4xx repository?

ACK 1-3

Though once we get kconfig, we should pull the ifdef out of the NAND code and have MTD_NAND_ECC_SMC be selected by NAND_NDFC.

-Scott

#4 lore raw

PATCH 1/3 ppc4xx: Move definition for PPC4xx NAND FLASH controller to header

Quoted 10 lines · On Wednesday 20 May 2009 20:52:19 Scott Wood wrote:
Quoted 5 lines

Scott, please review this patchset. It fixes a problem with the 4xx NDFC and it's compatibility with the Linux driver. I would really like to get this into this 2009-06 release. Since this patchset also touches a file in drivers/mtd/nand, how should we handle those patches? Should I push those patches (after your ACK) via my ppc4xx repository?

ACK 1-3

Though once we get kconfig, we should pull the ifdef out of the NAND code and have MTD_NAND_ECC_SMC be selected by NAND_NDFC.

Yes, I already thought about this too.

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================