Patchwork [U-Boot,06/30] powerpc/km82xx: move SDRAM config to board config

login
register
mail settings
Submitter Valentin Longchamp
Date April 8, 2011, 2:23 p.m.
Message ID <08249e40b548fff1e636cecf980e11adabda14ac.1302272395.git.valentin.longchamp@keymile.com>
Download mbox | patch
Permalink /patch/90368/
State Changes Requested
Headers show

Comments

Valentin Longchamp - April 8, 2011, 2:23 p.m.
From: Holger Brunck <holger.brunck@keymile.com>

To be prepared for mgcoge3ne which has a different SDRAM on board.
The config was moved from generic code to board specific header.

Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
Acked-by: Heiko Schocher <hs@denx.de>
cc: Wolfgang Denk <wd@denx.de>
cc: Detlev Zundel <dzu@denx.de>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
---
 include/configs/km82xx-common.h |   26 --------------------------
 include/configs/mgcoge.h        |   26 ++++++++++++++++++++++++++
 include/configs/mgcoge2ne.h     |   23 +++++++++++++++++++++++
 3 files changed, 49 insertions(+), 26 deletions(-)
Wolfgang Denk - April 30, 2011, 7:56 a.m.
Dear Valentin Longchamp,

In message <08249e40b548fff1e636cecf980e11adabda14ac.1302272395.git.valentin.longchamp@keymile.com> you wrote:
> From: Holger Brunck <holger.brunck@keymile.com>
> 
> To be prepared for mgcoge3ne which has a different SDRAM on board.
> The config was moved from generic code to board specific header.
> 
> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
> Acked-by: Heiko Schocher <hs@denx.de>
> cc: Wolfgang Denk <wd@denx.de>
> cc: Detlev Zundel <dzu@denx.de>
> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> ---
>  include/configs/km82xx-common.h |   26 --------------------------
>  include/configs/mgcoge.h        |   26 ++++++++++++++++++++++++++
>  include/configs/mgcoge2ne.h     |   23 +++++++++++++++++++++++
>  3 files changed, 49 insertions(+), 26 deletions(-)

If I'm understanding this right, we now duplicate the definitions into
two files, because two boards happen to use the same SDRAM.  Would it
not make more sense to move this into a single copy of a SDRAM
specific header, which then gets included by all boards that use this
SDRAM type?  This way we can avoid multiple copied of the same stuff
(which always is a maintenance nightmare) for popular RAM types.

Best regards,

Wolfgang Denk
Holger Brunck - May 2, 2011, 8:04 a.m.
Hello,

On 04/30/2011 09:56 AM, Wolfgang Denk wrote:
> Dear Valentin Longchamp,
> 
> In message <08249e40b548fff1e636cecf980e11adabda14ac.1302272395.git.valentin.longchamp@keymile.com> you wrote:
>> From: Holger Brunck <holger.brunck@keymile.com>
>>
>> To be prepared for mgcoge3ne which has a different SDRAM on board.
>> The config was moved from generic code to board specific header.
>>
>> Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
>> Acked-by: Heiko Schocher <hs@denx.de>
>> cc: Wolfgang Denk <wd@denx.de>
>> cc: Detlev Zundel <dzu@denx.de>
>> cc: Valentin Longchamp <valentin.longchamp@keymile.com>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
>> ---
>>  include/configs/km82xx-common.h |   26 --------------------------
>>  include/configs/mgcoge.h        |   26 ++++++++++++++++++++++++++
>>  include/configs/mgcoge2ne.h     |   23 +++++++++++++++++++++++
>>  3 files changed, 49 insertions(+), 26 deletions(-)
> 
> If I'm understanding this right, we now duplicate the definitions into
> two files, because two boards happen to use the same SDRAM.  Would it

Yes.

> not make more sense to move this into a single copy of a SDRAM
> specific header, which then gets included by all boards that use this
> SDRAM type?  This way we can avoid multiple copied of the same stuff
> (which always is a maintenance nightmare) for popular RAM types.
> 

Yes this sounds reasonable. But later on in the patch serie we replace the
mgcoge2ne support with the support for mgcoge3ne which has a different SDRAM.
And therefore this common file would become obsolete. I try to rebase these
patches that the mgcoge3ne support is also part of this patch.

BTW: What would your proposal for a filename for a SDRAM specific header?

Best regards
Holger Brunck
Wolfgang Denk - May 2, 2011, 8:39 a.m.
Dear Holger Brunck,

In message <4DBE659D.3040208@keymile.com> you wrote:
> 
> BTW: What would your proposal for a filename for a SDRAM specific header?

Name it after the SDRAM chip type?

I think we should create a directory hierarchy for this:

	chips/sdram/
	chips/ddr/
	chips/ddr2/
	chips/ddr3/

