summaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy/common
diff options
context:
space:
mode:
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-10-05 13:28:45 +0200
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-10-06 12:33:57 +0200
commit026ba130a5e8861259d12fb9ae352e9ce408955d (patch)
tree31f802aec9fedaefebc9ed9802525658c5e943ce /arch/mips/alchemy/common
parentMIPS: alchemy: Fix build breakage, if TOUCHSCREEN_WM97XX is disabled (diff)
downloadlinux-026ba130a5e8861259d12fb9ae352e9ce408955d.tar.xz
linux-026ba130a5e8861259d12fb9ae352e9ce408955d.zip
MIPS: alchemy: Share prom_init implementation
All boards have the same prom_init() function. Move it to common code and delete the duplicates. Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch/mips/alchemy/common')
-rw-r--r--arch/mips/alchemy/common/prom.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/mips/alchemy/common/prom.c b/arch/mips/alchemy/common/prom.c
index af312b5e33f6..cfa203064d3c 100644
--- a/arch/mips/alchemy/common/prom.c
+++ b/arch/mips/alchemy/common/prom.c
@@ -34,6 +34,8 @@
*/
#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/sizes.h>
#include <linux/string.h>
#include <asm/bootinfo.h>
@@ -76,6 +78,24 @@ char *prom_getenv(char *envname)
return NULL;
}
+void __init prom_init(void)
+{
+ unsigned char *memsize_str;
+ unsigned long memsize;
+
+ prom_argc = (int)fw_arg0;
+ prom_argv = (char **)fw_arg1;
+ prom_envp = (char **)fw_arg2;
+
+ prom_init_cmdline();
+
+ memsize_str = prom_getenv("memsize");
+ if (!memsize_str || kstrtoul(memsize_str, 0, &memsize))
+ memsize = SZ_64M; /* minimum memsize is 64MB RAM */
+
+ add_memory_region(0, memsize, BOOT_MEM_RAM);
+}
+
static inline unsigned char str2hexnum(unsigned char c)
{
if (c >= '0' && c <= '9')