diff mbox series

[03/18] mips: mtmips: fix dram size detection in dram_init

Message ID 1602833724-19203-1-git-send-email-weijie.gao@mediatek.com
State Superseded
Delegated to: Daniel Schwierzeck
Headers show
Series [01/18] mips: dts: switch to board defines for dtb for mtmips | expand

Commit Message

Weijie Gao (高惟杰) Oct. 16, 2020, 7: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.

Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
---
 arch/mips/mach-mtmips/cpu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Stefan Roese Oct. 19, 2020, 10:56 a.m. UTC | #1
On 16.10.20 09:35, Weijie Gao wrote:
> 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.
> 
> Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   arch/mips/mach-mtmips/cpu.c | 5 ++---
>   1 file changed, 2 insertions(+), 3 deletions(-)
> 
> 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)
>   {
> -#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
diff mbox series

Patch

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)
 {
-#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;
 }