MIPS: FW: Remove obsolete header file for MTI platforms.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / mips / mti-sead3 / sead3-init.c
1 /*
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
4 * for more details.
5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8 #include <linux/init.h>
9 #include <linux/io.h>
10
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>
16
17 extern char except_vec_nmi;
18 extern char except_vec_ejtag_debug;
19
20 #ifdef CONFIG_SERIAL_8250_CONSOLE
21 static void __init console_config(void)
22 {
23 char console_string[40];
24 int baud = 0;
25 char parity = '\0', bits = '\0', flow = '\0';
26 char *s;
27
28 if ((strstr(fw_getcmdline(), "console=")) == NULL) {
29 s = fw_getenv("modetty0");
30 if (s) {
31 while (*s >= '0' && *s <= '9')
32 baud = baud*10 + *s++ - '0';
33 if (*s == ',')
34 s++;
35 if (*s)
36 parity = *s++;
37 if (*s == ',')
38 s++;
39 if (*s)
40 bits = *s++;
41 if (*s == ',')
42 s++;
43 if (*s == 'h')
44 flow = 'r';
45 }
46 if (baud == 0)
47 baud = 38400;
48 if (parity != 'n' && parity != 'o' && parity != 'e')
49 parity = 'n';
50 if (bits != '7' && bits != '8')
51 bits = '8';
52 if (flow == '\0')
53 flow = 'r';
54 sprintf(console_string, " console=ttyS0,%d%c%c%c", baud,
55 parity, bits, flow);
56 strcat(fw_getcmdline(), console_string);
57 }
58 }
59 #endif
60
61 static void __init mips_nmi_setup(void)
62 {
63 void *base;
64
65 base = cpu_has_veic ?
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);
70 }
71
72 static void __init mips_ejtag_setup(void)
73 {
74 void *base;
75
76 base = cpu_has_veic ?
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);
81 }
82
83 void __init prom_init(void)
84 {
85 board_nmi_handler_setup = mips_nmi_setup;
86 board_ejtag_handler_setup = mips_ejtag_setup;
87
88 fw_init_cmdline();
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);
94 #endif
95 #ifdef CONFIG_SERIAL_8250_CONSOLE
96 if ((strstr(fw_getcmdline(), "console=")) == NULL)
97 strcat(fw_getcmdline(), " console=ttyS0,38400n8r");
98 console_config();
99 #endif
100 }
101
102 void prom_free_prom_memory(void)
103 {
104 }