Commit 026ba130 authored by Thomas Bogendoerfer's avatar Thomas Bogendoerfer

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: default avatarThomas Bogendoerfer <tsbogend@alpha.franken.de>
parent 396c7d94
...@@ -31,23 +31,6 @@ const char *get_system_type(void) ...@@ -31,23 +31,6 @@ const char *get_system_type(void)
return "GPR"; return "GPR";
} }
void __init prom_init(void)
{
unsigned char *memsize_str;
unsigned long memsize;
prom_argc = 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 = 0x04000000;
add_memory_region(0, memsize, BOOT_MEM_RAM);
}
void prom_putchar(char c) void prom_putchar(char c)
{ {
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
......
...@@ -30,23 +30,6 @@ const char *get_system_type(void) ...@@ -30,23 +30,6 @@ const char *get_system_type(void)
return "MTX-1"; return "MTX-1";
} }
void __init prom_init(void)
{
unsigned char *memsize_str;
unsigned long memsize;
prom_argc = 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 = 0x04000000;
add_memory_region(0, memsize, BOOT_MEM_RAM);
}
void prom_putchar(char c) void prom_putchar(char c)
{ {
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
......
...@@ -25,24 +25,6 @@ const char *get_system_type(void) ...@@ -25,24 +25,6 @@ const char *get_system_type(void)
return "XXS1500"; return "XXS1500";
} }
void __init prom_init(void)
{
unsigned char *memsize_str;
unsigned long memsize;
prom_argc = 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 = 0x04000000;
add_memory_region(0, memsize, BOOT_MEM_RAM);
}
void prom_putchar(char c) void prom_putchar(char c)
{ {
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c); alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
......
...@@ -34,6 +34,8 @@ ...@@ -34,6 +34,8 @@
*/ */
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sizes.h>
#include <linux/string.h> #include <linux/string.h>
#include <asm/bootinfo.h> #include <asm/bootinfo.h>
...@@ -76,6 +78,24 @@ char *prom_getenv(char *envname) ...@@ -76,6 +78,24 @@ char *prom_getenv(char *envname)
return NULL; 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) static inline unsigned char str2hexnum(unsigned char c)
{ {
if (c >= '0' && c <= '9') if (c >= '0' && c <= '9')
......
...@@ -20,23 +20,6 @@ ...@@ -20,23 +20,6 @@
#include <prom.h> #include <prom.h>
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 = 64 << 20; /* all devboards have at least 64MB RAM */
add_memory_region(0, memsize, BOOT_MEM_RAM);
}
void prom_putchar(char c) void prom_putchar(char c)
{ {
if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300) if (alchemy_get_cputype() == ALCHEMY_CPU_AU1300)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment