2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
8 #include <linux/init.h>
11 #include <asm/bootinfo.h>
12 #include <asm/cacheflush.h>
13 #include <asm/traps.h>
14 #include <asm/mips-boards/generic.h>
15 #include <asm/fw/fw.h>
17 extern char except_vec_nmi;
18 extern char except_vec_ejtag_debug;
20 #ifdef CONFIG_SERIAL_8250_CONSOLE
21 static void __init console_config(void)
23 char console_string[40];
25 char parity = '\0', bits = '\0', flow = '\0';
28 if ((strstr(fw_getcmdline(), "console=")) == NULL) {
29 s = fw_getenv("modetty0");
31 while (*s >= '0' && *s <= '9')
32 baud = baud*10 + *s++ - '0';
48 if (parity != 'n' && parity != 'o' && parity != 'e')
50 if (bits != '7' && bits != '8')
54 sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
56 strcat(fw_getcmdline(), console_string);
61 static void __init mips_nmi_setup(void)
66 (void *)(CAC_BASE + 0xa80) :
67 (void *)(CAC_BASE + 0x380);
68 memcpy(base, &except_vec_nmi, 0x80);
69 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
72 static void __init mips_ejtag_setup(void)
77 (void *)(CAC_BASE + 0xa00) :
78 (void *)(CAC_BASE + 0x300);
79 memcpy(base, &except_vec_ejtag_debug, 0x80);
80 flush_icache_range((unsigned long)base, (unsigned long)base + 0x80);
83 void __init prom_init(void)
85 board_nmi_handler_setup = mips_nmi_setup;
86 board_ejtag_handler_setup = mips_ejtag_setup;
89 #ifdef CONFIG_EARLY_PRINTK
90 if ((strstr(fw_getcmdline(), "console=ttyS0")) != NULL)
91 fw_init_early_console(0);
92 else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL)
93 fw_init_early_console(1);
95 #ifdef CONFIG_SERIAL_8250_CONSOLE
96 if ((strstr(fw_getcmdline(), "console=")) == NULL)
97 strcat(fw_getcmdline(), " console=ttyS0,38400n8r");
102 void prom_free_prom_memory(void)