summaryrefslogtreecommitdiff
path: root/arch/mips/ralink/of.c
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-10-08 22:40:02 +0200
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 07:45:20 +0100
commit15d11120703df3e78c766c7247058f4903001c56 (patch)
tree9d3661127552ea15992ae90b762b3fd1272a657f /arch/mips/ralink/of.c
parent5433acd81e8733ede365ad41318f96175ed16b3a (diff)
MIPS: ralink: allow manual memory override
RT5350 relies on the bootloader setting up the memc correctly. On some boards the setup is incorrect leading to 32 MB being available but only 16 MB being recognized. Allow these boards to manually override the memory range. Signed-off-by: John Crispin <blogic@openwrt.org> Patchwork: http://patchwork.linux-mips.org/patch/8004/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ralink/of.c')
-rw-r--r--arch/mips/ralink/of.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/arch/mips/ralink/of.c b/arch/mips/ralink/of.c
index f68115fd98ef..f9eda5d8f82c 100644
--- a/arch/mips/ralink/of.c
+++ b/arch/mips/ralink/of.c
@@ -53,6 +53,17 @@ void __init device_tree_init(void)
unflatten_and_copy_device_tree();
}
+static int memory_dtb;
+
+static int __init early_init_dt_find_memory(unsigned long node,
+ const char *uname, int depth, void *data)
+{
+ if (depth == 1 && !strcmp(uname, "memory@0"))
+ memory_dtb = 1;
+
+ return 0;
+}
+
void __init plat_mem_setup(void)
{
set_io_port_base(KSEG1);
@@ -63,7 +74,10 @@ void __init plat_mem_setup(void)
*/
__dt_setup_arch(__dtb_start);
- if (soc_info.mem_size)
+ 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_size)
add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
BOOT_MEM_RAM);
else