Skip to contentSkip to conversation

OMAP3:NAND: Cleanup patchset

PATCH New Nishanth Menon 2 participants 7 messages Apr 13, 2009 – Apr 17, 2009

lore
Share & tools
lore
#0 lore raw

cover OMAP3:NAND: Cleanup patchset

Hi,
The following patch series provides cleanup for making OMAP3 NAND support more generic. This consists of:
a) OMAP3:NAND: Change the NAND timing assignment
b) OMAP3:NAND: Change the NAND CS handling
c) OMAP3:NAND: rename SMNAND_ENV_OFFSET

Regards,
Nishanth Menon

#1 lore raw

PATCH 1/3 OMAP3:NAND: Change the NAND timing assignment

NAND timing is defaulted to Micron NAND. To support varied boards, this is not scalable.
This patch introduces compile time option to select the timing to select at the same time allows platforms to build with custom timing params

---
 cpu/arm_cortexa8/omap3/mem.c     |   12 ++++++------
 include/asm-arm/arch-omap3/mem.h |   38 +++++++++++++++++++++++---------------
 include/configs/omap3_beagle.h   |    1 +
 include/configs/omap3_overo.h    |    1 +
 include/configs/omap3_pandora.h  |    1 +
 include/configs/omap3_zoom1.h    |    1 +
 6 files changed, 33 insertions(+), 21 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +6 -6
index 3cc22c4..14cd87d 100644
@@ -43,12 +43,12 @@ volatile unsigned int boot_flash_env_addr;
 
 #if defined(CONFIG_CMD_NAND)
 static u32 gpmc_m_nand[GPMC_MAX_REG] = {
-	M_NAND_GPMC_CONFIG1,
-	M_NAND_GPMC_CONFIG2,
-	M_NAND_GPMC_CONFIG3,
-	M_NAND_GPMC_CONFIG4,
-	M_NAND_GPMC_CONFIG5,
-	M_NAND_GPMC_CONFIG6, 0
+	NAND_GPMC_CONFIG1,
+	NAND_GPMC_CONFIG2,
+	NAND_GPMC_CONFIG3,
+	NAND_GPMC_CONFIG4,
+	NAND_GPMC_CONFIG5,
+	NAND_GPMC_CONFIG6, 0
 };
 
 gpmc_csx_t *nand_cs_base;
