Skip to contentSkip to conversation

omap3: allow slection of NAND GPMC settings based on board config

PATCH New Mike Rapoport 4 participants 6 messages Nov 11, 2009 – Nov 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
 cpu/arm_cortexa8/omap3/mem.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +16 -9
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 struct gpmc *gpmc_cfg;
 
 #if defined(CONFIG_CMD_NAND)
-static const 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
-};
+#define GPMC_NAND(PART)					\
+	static const u32 gpmc_nand[GPMC_MAX_REG] = {	\
+		PART##_GPMC_CONFIG1,			\
+		PART##_GPMC_CONFIG2,			\
+		PART##_GPMC_CONFIG3,			\
+		PART##_GPMC_CONFIG4,			\
+		PART##_GPMC_CONFIG5,			\
+		PART##_GPMC_CONFIG6, 0			\
+	};
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 #if defined(CONFIG_ENV_IS_IN_NAND)
 #define GPMC_CS 0
@@ -246,7 +253,7 @@ void gpmc_init(void)
 	sdelay(1000);
 
 #if defined(CONFIG_CMD_NAND)	/* CS 0 */
-	gpmc_config = gpmc_m_nand;
+	gpmc_config = gpmc_nand;
 
 	base = PISMO1_NAND_BASE;
 	size = PISMO1_NAND_SIZE;
Signature · 1 line
1.6.0.6
#1 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

Any comments on this?

Quoted 52 lines · Mike Rapoport

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
 cpu/arm_cortexa8/omap3/mem.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +16 -9
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 struct gpmc *gpmc_cfg;
 
 #if defined(CONFIG_CMD_NAND)
-static const 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
-};
+#define GPMC_NAND(PART)					\
+	static const u32 gpmc_nand[GPMC_MAX_REG] = {	\
+		PART##_GPMC_CONFIG1,			\
+		PART##_GPMC_CONFIG2,			\
+		PART##_GPMC_CONFIG3,			\
+		PART##_GPMC_CONFIG4,			\
+		PART##_GPMC_CONFIG5,			\
+		PART##_GPMC_CONFIG6, 0			\
+	};
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 #if defined(CONFIG_ENV_IS_IN_NAND)
 #define GPMC_CS 0
@@ -246,7 +253,7 @@ void gpmc_init(void)
 	sdelay(1000);
 
 #if defined(CONFIG_CMD_NAND)	/* CS 0 */
-	gpmc_config = gpmc_m_nand;
+	gpmc_config = gpmc_nand;
 
 	base = PISMO1_NAND_BASE;
 	size = PISMO1_NAND_SIZE;
Signature · 2 lines
Sincerely yours,
Mike.
#2 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

Quoted 2 lines · Mike Rapoport

Any comments on this?

This is a good idea but..

These defines are used in the TI codebase but it doesn't look like the samsung nand is used here.

As a test I removed the samsung defines
and reran MAKEALL arm.
No failures.
Also grepping the code shows that it isn't used.

Do you plan on using the samsung nand ?

If not, I think a better patch would be to remove the smnand defines.

Also I think the nand and onnand initialization could be generalized. You may want to look at that.

Thanks
Tom

Quoted 54 lines
Quoted 52 lines · Mike Rapoport

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
 cpu/arm_cortexa8/omap3/mem.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +16 -9
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 struct gpmc *gpmc_cfg;
 
 #if defined(CONFIG_CMD_NAND)
-static const 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
-};
+#define GPMC_NAND(PART)					\
+	static const u32 gpmc_nand[GPMC_MAX_REG] = {	\
+		PART##_GPMC_CONFIG1,			\
+		PART##_GPMC_CONFIG2,			\
+		PART##_GPMC_CONFIG3,			\
+		PART##_GPMC_CONFIG4,			\
+		PART##_GPMC_CONFIG5,			\
+		PART##_GPMC_CONFIG6, 0			\
+	};
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 #if defined(CONFIG_ENV_IS_IN_NAND)
 #define GPMC_CS 0
@@ -246,7 +253,7 @@ void gpmc_init(void)
 	sdelay(1000);
 
 #if defined(CONFIG_CMD_NAND)	/* CS 0 */
-	gpmc_config = gpmc_m_nand;
+	gpmc_config = gpmc_nand;
 
 	base = PISMO1_NAND_BASE;
 	size = PISMO1_NAND_SIZE;
