[U-Boot] [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.
Signed-off-by: Stefan Roese sr@denx.de Cc: Scott Wood scottwood@freescale.com --- 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(-)
diff --git a/cpu/ppc4xx/ndfc.c b/cpu/ppc4xx/ndfc.c index 3a5af12..ba481ad 100644 --- a/cpu/ppc4xx/ndfc.c +++ b/cpu/ppc4xx/ndfc.c @@ -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@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> diff --git a/include/ppc4xx.h b/include/ppc4xx.h index f147885..55ff323 100644 --- a/include/ppc4xx.h +++ b/include/ppc4xx.h @@ -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) || \

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.
Signed-off-by: Stefan Roese sr@denx.de Cc: Scott Wood scottwood@freescale.com --- cpu/ppc4xx/ndfc.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/cpu/ppc4xx/ndfc.c b/cpu/ppc4xx/ndfc.c index ba481ad..971e2ae 100644 --- a/cpu/ppc4xx/ndfc.c +++ b/cpu/ppc4xx/ndfc.c @@ -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;

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.
Signed-off-by: Stefan Roese sr@denx.de Cc: Scott Wood scottwood@freescale.com --- drivers/mtd/nand/nand_ecc.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c index 94923b9..463f9cb 100644 --- a/drivers/mtd/nand/nand_ecc.c +++ b/drivers/mtd/nand/nand_ecc.c @@ -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

Stefan Roese wrote:
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.
Signed-off-by: Stefan Roese sr@denx.de Cc: Scott Wood scottwood@freescale.com
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

On Wednesday 20 May 2009 20:52:19 Scott Wood wrote:
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@denx.de =====================================================================
participants (2)
-
Scott Wood
-
Stefan Roese