ramips: sync kernel patches with the mips-next tree
[openwrt.git] / target / linux / ramips / patches-3.8 / 0127-MIPS-ralink-make-use-of-the-new-memory-detection-cod.patch
1 From 1618a00f709817cbcdebf038d0b5e251c8d67237 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sat, 13 Apr 2013 15:15:51 +0200
4 Subject: [PATCH 127/137] MIPS: ralink: make use of the new memory detection
5  code
6
7 Call detect_memory_region() from plat_mem_setup() unless the size was already
8 read from the system controller.
9
10 Signed-off-by: John Crispin <blogic@openwrt.org>
11 Patchwork: http://patchwork.linux-mips.org/patch/5184/
12 ---
13  arch/mips/ralink/of.c |    9 +++++++++
14  1 file changed, 9 insertions(+)
15
16 --- a/arch/mips/ralink/of.c
17 +++ b/arch/mips/ralink/of.c
18 @@ -11,6 +11,7 @@
19  #include <linux/io.h>
20  #include <linux/clk.h>
21  #include <linux/init.h>
22 +#include <linux/sizes.h>
23  #include <linux/of_fdt.h>
24  #include <linux/kernel.h>
25  #include <linux/bootmem.h>
26 @@ -85,6 +86,14 @@ void __init plat_mem_setup(void)
27          * parsed resulting in our memory appearing
28          */
29         __dt_setup_arch(&__dtb_start);
30 +
31 +       if (soc_info.mem_size)
32 +               add_memory_region(soc_info.mem_base, soc_info.mem_size,
33 +                                 BOOT_MEM_RAM);
34 +       else
35 +               detect_memory_region(soc_info.mem_base,
36 +                                    soc_info.mem_size_min * SZ_1M,
37 +                                    soc_info.mem_size_max * SZ_1M);
38  }
39  
40  static int __init plat_of_setup(void)