diff mbox series

[v4,04/23] mips: mtmips: fix dram size detection in dram_init

Message ID 28c69d312dcb8eb5d5dd4fdb3750e328ef8c742c.1605169080.git.weijie.gao@mediatek.com
State Accepted
Commit 9bf72ba6f68f7c96b0913bfc35ae423e9b1895d5
Delegated to: Daniel Schwierzeck
Headers show
Series Add support for MediaTek MT7620 SoC - v4 | expand

Commit Message

Weijie Gao Nov. 12, 2020, 8:35 a.m. UTC
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.

Reviewed-by: Stefan Roese <sr@denx.de>
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
v4 changes: none
v3 changes: none
v2 changes: none
 arch/mips/mach-mtmips/cpu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series


diff --git a/arch/mips/mach-mtmips/cpu.c b/arch/mips/mach-mtmips/cpu.c
index 2ddf8cb096..ca1967055a 100644
--- a/arch/mips/mach-mtmips/cpu.c
+++ b/arch/mips/mach-mtmips/cpu.c
@@ -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)
-	gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, SZ_256M);
+	gd->ram_size = get_ram_size((void *)KSEG1, SZ_256M);
 	return 0;