aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mti-malta
diff options
context:
space:
mode:
authorMarkos Chandras <markos.chandras@imgtec.com>2014-01-15 08:55:07 -0500
committerRalf Baechle <ralf@linux-mips.org>2014-03-26 18:09:20 -0400
commite6ca4e5bf11466b5e9423a1e4ea51a8216c4b9b6 (patch)
tree9f24428dc2f2bc70a9cf8a6fb12e2848f8f2282e /arch/mips/mti-malta
parentc9fede2afc00c493b33eb607086d4e1d7a220fc1 (diff)
MIPS: malta: malta-memory: Add support for the 'ememsize' variable
The 'ememsize' variable is used to denote the real RAM which is present on the Malta board. This is different compared to 'memsize' which is capped to 256MB. The 'ememsize' is used to get the actual physical memory when setting up the Malta memory layout. This only makes sense in case the core operates in the EVA mode, and it's ignored otherwise. Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Diffstat (limited to 'arch/mips/mti-malta')
-rw-r--r--arch/mips/mti-malta/malta-memory.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/arch/mips/mti-malta/malta-memory.c b/arch/mips/mti-malta/malta-memory.c
index 1f73d63e92a7..cd0400802eb1 100644
--- a/arch/mips/mti-malta/malta-memory.c
+++ b/arch/mips/mti-malta/malta-memory.c
@@ -24,22 +24,30 @@ static fw_memblock_t mdesc[FW_MAX_MEMBLOCKS];
24/* determined physical memory size, not overridden by command line args */ 24/* determined physical memory size, not overridden by command line args */
25unsigned long physical_memsize = 0L; 25unsigned long physical_memsize = 0L;
26 26
27fw_memblock_t * __init fw_getmdesc(void) 27fw_memblock_t * __init fw_getmdesc(int eva)
28{ 28{
29 char *memsize_str, *ptr; 29 char *memsize_str, *ememsize_str __maybe_unused = NULL, *ptr;
30 unsigned int memsize; 30 unsigned long memsize, ememsize __maybe_unused = 0;
31 static char cmdline[COMMAND_LINE_SIZE] __initdata; 31 static char cmdline[COMMAND_LINE_SIZE] __initdata;
32 long val;
33 int tmp; 32 int tmp;
34 33
35 /* otherwise look in the environment */ 34 /* otherwise look in the environment */
35
36 memsize_str = fw_getenv("memsize"); 36 memsize_str = fw_getenv("memsize");
37 if (!memsize_str) { 37 if (memsize_str)
38 tmp = kstrtol(memsize_str, 0, &memsize);
39 if (eva) {
40 /* Look for ememsize for EVA */
41 ememsize_str = fw_getenv("ememsize");
42 if (ememsize_str)
43 tmp = kstrtol(ememsize_str, 0, &ememsize);
44 }
45 if (!memsize && !ememsize) {
38 pr_warn("memsize not set in YAMON, set to default (32Mb)\n"); 46 pr_warn("memsize not set in YAMON, set to default (32Mb)\n");
39 physical_memsize = 0x02000000; 47 physical_memsize = 0x02000000;
40 } else { 48 } else {
41 tmp = kstrtol(memsize_str, 0, &val); 49 /* If ememsize is set, then set physical_memsize to that */
42 physical_memsize = (unsigned long)val; 50 physical_memsize = ememsize ? : memsize;
43 } 51 }
44 52
45#ifdef CONFIG_CPU_BIG_ENDIAN 53#ifdef CONFIG_CPU_BIG_ENDIAN
@@ -54,12 +62,22 @@ fw_memblock_t * __init fw_getmdesc(void)
54 ptr = strstr(cmdline, "memsize="); 62 ptr = strstr(cmdline, "memsize=");
55 if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' ')) 63 if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
56 ptr = strstr(ptr, " memsize="); 64 ptr = strstr(ptr, " memsize=");
65 /* And now look for ememsize */
66 if (eva) {
67 ptr = strstr(cmdline, "ememsize=");
68 if (ptr && (ptr != cmdline) && (*(ptr - 1) != ' '))
69 ptr = strstr(ptr, " ememsize=");
70 }
57 71
58 if (ptr) 72 if (ptr)
59 memsize = memparse(ptr + 8, &ptr); 73 memsize = memparse(ptr + 8 + (eva ? 1 : 0), &ptr);
60 else 74 else
61 memsize = physical_memsize; 75 memsize = physical_memsize;
62 76
77 /* Last 64K for HIGHMEM arithmetics */
78 if (memsize > 0x7fff0000)
79 memsize = 0x7fff0000;
80
63 memset(mdesc, 0, sizeof(mdesc)); 81 memset(mdesc, 0, sizeof(mdesc));
64 82
65 mdesc[0].type = fw_dontuse; 83 mdesc[0].type = fw_dontuse;
@@ -109,7 +127,7 @@ void __init fw_meminit(void)
109{ 127{
110 fw_memblock_t *p; 128 fw_memblock_t *p;
111 129
112 p = fw_getmdesc(); 130 p = fw_getmdesc(config_enabled(CONFIG_EVA));
113 131
114 while (p->size) { 132 while (p->size) {
115 long type; 133 long type;