include/asm-arm/arch-omap3/mem.h +23 -15
index 6f0f90b..622578e 100644
@@ -137,21 +137,29 @@ typedef enum {
 #define GPMC_SIZE_32M	0xE
 #define GPMC_SIZE_16M	0xF
 
-#define SMNAND_GPMC_CONFIG1	0x00000800
-#define SMNAND_GPMC_CONFIG2	0x00141400
-#define SMNAND_GPMC_CONFIG3	0x00141400
-#define SMNAND_GPMC_CONFIG4	0x0F010F01
-#define SMNAND_GPMC_CONFIG5	0x010C1414
-#define SMNAND_GPMC_CONFIG6	0x1F0F0A80
-#define SMNAND_GPMC_CONFIG7	0x00000C44
-
-#define M_NAND_GPMC_CONFIG1	0x00001800
-#define M_NAND_GPMC_CONFIG2	0x00141400
-#define M_NAND_GPMC_CONFIG3	0x00141400
-#define M_NAND_GPMC_CONFIG4	0x0F010F01
-#define M_NAND_GPMC_CONFIG5	0x010C1414
-#define M_NAND_GPMC_CONFIG6	0x1f0f0A80
-#define M_NAND_GPMC_CONFIG7	0x00000C44
+/*
+ * Standard OMAP3 NAND device definitions
+ * Define SMNAND_GPMC or M_NAND_GPMC to use the defaults
+ * if your board has a specific timing (such as optimized timing),
+ * define NAND_GPMC_CONFIG1 to 7
+ */
+#ifdef SMNAND_GPMC
+#define NAND_GPMC_CONFIG1	0x00000800
+#define NAND_GPMC_CONFIG2	0x00141400
+#define NAND_GPMC_CONFIG3	0x00141400
+#define NAND_GPMC_CONFIG4	0x0F010F01
+#define NAND_GPMC_CONFIG5	0x010C1414
+#define NAND_GPMC_CONFIG6	0x1F0F0A80
+#define NAND_GPMC_CONFIG7	0x00000C44
+#elif defined(M_NAND_GPMC)
+#define NAND_GPMC_CONFIG1	0x00001800
+#define NAND_GPMC_CONFIG2	0x00141400
+#define NAND_GPMC_CONFIG3	0x00141400
+#define NAND_GPMC_CONFIG4	0x0F010F01
+#define NAND_GPMC_CONFIG5	0x010C1414
+#define NAND_GPMC_CONFIG6	0x1f0f0A80
+#define NAND_GPMC_CONFIG7	0x00000C44
+#endif
 
 #define STNOR_GPMC_CONFIG1	0x3
 #define STNOR_GPMC_CONFIG2	0x00151501
include/configs/omap3_beagle.h +1 -0
index 5a948e4..3f47b7a 100644
@@ -126,6 +126,7 @@
  * Board NAND Info.
  */
 #define CONFIG_NAND_OMAP_GPMC
+#define M_NAND_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
 							/* to access nand */
 #define CONFIG_SYS_NAND_BASE		NAND_BASE	/* physical address */
include/configs/omap3_overo.h +1 -0
index 51b04b6..093f922 100644
@@ -113,6 +113,7 @@
  * Board NAND Info.
  */
 #define CONFIG_NAND_OMAP_GPMC
+#define M_NAND_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
 							/* to access nand */
 #define CONFIG_SYS_NAND_BASE		NAND_BASE	/* physical address */
include/configs/omap3_pandora.h +1 -0
index 40107a6..7c3d2f0 100644
@@ -116,6 +116,7 @@
  * Board NAND Info.
  */
 #define CONFIG_NAND_OMAP_GPMC
+#define M_NAND_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
 							/* to access nand */
 #define CONFIG_SYS_NAND_BASE		NAND_BASE	/* physical address */
include/configs/omap3_zoom1.h +1 -0
index 8e984b4..794ad96 100644
@@ -123,6 +123,7 @@
  * Board NAND Info.
  */
 #define CONFIG_NAND_OMAP_GPMC
+#define M_NAND_GPMC
 #define CONFIG_SYS_NAND_ADDR		NAND_BASE	/* physical address */
 							/* to access nand */
 #define CONFIG_SYS_NAND_BASE		NAND_BASE	/* physical address */
Signature · 1 line
1.5.4.3
#2 lore raw

PATCH 2/3 OMAP3:NAND: Change the NAND CS handling

NAND CS is assumed to be CS0 while we could have
choice b/w 0 to 7. This patch enables board files
to handle varied CS on a need basis.

---
 cpu/arm_cortexa8/omap3/mem.c     |    8 +-------
 include/asm-arm/arch-omap3/mem.h |    8 ++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +1 -7
index 14cd87d..9c90f32 100644
@@ -54,12 +54,6 @@ static u32 gpmc_m_nand[GPMC_MAX_REG] = {
 gpmc_csx_t *nand_cs_base;
 gpmc_t *gpmc_cfg_base;
 
-#if defined(CONFIG_ENV_IS_IN_NAND)
-#define GPMC_CS 0
-#else
-#define GPMC_CS 1
-#endif
-
 #endif
 
 #if defined(CONFIG_CMD_ONENAND)
@@ -249,7 +243,7 @@ void gpmc_init(void)
 	gpmc_config = gpmc_m_nand;
 	gpmc_cfg_base = gpmc_base;
 	nand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
-					(GPMC_CS * GPMC_CONFIG_WIDTH));
+					(NAND_GPMC_CS * GPMC_CONFIG_WIDTH));
 	base = PISMO1_NAND_BASE;
 	size = PISMO1_NAND_SIZE;
 	enable_gpmc_config(gpmc_config, nand_cs_base, base, size);