#3 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

Quoted 9 lines · Tom
Quoted 2 lines · Mike Rapoport

Any comments on this?

This is a good idea but..

These defines are used in the TI codebase but it doesn't look like the samsung nand is used here.

Quoted 6 lines

As a test I removed the samsung defines
and reran MAKEALL arm.
No failures.
Also grepping the code shows that it isn't used.

Do you plan on using the samsung nand ?

That's why I enabled the choice between samsung and Micron parts :) The CM-T35 board I'm submitting uses the samsung NAND flashes

Quoted 68 lines

If not, I think a better patch ?would be to remove the smnand defines.

Also I think the nand and onnand initialization could be generalized. ?You may want to look at that.

Thanks
Tom

Quoted 47 lines
Quoted 46 lines · Mike Rapoport

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
?cpu/arm_cortexa8/omap3/mem.c | ? 25 ++++++++++++++++--------- ?1 files changed, 16 insertions(+), 9 deletions(-)

cpu/arm_cortexa8/omap3/mem.c +15 -8
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 ?struct gpmc *gpmc_cfg;
 
 ?#if defined(CONFIG_CMD_NAND)
-static const 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
-};
+#define GPMC_NAND(PART) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ?static const u32 gpmc_nand[GPMC_MAX_REG] = { ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG1, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG2, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG3, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG4, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG5, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG6, 0 ? ? ? ? ? ? ? ? ?\
+ ? ?};
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 ?#if defined(CONFIG_ENV_IS_IN_NAND)

?#define GPMC_CS 0

cpu/arm_cortexa8/omap3/mem.c +0 -0
@@ -246,7 +253,7 @@ void gpmc_init(void)
 ? ? ?sdelay(1000);
 
Quoted 7 lines
Quoted 6 lines

?#if defined(CONFIG_CMD_NAND) ? ? ? ?/* CS 0 */
- ? ?gpmc_config = gpmc_m_nand;
+ ? ?gpmc_config = gpmc_nand;

? ? ?base = PISMO1_NAND_BASE;
? ? ?size = PISMO1_NAND_SIZE;

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 2 lines
	Sincerely Yours,
		Mike.
#4 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

In reply to Tom
Quoted 9 lines · Tom
Quoted 2 lines · Mike Rapoport

Any comments on this?

This is a good idea but..

These defines are used in the TI codebase but it doesn't look like the samsung nand is used here.

Quoted 6 lines

As a test I removed the samsung defines
and reran MAKEALL arm.
No failures.
Also grepping the code shows that it isn't used.

Do you plan on using the samsung nand ?

SDP3430 uses Samsung NAND.

Quoted 2 lines

If not, I think a better patch ?would be to remove the smnand defines.

NAK.

Quoted 33 lines

Also I think the nand and onnand initialization could be generalized. ?You may want to look at that.

Thanks
Tom

Quoted 26 lines
Quoted 25 lines · Mike Rapoport

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
?cpu/arm_cortexa8/omap3/mem.c | ? 25 ++++++++++++++++--------- ?1 files changed, 16 insertions(+), 9 deletions(-)

cpu/arm_cortexa8/omap3/mem.c +0 -8
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 ?struct gpmc *gpmc_cfg;
 
 ?#if defined(CONFIG_CMD_NAND)
-static const 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
-};
Quoted 8 lines
Quoted 8 lines

cpu/arm_cortexa8/omap3/mem.c volatile unsigned int boot_flash_env_addr; · line 54

Quoted 8 lines
cpu/arm_cortexa8/omap3/mem.c +8 -0
+#define GPMC_NAND(PART) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? \
+ ? ?static const u32 gpmc_nand[GPMC_MAX_REG] = { ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG1, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG2, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG3, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG4, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG5, ? ? ? ? ? ? ? ? ? ?\
+ ? ? ? ? ? ?PART##_GPMC_CONFIG6, 0 ? ? ? ? ? ? ? ? ?\

This is completely unnecessary implementation IMHO, where required, the board files can register
their own NAND device timings on a need basis.
NOTE: timing values change based on L3 clk -> e..g 3630 means that ALL the above timing values
are invalid as L3 is at 200Mhz!

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
cpu/arm_cortexa8/omap3/mem.c +7 -0
+ ? ?};
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 ?#if defined(CONFIG_ENV_IS_IN_NAND)

