Skip to contentSkip to conversation

integratorap: fixup SDRAM memory size detection

PATCH New Linus Walleij 3 participants 3 messages Jul 13, 2011 – Jul 14, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 integratorap: fixup SDRAM memory size detection

This fixes up the SDRAM memory detection code to work with the latest relocation code, moves it all into dram_init() and activates memory size detection for the Integrator AP.

---
 board/armltd/integrator/integrator.c |   17 +++++++----------
 include/configs/integratorap.h       |    2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)
board/armltd/integrator/integrator.c +7 -10
index a0d8de7..931a916 100644
@@ -86,17 +86,9 @@ int misc_init_r (void)
 	return (0);
 }
 
-void dram_init_banksize(void)
-{
-	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
-        gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
-}
-
 int dram_init (void)
 {
-	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
-				    PHYS_SDRAM_1_SIZE);
-
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
 #ifdef CONFIG_CM_SPD_DETECT
 	{
 extern void dram_query(void);
@@ -120,8 +112,13 @@ extern void dram_query(void);
 	 */
 	sdram_shift		 = ((cm_reg_sdram & 0x0000001C)/4)%4;
 	gd->bd->bi_dram[0].size	 = 0x01000000 << sdram_shift;
-
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    0x01000000 << sdram_shift);
 	}
+#else
+        gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    PHYS_SDRAM_1_SIZE);
 #endif /* CM_SPD_DETECT */
 
 	return 0;
include/configs/integratorap.h +1 -1
index acdb37c..d724c91 100644
@@ -47,7 +47,7 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_CM_INIT		1
 #define CONFIG_CM_REMAP		1
-#undef CONFIG_CM_SPD_DETECT
+#define CONFIG_CM_SPD_DETECT
 #define CONFIG_SYS_DCACHE_OFF
 
 /*
Signature · 1 line
1.7.6
#1 lore raw

PATCH 2/2 integratorap: fixup SDRAM memory size detection

Dear Linus Walleij,

Quoted 9 lines · In message <[email protected]> you…

This fixes up the SDRAM memory detection code to work with the latest relocation code, moves it all into dram_init() and activates memory size detection for the Integrator AP.

---
 board/armltd/integrator/integrator.c |   17 +++++++----------
 include/configs/integratorap.h       |    2 +-
 2 files changed, 8 insertions(+), 11 deletions(-)

...

board/armltd/integrator/integrator.c extern void dram_query(void); · line 121

Quoted 12 lines
board/armltd/integrator/integrator.c +6 -1
@@ -120,8 +112,13 @@ extern void dram_query(void);
 	 */
 	sdram_shift		 = ((cm_reg_sdram & 0x0000001C)/4)%4;
 	gd->bd->bi_dram[0].size	 = 0x01000000 << sdram_shift;
-
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    0x01000000 << sdram_shift);
 	}
+#else
+        gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    PHYS_SDRAM_1_SIZE);

Indentation by TAB only, please.

include/configs/integratorap.h line 51

Quoted 11 lines
include/configs/integratorap.h +1 -1
index acdb37c..d724c91 100644
@@ -47,7 +47,7 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_CM_INIT		1
 #define CONFIG_CM_REMAP		1
-#undef CONFIG_CM_SPD_DETECT
+#define CONFIG_CM_SPD_DETECT
 #define CONFIG_SYS_DCACHE_OFF

Are you sure this works for all affected boards?

Please also put the board maintainer on Cc: for all patches that affedt specific boards like here.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I find this a nice feature but it is not according to  the  documen-
tation. Or is it a BUG?"   "Let's call it an accidental feature. :-)"
                       - Larry Wall in <[email protected]>
#2 lore raw

PATCH 2/2 integratorap: fixup SDRAM memory size detection

In reply to Linus Walleij

Hello.

Quoted 34 lines · Linus Walleij

This fixes up the SDRAM memory detection code to work with the latest relocation code, moves it all into dram_init() and activates memory size detection for the Integrator AP.

---
  board/armltd/integrator/integrator.c |   17 +++++++----------
  include/configs/integratorap.h       |    2 +-
  2 files changed, 8 insertions(+), 11 deletions(-)
board/armltd/integrator/integrator.c +1 -9
index a0d8de7..931a916 100644
@@ -86,17 +86,9 @@ int misc_init_r (void)
  	return (0);
  }
 
-void dram_init_banksize(void)
-{
-	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
-        gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
-}
-
  int dram_init (void)
  {
-	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
-				    PHYS_SDRAM_1_SIZE);
-
+	gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
  #ifdef CONFIG_CM_SPD_DETECT
  	{
  extern void dram_query(void);

board/armltd/integrator/integrator.c extern void dram_query(void); · line 119

Quoted 9 lines
board/armltd/integrator/integrator.c +4 -1
@@ -120,8 +112,13 @@ extern void dram_query(void);
  	 */
  	sdram_shift		 = ((cm_reg_sdram&  0x0000001C)/4)%4;
  	gd->bd->bi_dram[0].size	 = 0x01000000<<  sdram_shift;
-
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    0x01000000<<  sdram_shift);
  	}
+#else
+        gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;

How about fixing the indentation here to use tab?

board/armltd/integrator/integrator.c extern void dram_query(void); · line 124

Quoted 5 lines
board/armltd/integrator/integrator.c +2 -0
+	gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
+				    PHYS_SDRAM_1_SIZE);
  #endif /* CM_SPD_DETECT */
 
  	return 0;

WBR, Sergei