From 026ba130a5e8861259d12fb9ae352e9ce408955d Mon Sep 17 00:00:00 2001 From: Thomas Bogendoerfer Date: Mon, 5 Oct 2020 13:28:45 +0200 Subject: 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 --- arch/mips/alchemy/common/prom.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'arch/mips/alchemy/common') 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 +#include +#include #include #include @@ -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') -- cgit v1.2.3