aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-malta/malta-memory.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/mti-malta/malta-memory.c')
-rw-r--r--arch/mips/mti-malta/malta-memory.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 6d9773096750..8fddd2cdbff7 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -16,6 +16,7 @@
16#include <linux/string.h> 16#include <linux/string.h>
17 17
18#include <asm/bootinfo.h> 18#include <asm/bootinfo.h>
19#include <asm/maar.h>
19#include <asm/sections.h> 20#include <asm/sections.h>
20#include <asm/fw/fw.h> 21#include <asm/fw/fw.h>
21 22
@@ -34,13 +35,19 @@ fw_memblock_t * __init fw_getmdesc(int eva)
34 /* otherwise look in the environment */ 35 /* otherwise look in the environment */
35 36
36 memsize_str = fw_getenv("memsize"); 37 memsize_str = fw_getenv("memsize");
37 if (memsize_str) 38 if (memsize_str) {
38 tmp = kstrtol(memsize_str, 0, &memsize); 39 tmp = kstrtoul(memsize_str, 0, &memsize);
40 if (tmp)
41 pr_warn("Failed to read the 'memsize' env variable.\n");
42 }
39 if (eva) { 43 if (eva) {
40 /* Look for ememsize for EVA */ 44 /* Look for ememsize for EVA */
41 ememsize_str = fw_getenv("ememsize"); 45 ememsize_str = fw_getenv("ememsize");
42 if (ememsize_str) 46 if (ememsize_str) {
43 tmp = kstrtol(ememsize_str, 0, &ememsize); 47 tmp = kstrtoul(ememsize_str, 0, &ememsize);
48 if (tmp)
49 pr_warn("Failed to read the 'ememsize' env variable.\n");
50 }
44 } 51 }
45 if (!memsize && !ememsize) { 52 if (!memsize && !ememsize) {
46 pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); 53 pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
@@ -164,3 +171,28 @@ void __init prom_free_prom_memory(void)
164 addr, addr + boot_mem_map.map[i].size); 171 addr, addr + boot_mem_map.map[i].size);
165 } 172 }
166} 173}
174
175unsigned platform_maar_init(unsigned num_pairs)
176{
177 phys_addr_t mem_end = (physical_memsize & ~0xffffull) - 1;
178 struct maar_config cfg[] = {
179 /* DRAM preceding I/O */
180 { 0x00000000, 0x0fffffff, MIPS_MAAR_S },
181
182 /* DRAM following I/O */
183 { 0x20000000, mem_end, MIPS_MAAR_S },
184
185 /* DRAM alias in upper half of physical */
186 { 0x80000000, 0x80000000 + mem_end, MIPS_MAAR_S },
187 };
188 unsigned i, num_cfg = ARRAY_SIZE(cfg);
189
190 /* If DRAM fits before I/O, drop the region following it */
191 if (physical_memsize <= 0x10000000) {
192 num_cfg--;
193 for (i = 1; i < num_cfg; i++)
194 cfg[i] = cfg[i + 1];
195 }
196
197 return maar_config(cfg, num_cfg, num_pairs);
198}