?#define GPMC_CS 0

cpu/arm_cortexa8/omap3/mem.c +0 -0
@@ -246,7 +253,7 @@ void gpmc_init(void)
 ? ? ?sdelay(1000);
 
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines

?#if defined(CONFIG_CMD_NAND) ? ? ? ?/* CS 0 */
- ? ?gpmc_config = gpmc_m_nand;
+ ? ?gpmc_config = gpmc_nand;

? ? ?base = PISMO1_NAND_BASE;
? ? ?size = PISMO1_NAND_SIZE;

IMHO, NAK.
Regards,
Nishanth Menon

#5 lore raw

PATCH 1/1 omap3: allow slection of NAND GPMC settings based on board config

Quoted 59 lines · Nishanth Menon
Quoted 8 lines · Tom
Quoted 2 lines · Mike Rapoport

Any comments on this?

This is a good idea but..

These defines are used in the TI codebase but it doesn't look like the samsung nand is used here.

Quoted 6 lines

As a test I removed the samsung defines
and reran MAKEALL arm.
No failures.
Also grepping the code shows that it isn't used.

Do you plan on using the samsung nand ?

SDP3430 uses Samsung NAND.

Quoted 1 line

If not, I think a better patch would be to remove the smnand defines.

NAK.

Quoted 39 lines

Also I think the nand and onnand initialization could be generalized. You may want to look at that.

Thanks
Tom

Quoted 33 lines
Quoted 32 lines · Mike Rapoport

There are several presets for GPMC registers defined in include/asm-arm/arch-omap3/mem.h. Allow selection between SMNAND and M_NAND presets based on OMAP34XX_GPMC_NAND_<PART> defines

---
 cpu/arm_cortexa8/omap3/mem.c |   25 ++++++++++++++++---------
 1 files changed, 16 insertions(+), 9 deletions(-)
cpu/arm_cortexa8/omap3/mem.c +7 -8
index 8b8cd6d..2bd7e1c 100644
@@ -44,14 +44,21 @@ volatile unsigned int boot_flash_env_addr;
 struct gpmc *gpmc_cfg;
 
 #if defined(CONFIG_CMD_NAND)
-static const 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
-};
+#define GPMC_NAND(PART)                                     \
+    static const u32 gpmc_nand[GPMC_MAX_REG] = {    \
+            PART##_GPMC_CONFIG1,                    \
+            PART##_GPMC_CONFIG2,                    \
+            PART##_GPMC_CONFIG3,                    \
+            PART##_GPMC_CONFIG4,                    \
+            PART##_GPMC_CONFIG5,                    \
Quoted 9 lines
Quoted 1 line
Quoted 1 line

cpu/arm_cortexa8/omap3/mem.c volatile unsigned int boot_flash_env_addr; · line 54

Quoted 1 line
cpu/arm_cortexa8/omap3/mem.c +1 -0
+            PART##_GPMC_CONFIG6, 0                  \

This is completely unnecessary implementation IMHO, where required, the board files can register
their own NAND device timings on a need basis.
NOTE: timing values change based on L3 clk -> e..g 3630 means that ALL the above timing values
are invalid as L3 is at 200Mhz!

You are correct!
Not that this is a surprise :P

Agreeing with Nishanth..
Tom

Quoted 23 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
cpu/arm_cortexa8/omap3/mem.c +7 -0
+    };
+
+#ifdef OMAP34XX_GPMC_NAND_SMNAND
+GPMC_NAND(SMNAND)
+#else
+GPMC_NAND(M_NAND)
+#endif
 
 #if defined(CONFIG_ENV_IS_IN_NAND)
 #define GPMC_CS 0
@@ -246,7 +253,7 @@ void gpmc_init(void)
     sdelay(1000);
 
Quoted 6 lines
Quoted 6 lines

cpu/arm_cortexa8/omap3/mem.c void gpmc_init(void) · line 259

Quoted 6 lines
cpu/arm_cortexa8/omap3/mem.c +1 -1
 #if defined(CONFIG_CMD_NAND)        /* CS 0 */
-    gpmc_config = gpmc_m_nand;
+    gpmc_config = gpmc_nand;
 
     base = PISMO1_NAND_BASE;
     size = PISMO1_NAND_SIZE;

IMHO, NAK.
Regards,
Nishanth Menon