include/asm-arm/arch-omap3/mem.h +8 -0
index 622578e..1c4abe7 100644
@@ -216,6 +216,14 @@ typedef enum {
 /* max number of GPMC regs */
 #define GPMC_MAX_REG	7
 
+#if defined(CONFIG_ENV_IS_IN_NAND)
+#define NAND_GPMC_CS 0
+#else
+#ifndef NAND_GPMC_CS
+#define NAND_GPMC_CS 1
+#endif		/* NAND_GPMC_CS */
+#endif		/* CONFIG_ENV_IS_IN_NAND */
+
 #define PISMO1_NOR	1
 #define PISMO1_NAND	2
 #define PISMO2_CS0	3
Signature · 1 line
1.5.4.3
#3 lore raw

PATCH 3/3 OMAP3:NAND: rename SMNAND_ENV_OFFSET

SMNAND_ENV_OFFSET is more specific to Samsung
NAND, rename it to NAND_ENV_OFFSET

---
 cpu/arm_cortexa8/omap3/mem.c    |    2 +-
 include/configs/omap3_beagle.h  |    4 ++--
 include/configs/omap3_evm.h     |    2 +-
 include/configs/omap3_overo.h   |    4 ++--
 include/configs/omap3_pandora.h |    4 ++--
 include/configs/omap3_zoom1.h   |    4 ++--
 6 files changed, 10 insertions(+), 10 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +1 -1
index 9c90f32..ac126fd 100644
@@ -248,7 +248,7 @@ void gpmc_init(void)
 	size = PISMO1_NAND_SIZE;
 	enable_gpmc_config(gpmc_config, nand_cs_base, base, size);
 #if defined(CONFIG_ENV_IS_IN_NAND)
-	f_off = SMNAND_ENV_OFFSET;
+	f_off = NAND_ENV_OFFSET;
 	f_sec = SZ_128K;
 	/* env setup */
 	boot_flash_base = base;
include/configs/omap3_beagle.h +2 -2
index 3f47b7a..30b2cfd 100644
@@ -276,11 +276,11 @@
 
 #define CONFIG_ENV_IS_IN_NAND		1
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
-#define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
+#define NAND_ENV_OFFSET			0x260000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
 #define CONFIG_ENV_OFFSET		boot_flash_off
-#define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
+#define CONFIG_ENV_ADDR			NAND_ENV_OFFSET
 
 /*-----------------------------------------------------------------------
  * CFI FLASH driver setup
include/configs/omap3_evm.h +1 -1
index 8cd8a1b..c33d981 100644
@@ -268,7 +268,7 @@
 
 #define CONFIG_ENV_IS_IN_ONENAND	1
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
-#define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
+#define NAND_ENV_OFFSET			0x260000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
 #define CONFIG_ENV_OFFSET		boot_flash_off
include/configs/omap3_overo.h +2 -2
index 093f922..259b864 100644
@@ -263,11 +263,11 @@
 
 #define CONFIG_ENV_IS_IN_NAND		1
 #define ONENAND_ENV_OFFSET		0x240000 /* environment starts here */
-#define SMNAND_ENV_OFFSET		0x240000 /* environment starts here */
+#define NAND_ENV_OFFSET			0x240000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
 #define CONFIG_ENV_OFFSET		boot_flash_off
-#define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
+#define CONFIG_ENV_ADDR			NAND_ENV_OFFSET
 
 /*-----------------------------------------------------------------------
  * CFI FLASH driver setup
include/configs/omap3_pandora.h +2 -2
index 7c3d2f0..7deecb7 100644
@@ -265,11 +265,11 @@
 
 #define CONFIG_ENV_IS_IN_NAND		1
 #define ONENAND_ENV_OFFSET		0x240000 /* environment starts here */
-#define SMNAND_ENV_OFFSET		0x240000 /* environment starts here */
+#define NAND_ENV_OFFSET			0x240000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
 #define CONFIG_ENV_OFFSET		boot_flash_off
-#define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
+#define CONFIG_ENV_ADDR			NAND_ENV_OFFSET
 
 /*-----------------------------------------------------------------------
  * CFI FLASH driver setup
include/configs/omap3_zoom1.h +2 -2
index 794ad96..34e6868 100644
@@ -273,11 +273,11 @@
 
 #define CONFIG_ENV_IS_IN_NAND		1
 #define ONENAND_ENV_OFFSET		0x260000 /* environment starts here */
-#define SMNAND_ENV_OFFSET		0x260000 /* environment starts here */
+#define NAND_ENV_OFFSET			0x260000 /* environment starts here */
 
 #define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
 #define CONFIG_ENV_OFFSET		boot_flash_off
-#define CONFIG_ENV_ADDR			SMNAND_ENV_OFFSET
+#define CONFIG_ENV_ADDR			NAND_ENV_OFFSET
 
 /*-----------------------------------------------------------------------
  * CFI FLASH driver setup
Signature · 1 line
1.5.4.3
#4 lore raw

PATCH 3/3 OMAP3:NAND: rename SMNAND_ENV_OFFSET

Quoted 3 lines · Nishanth Menon

SMNAND_ENV_OFFSET is more specific to Samsung
NAND, rename it to NAND_ENV_OFFSET

CONFIG_ENV_NAND_OFFSET or something simillar will be beter

Best Regards,
J.

#5 lore raw

PATCH 2/3 OMAP3:NAND: Change the NAND CS handling

In reply to Nishanth Menon
Quoted 41 lines · Nishanth Menon

NAND CS is assumed to be CS0 while we could have
choice b/w 0 to 7. This patch enables board files
to handle varied CS on a need basis.

---
 cpu/arm_cortexa8/omap3/mem.c     |    8 +-------
 include/asm-arm/arch-omap3/mem.h |    8 ++++++++
 2 files changed, 9 insertions(+), 7 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +1 -7
index 14cd87d..9c90f32 100644
@@ -54,12 +54,6 @@ static u32 gpmc_m_nand[GPMC_MAX_REG] = {
 gpmc_csx_t *nand_cs_base;
 gpmc_t *gpmc_cfg_base;
 
-#if defined(CONFIG_ENV_IS_IN_NAND)
-#define GPMC_CS 0
-#else
-#define GPMC_CS 1
-#endif
-
 #endif
 
 #if defined(CONFIG_CMD_ONENAND)
@@ -249,7 +243,7 @@ void gpmc_init(void)
 	gpmc_config = gpmc_m_nand;
 	gpmc_cfg_base = gpmc_base;
 	nand_cs_base = (gpmc_csx_t *)(GPMC_CONFIG_CS0_BASE +
-					(GPMC_CS * GPMC_CONFIG_WIDTH));
+					(NAND_GPMC_CS * GPMC_CONFIG_WIDTH));
 	base = PISMO1_NAND_BASE;
 	size = PISMO1_NAND_SIZE;
 	enable_gpmc_config(gpmc_config, nand_cs_base, base, size);
include/asm-arm/arch-omap3/mem.h +0 -0
index 622578e..1c4abe7 100644

include/asm-arm/arch-omap3/mem.h typedef enum { · line 220

Quoted 5 lines
include/asm-arm/arch-omap3/mem.h +2 -0
@@ -216,6 +216,14 @@ typedef enum {
 /* max number of GPMC regs */
 #define GPMC_MAX_REG	7
 
+#if defined(CONFIG_ENV_IS_IN_NAND)
+#define NAND_GPMC_CS 0

please use CONFIG_SYS_

Best Regards,
J.

#6 lore raw

PATCH 1/3 OMAP3:NAND: Change the NAND timing assignment

In reply to Nishanth Menon
Quoted 66 lines · Nishanth Menon

NAND timing is defaulted to Micron NAND. To support varied boards, this is not scalable.
This patch introduces compile time option to select the timing to select at the same time allows platforms to build with custom timing params

---
 cpu/arm_cortexa8/omap3/mem.c     |   12 ++++++------
 include/asm-arm/arch-omap3/mem.h |   38 +++++++++++++++++++++++---------------
 include/configs/omap3_beagle.h   |    1 +
 include/configs/omap3_overo.h    |    1 +
 include/configs/omap3_pandora.h  |    1 +
 include/configs/omap3_zoom1.h    |    1 +
 6 files changed, 33 insertions(+), 21 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +6 -6
index 3cc22c4..14cd87d 100644
@@ -43,12 +43,12 @@ volatile unsigned int boot_flash_env_addr;
 
 #if defined(CONFIG_CMD_NAND)
 static u32 gpmc_m_nand[GPMC_MAX_REG] = {
-	M_NAND_GPMC_CONFIG1,
-	M_NAND_GPMC_CONFIG2,
-	M_NAND_GPMC_CONFIG3,
-	M_NAND_GPMC_CONFIG4,
-	M_NAND_GPMC_CONFIG5,
-	M_NAND_GPMC_CONFIG6, 0
+	NAND_GPMC_CONFIG1,
+	NAND_GPMC_CONFIG2,
+	NAND_GPMC_CONFIG3,
+	NAND_GPMC_CONFIG4,
+	NAND_GPMC_CONFIG5,
+	NAND_GPMC_CONFIG6, 0
 };
 
 gpmc_csx_t *nand_cs_base;
include/asm-arm/arch-omap3/mem.h +4 -15
index 6f0f90b..622578e 100644
@@ -137,21 +137,29 @@ typedef enum {
 #define GPMC_SIZE_32M	0xE
 #define GPMC_SIZE_16M	0xF
 
-#define SMNAND_GPMC_CONFIG1	0x00000800
-#define SMNAND_GPMC_CONFIG2	0x00141400
-#define SMNAND_GPMC_CONFIG3	0x00141400
-#define SMNAND_GPMC_CONFIG4	0x0F010F01
-#define SMNAND_GPMC_CONFIG5	0x010C1414
-#define SMNAND_GPMC_CONFIG6	0x1F0F0A80
-#define SMNAND_GPMC_CONFIG7	0x00000C44
-
-#define M_NAND_GPMC_CONFIG1	0x00001800
-#define M_NAND_GPMC_CONFIG2	0x00141400
-#define M_NAND_GPMC_CONFIG3	0x00141400
-#define M_NAND_GPMC_CONFIG4	0x0F010F01
-#define M_NAND_GPMC_CONFIG5	0x010C1414
-#define M_NAND_GPMC_CONFIG6	0x1f0f0A80
-#define M_NAND_GPMC_CONFIG7	0x00000C44
+/*
+ * Standard OMAP3 NAND device definitions
+ * Define SMNAND_GPMC or M_NAND_GPMC to use the defaults
+ * if your board has a specific timing (such as optimized timing),

include/asm-arm/arch-omap3/mem.h typedef enum { · line 153

Quoted 10 lines
include/asm-arm/arch-omap3/mem.h +10 -0
+ * define NAND_GPMC_CONFIG1 to 7
+ */
+#ifdef SMNAND_GPMC
+#define NAND_GPMC_CONFIG1	0x00000800
+#define NAND_GPMC_CONFIG2	0x00141400
+#define NAND_GPMC_CONFIG3	0x00141400
+#define NAND_GPMC_CONFIG4	0x0F010F01
+#define NAND_GPMC_CONFIG5	0x010C1414
+#define NAND_GPMC_CONFIG6	0x1F0F0A80
+#define NAND_GPMC_CONFIG7	0x00000C44

is it possible to use macro insteas of hardcode value?

Best Regards,
J.