From 40f57b571c1895fa077be922e2cd1345b27efe2d Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Wed, 8 Oct 2025 10:09:02 +0300 Subject: [PATCH 1/2] arm/airoha: an7581 ignores CFG_MAX_MEM_MAPPED value This partly fix commit 726404a66c773 ("airoha: rework RAM size handling to support multiple RAM size") The function get_effective_memsize() do not see non-global defines of CFG_MAX_MEM_MAPPED, so the effective memory size will not be changed. Fix the issue by putting definition of CFG_MAX_MEM_MAPPED to the proper place. Fixes: 726404a66c773 ("airoha: rework RAM size handling to support multiple RAM size") Signed-off-by: Mikhail Kshevetskiy --- arch/arm/mach-airoha/an7581/init.c | 2 -- include/configs/an7581.h | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/arm/mach-airoha/an7581/init.c b/arch/arm/mach-airoha/an7581/init.c index 11992027d92..be0ccadf7da 100644 --- a/arch/arm/mach-airoha/an7581/init.c +++ b/arch/arm/mach-airoha/an7581/init.c @@ -8,8 +8,6 @@ #include #include -#define CFG_MAX_MEM_MAPPED SZ_2G - DECLARE_GLOBAL_DATA_PTR; int print_cpuinfo(void) diff --git a/include/configs/an7581.h b/include/configs/an7581.h index 64f04c9d9a5..dfb611d298b 100644 --- a/include/configs/an7581.h +++ b/include/configs/an7581.h @@ -15,5 +15,6 @@ /* DRAM */ #define CFG_SYS_SDRAM_BASE 0x80000000 +#define CFG_MAX_MEM_MAPPED SZ_2G #endif From ce175fa9f0e83c5df3ba7131bc4359fee3697354 Mon Sep 17 00:00:00 2001 From: Mikhail Kshevetskiy Date: Wed, 8 Oct 2025 10:09:03 +0300 Subject: [PATCH 2/2] arm/airoha: partly revert support of multiple RAM size for an7581 Partly revert commit 726404a66c773 ("airoha: rework RAM size handling to support multiple RAM size"). The general idea is good, but the call of get_ram_size((void *)gd->ram_base, SZ_8G); produces the following result on my an7581 board with only 1Gb of memory: "Synchronous Abort" handler, esr 0x96000004 elr: 0000000081e201c8 lr : 0000000081e20160 (reloc) elr: 00000000bff501c8 lr : 00000000bff50160 x0 : 0000000180000000 x1 : 0000000100000000 x2 : 000000000000002e x3 : 0000000000000002 x4 : 000000001fbf0000 x5 : 0060000000000401 x6 : 0000000000000000 x7 : 00000000bffdb268 x8 : 0000000000000060 x9 : 00000000bffdb2c8 x10: 0000000000000000 x11: 0000000000000060 x12: 00000000bffdb268 x13: 00000000841c56d0 x14: 00000000841c56d0 x15: 0000000000000000 x16: 00000000841506e4 x17: dd7fe29aec3b07e8 x18: 00000000bf710e00 x19: 0000000080000000 x20: 0000000000000000 x21: 0000000020000000 x22: 0000000200000000 x23: 0000000000000001 x24: 0000000040000000 x25: 00000000bf708e78 x26: 00000000bf7bdca0 x27: 0000000000000000 x28: 0000000000000000 x29: 00000000bf708e20 Code: 910943ff d65f03c0 d37df2a1 8b150e60 (f8616a62) Resetting CPU ... So just not call get_ram_size() and use the value from dtb. Fixes: 726404a66c773 ("airoha: rework RAM size handling to support multiple RAM size") Signed-off-by: Mikhail Kshevetskiy --- arch/arm/mach-airoha/an7581/init.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/arch/arm/mach-airoha/an7581/init.c b/arch/arm/mach-airoha/an7581/init.c index be0ccadf7da..ab32706a79d 100644 --- a/arch/arm/mach-airoha/an7581/init.c +++ b/arch/arm/mach-airoha/an7581/init.c @@ -18,15 +18,7 @@ int print_cpuinfo(void) int dram_init(void) { - int ret; - - ret = fdtdec_setup_mem_size_base(); - if (ret) - return ret; - - gd->ram_size = get_ram_size((void *)gd->ram_base, SZ_8G); - - return 0; + return fdtdec_setup_mem_size_base(); } int dram_init_banksize(void)