summaryrefslogtreecommitdiff
path: root/arch/mips/ralink/of.c
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2021-03-26 22:38:40 -0700
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2021-03-29 11:18:54 +0200
commit139c949f7f0ac0dd1c0da132675be80e6d76c65d (patch)
tree85e70d4b58eff856d28892db0f7274acc1511827 /arch/mips/ralink/of.c
parent8eb6eb4882f2eb3ed516484bdde7db359785b6df (diff)
MIPS: ralink: mt7621: add memory detection support
mt7621 has the following memory map: 0x0-0x1c000000: lower 448m memory 0x1c000000-0x2000000: peripheral registers 0x20000000-0x2400000: higher 64m memory detect_memory_region in arch/mips/kernel/setup.c only adds the first memory region and isn't suitable for 512m memory detection because it may accidentally read the memory area for peripheral registers. This commit adds memory detection capability for mt7621: 1. Add the highmem area when 512m is detected. 2. Guard memcmp from accessing peripheral registers: This only happens when a user decided to change kernel load address to 256m or higher address. Since this is a quite unusual case, we just skip 512m testing and return 256m as memory size. Signed-off-by: Chuanhong Guo <gch981213@gmail.com> [Minor commit message reword, make mt7621_memory_detect static] Signed-off-by: Ilya Lipnitskiy <ilya.lipnitskiy@gmail.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/ralink/of.c')
-rw-r--r--arch/mips/ralink/of.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index 8286c3521476..0c5de07da097 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -78,6 +78,8 @@ void __init plat_mem_setup(void)
of_scan_flat_dt(early_init_dt_find_memory, NULL);
if (memory_dtb)
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
+ else if (soc_info.mem_detect)
+ soc_info.mem_detect();
else if (soc_info.mem_size)
memblock_add(soc_info.mem_base, soc_info.mem_size * SZ_1M);
else