ralink: refresh patches
[openwrt/svn-archive/archive.git] / target / linux / ramips / patches-3.10 / 0107-MIPS-ralink-allow-manual-memory-override.patch
1 From ee46d05eefefb0fb40b5682b4f6f3876b496044b Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 16 Mar 2014 04:40:48 +0000
4 Subject: [PATCH 107/133] MIPS: ralink: allow manual memory override
5
6 RT5350 relies on the bootloader setting up the memc correctly.
7 On sme boards the setup is incorrect leading to 32 MB being available but only 16 being recognized. Allow these boards to manually override the memory range
8 .
9 Signed-off-by: John Crispin <blogic@openwrt.org>
10 ---
11 arch/mips/ralink/of.c | 16 +++++++++++++++-
12 1 file changed, 15 insertions(+), 1 deletion(-)
13
14 --- a/arch/mips/ralink/of.c
15 +++ b/arch/mips/ralink/of.c
16 @@ -77,6 +77,17 @@ void __init device_tree_init(void)
17 //free_bootmem(base, size);
18 }
19
20 +static int memory_dtb;
21 +
22 +static int __init early_init_dt_find_memory(unsigned long node, const char *uname,
23 + int depth, void *data)
24 +{
25 + if (depth == 1 && !strcmp(uname, "memory@0"))
26 + memory_dtb = 1;
27 +
28 + return 0;
29 +}
30 +
31 void __init plat_mem_setup(void)
32 {
33 set_io_port_base(KSEG1);
34 @@ -87,7 +98,10 @@ void __init plat_mem_setup(void)
35 */
36 __dt_setup_arch(&__dtb_start);
37
38 - if (soc_info.mem_size)
39 + of_scan_flat_dt(early_init_dt_find_memory, NULL);
40 + if (memory_dtb)
41 + of_scan_flat_dt(early_init_dt_scan_memory, NULL);
42 + else if (soc_info.mem_size)
43 add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
44 BOOT_MEM_RAM);
45 else