2e857fbc44788b5e197e923a173770c832255e3c
[openwrt/openwrt.git] / target / linux / ramips / patches-3.10 / 999-memory-detect.patch
1 Index: linux-3.10.26/arch/mips/ralink/of.c
2 ===================================================================
3 --- linux-3.10.26.orig/arch/mips/ralink/of.c 2014-01-12 11:49:40.292069849 +0100
4 +++ linux-3.10.26/arch/mips/ralink/of.c 2014-01-12 12:38:01.236138974 +0100
5 @@ -80,6 +80,16 @@
6 }
7
8 extern struct boot_param_header __image_dtb;
9 +static int memory_dtb;
10 +
11 +static int __init early_init_dt_find_memory(unsigned long node, const char *uname,
12 + int depth, void *data)
13 +{
14 + if (depth == 1 && !strcmp(uname, "memory@0"))
15 + memory_dtb = 1;
16 +
17 + return 0;
18 +}
19
20 void __init plat_mem_setup(void)
21 {
22 @@ -90,8 +100,10 @@
23 * parsed resulting in our memory appearing
24 */
25 __dt_setup_arch(&__image_dtb);
26 -
27 - if (soc_info.mem_size)
28 + of_scan_flat_dt(early_init_dt_find_memory, NULL);
29 + if (memory_dtb)
30 + of_scan_flat_dt(early_init_dt_scan_memory, NULL);
31 + else if (soc_info.mem_size)
32 add_memory_region(soc_info.mem_base, soc_info.mem_size * SZ_1M,
33 BOOT_MEM_RAM);
34 else