aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/netlogic/xlp/setup.c
diff options
context:
space:
mode:
authorJayachandran C <jchandra@broadcom.com>2013-08-21 10:01:29 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-09-03 17:22:18 -0400
commita2ba6cd6e65bf96059632ed2fe48a7a0f5aea472 (patch)
treee6a04a3eed22d430ebcb84b6f0d68164211b8bab /arch/mips/netlogic/xlp/setup.c
parent2c4f1ac5623750e715ae2a5fc7e0569999b9bfc5 (diff)
MIPS: Netlogic: Read memory from DRAM BARs
Read the memory from the Bridge DRAM BARs, if it is not passed in from the device tree. This will allow us to remove memory configuration from built in device trees. Signed-off-by: Jayachandran C <jchandra@broadcom.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/5743/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/netlogic/xlp/setup.c')
-rw-r--r--arch/mips/netlogic/xlp/setup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/mips/netlogic/xlp/setup.c b/arch/mips/netlogic/xlp/setup.c
index 7b638f7be491..7718368e4598 100644
--- a/arch/mips/netlogic/xlp/setup.c
+++ b/arch/mips/netlogic/xlp/setup.c
@@ -73,6 +73,23 @@ static void nlm_fixup_mem(void)
73 } 73 }
74} 74}
75 75
76static void __init xlp_init_mem_from_bars(void)
77{
78 uint64_t map[16];
79 int i, n;
80
81 n = xlp_get_dram_map(-1, map); /* -1: info for all nodes */
82 for (i = 0; i < n; i += 2) {
83 /* exclude 0x1000_0000-0x2000_0000, u-boot device */
84 if (map[i] <= 0x10000000 && map[i+1] > 0x10000000)
85 map[i+1] = 0x10000000;
86 if (map[i] > 0x10000000 && map[i] < 0x20000000)
87 map[i] = 0x20000000;
88
89 add_memory_region(map[i], map[i+1] - map[i], BOOT_MEM_RAM);
90 }
91}
92
76void __init plat_mem_setup(void) 93void __init plat_mem_setup(void)
77{ 94{
78 panic_timeout = 5; 95 panic_timeout = 5;
@@ -82,6 +99,12 @@ void __init plat_mem_setup(void)
82 99
83 /* memory and bootargs from DT */ 100 /* memory and bootargs from DT */
84 early_init_devtree(initial_boot_params); 101 early_init_devtree(initial_boot_params);
102
103 if (boot_mem_map.nr_map == 0) {
104 pr_info("Using DRAM BARs for memory map.\n");
105 xlp_init_mem_from_bars();
106 }
107 /* Calculate and setup wired entries for mapped kernel */
85 nlm_fixup_mem(); 108 nlm_fixup_mem();
86} 109}
87 110