We already have a few of such files - but this shows also how it
should NOT be done (because we have here lots of duplicated files
again):

	-> find * -name 'mt4*'
	board/canmb/mt48lc16m32s2-75.h
	board/esd/cpci5200/mt46v16m16-75.h
	board/esd/pf5200/mt46v16m16-75.h
	board/esd/mecp5200/mt46v16m16-75.h
	board/a4m072/mt46v32m16.h
	board/icecube/mt46v16m16-75.h
	board/icecube/mt46v32m16.h
	board/icecube/mt48lc16m16a2-75.h
	board/inka4x0/mt46v16m16-75.h
	board/inka4x0/mt46v32m16-75.h
	board/inka4x0/mt48lc16m16a2-75.h
	board/bc3450/mt48lc16m16a2-75.h
	board/pm520/mt46v16m16-75.h
	board/pm520/mt48lc16m16a2-75.h
	board/total5200/mt48lc16m16a2-75.h
	board/total5200/mt48lc32m16a2-75.h
	board/mcc200/mt48lc8m32b2-6-7.h
	board/mcc200/mt46v16m16-75.h
	board/mcc200/mt48lc16m16a2-75.h
	board/mcc200/mt48lc16m32s2-75.h
	board/munices/mt48lc16m16a2-75.h
	board/phytec/pcm030/mt46v32m16-75.h
	board/tqc/tqm5200/mt48lc16m16a2-75.h

Eventually this is the start of a bigger cleanup action then :-)

Best regards,

Wolfgang Denk

Patch

diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h
index 345212c..da551c9 100644
--- a/include/configs/km82xx-common.h
+++ b/include/configs/km82xx-common.h
@@ -243,13 +243,6 @@ 
 			 ORxG_SCY_5_CLK			|\
 			 ORxG_TRLX)
 
-
-/*
- * Bank 1 - 60x bus SDRAM
- */
-#define SDRAM_MAX_SIZE	0x08000000	/* max. 128 MB		*/
-#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT	(256 << 20)	/* less than 256 MB */
-
 #define CONFIG_SYS_MPTPR       0x1800
 
 /*
@@ -268,25 +261,6 @@ 
 #define CONFIG_SYS_OR1_PRELIM	CONFIG_SYS_OR1
 
 /*
- *  SDRAM initialization values
- */
-
-#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & ORxS_SDAM_MSK) |\
-			 ORxS_BPD_8			|\
-			 ORxS_ROWST_PBI0_A7		|\
-			 ORxS_NUMR_13)
-
-#define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5	|\
-			 PSDMR_BSMA_A14_A16	|\
-			 PSDMR_SDA10_PBI0_A9	|\
-			 PSDMR_RFRC_5_CLK	|\
-			 PSDMR_PRETOACT_2W	|\
-			 PSDMR_ACTTORW_2W	|\
-			 PSDMR_LDOTOPRE_1C	|\
-			 PSDMR_WRC_1C		|\
-			 PSDMR_CL_2)
-
-/*
  * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values
  */
 #define CONFIG_SYS_KMBEC_FPGA_BASE	0x30000000
diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h
index 3d2ee24..aed1526 100644
--- a/include/configs/mgcoge.h
+++ b/include/configs/mgcoge.h
@@ -58,6 +58,32 @@ 
 					CONFIG_SYS_FLASH_BASE_2 }
 #define MTDIDS_DEFAULT		"nor3=app"
 
+/*
+ * Bank 1 - 60x bus SDRAM
+ */
+#define SDRAM_MAX_SIZE	0x08000000			/* max. 128 MB	*/
+#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT	(256 << 20)	/* less than 256 MB */
+
+/* SDRAM initialization values
+*/
+
+#define CONFIG_SYS_OR1    ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
+			 ORxS_SDAM_MSK) |\
+			 ORxS_BPD_8                     |\
+			 ORxS_ROWST_PBI0_A7		|\
+			 ORxS_NUMR_13)
+
+#define CONFIG_SYS_PSDMR  (PSDMR_SDAM_A14_IS_A5 |\
+			 PSDMR_BSMA_A14_A16           |\
+			 PSDMR_SDA10_PBI0_A9		|\
+			 PSDMR_RFRC_5_CLK               |\
+			 PSDMR_PRETOACT_2W              |\
+			 PSDMR_ACTTORW_2W               |\
+			 PSDMR_LDOTOPRE_1C              |\
+			 PSDMR_WRC_1C                   |\
+			 PSDMR_CL_2)
+
+
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"
 
diff --git a/include/configs/mgcoge2ne.h b/include/configs/mgcoge2ne.h
index 287b717..2b09b42 100644
--- a/include/configs/mgcoge2ne.h
+++ b/include/configs/mgcoge2ne.h
@@ -58,6 +58,29 @@ 
 
 #define MTDIDS_DEFAULT		"nor2=app"
 
+/*
+ * Bank 1 - 60x bus SDRAM
+ * mgcoge2ne has 128M RAM
+ */
+#define SDRAM_MAX_SIZE	0x08000000			/* max. 128 MB	*/
+#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT	(256 << 20)	/* less than 256 MB */
+
+#define CONFIG_SYS_OR1    ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \
+			 ORxS_SDAM_MSK) |\
+			 ORxS_BPD_8                     |\
+			 ORxS_ROWST_PBI0_A7		|\
+			 ORxS_NUMR_13)
+
+#define CONFIG_SYS_PSDMR  (PSDMR_SDAM_A14_IS_A5 |\
+			 PSDMR_BSMA_A14_A16           |\
+			 PSDMR_SDA10_PBI0_A9		|\
+			 PSDMR_RFRC_5_CLK               |\
+			 PSDMR_PRETOACT_2W              |\
+			 PSDMR_ACTTORW_2W               |\
+			 PSDMR_LDOTOPRE_1C              |\
+			 PSDMR_WRC_1C                   |\
+			 PSDMR_CL_2)
+
 /* include further common stuff for all keymile 82xx boards */
 #include "km82xx-common.h"