Skip to contentSkip to conversation

mips: mtmips: fix dram size detection in dram_init

PATCH New Weijie Gao 2 participants 2 messages Oct 16, 2020 – Oct 19, 2020 MIPS

lore
Share & tools
lore

Weijie Gao

author
#0 lore raw

PATCH 3/18 mips: mtmips: fix dram size detection in dram_init

CONFIG_SYS_SDRAM_BASE points to cached memory, i.e. KSEG0, which is not suitable for detecting memory size.

Replace CONFIG_SYS_SDRAM_BASE with KSEG1, and make dram_init() always do memory size detection in any stage.

---
 arch/mips/mach-mtmips/cpu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/cpu.c +2 -3
index 2ddf8cb096..ca1967055a 100644
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <init.h>
 #include <malloc.h>
+#include <asm/addrspace.h>
 #include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
@@ -14,9 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-#ifdef CONFIG_SKIP_LOWLEVEL_INIT
-	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, SZ_256M);
-#endif
+	gd->ram_size = get_ram_size((void *)KSEG1, SZ_256M);
 
 	return 0;
 }
Signature · 1 line
2.17.1
#1 lore raw

PATCH 3/18 mips: mtmips: fix dram size detection in dram_init

Quoted 7 lines · Weijie Gao

CONFIG_SYS_SDRAM_BASE points to cached memory, i.e. KSEG0, which is not suitable for detecting memory size.

Replace CONFIG_SYS_SDRAM_BASE with KSEG1, and make dram_init() always do memory size detection in any stage.

Thanks,
Stefan

Quoted 18 lines
---
  arch/mips/mach-mtmips/cpu.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
arch/mips/mach-mtmips/cpu.c +1 -0
index 2ddf8cb096..ca1967055a 100644
@@ -6,6 +6,7 @@
  #include <common.h>
  #include <init.h>
  #include <malloc.h>
+#include <asm/addrspace.h>
  #include <linux/bitops.h>
  #include <linux/io.h>
  #include <linux/sizes.h>

arch/mips/mach-mtmips/cpu.c DECLARE_GLOBAL_DATA_PTR; · line 21

Quoted 10 lines
arch/mips/mach-mtmips/cpu.c +1 -3
@@ -14,9 +15,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
  int dram_init(void)
  {
-#ifdef CONFIG_SKIP_LOWLEVEL_INIT
-	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, SZ_256M);
-#endif
+	gd->ram_size = get_ram_size((void *)KSEG1, SZ_256M);
 
  	return 0;
  }

Viele Gr??e,
Stefan

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de