diff options
author | Steven J. Hill <Steven.Hill@imgtec.com> | 2013-03-25 15:35:30 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-05-08 06:30:09 -0400 |
commit | 0be2abbceeb837bf938c85db03142b5b0e4675f4 (patch) | |
tree | fe0a9776b3dc8402c16c2f381a896dcb4f784515 /arch/mips/mti-sead3/sead3-init.c | |
parent | 14aecdd419217e041fb5dd2749d11f58503bdf62 (diff) |
MIPS: FW: sead3: Use new common FW library variable processing.
Remove old YAMON prom code and use common firmware library code.
Signed-off-by: Steven J. Hill <Steven.Hill@imgtec.com>
Diffstat (limited to 'arch/mips/mti-sead3/sead3-init.c')
-rw-r--r-- | arch/mips/mti-sead3/sead3-init.c | 81 |
1 files changed, 46 insertions, 35 deletions
diff --git a/arch/mips/mti-sead3/sead3-init.c b/arch/mips/mti-sead3/sead3-init.c index f95abaa1aa5d..357c0e105600 100644 --- a/arch/mips/mti-sead3/sead3-init.c +++ b/arch/mips/mti-sead3/sead3-init.c | |||
@@ -13,37 +13,51 @@ | |||
13 | #include <asm/traps.h> | 13 | #include <asm/traps.h> |
14 | #include <asm/mips-boards/generic.h> | 14 | #include <asm/mips-boards/generic.h> |
15 | #include <asm/mips-boards/prom.h> | 15 | #include <asm/mips-boards/prom.h> |
16 | 16 | #include <asm/fw/fw.h> | |
17 | extern void prom_init_early_console(char port); | ||
18 | 17 | ||
19 | extern char except_vec_nmi; | 18 | extern char except_vec_nmi; |
20 | extern char except_vec_ejtag_debug; | 19 | extern char except_vec_ejtag_debug; |
21 | 20 | ||
22 | int prom_argc; | 21 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
23 | int *_prom_argv, *_prom_envp; | 22 | static void __init console_config(void) |
24 | |||
25 | #define prom_envp(index) ((char *)(long)_prom_envp[(index)]) | ||
26 | |||
27 | char *prom_getenv(char *envname) | ||
28 | { | 23 | { |
29 | /* | 24 | char console_string[40]; |
30 | * Return a pointer to the given environment variable. | 25 | int baud = 0; |
31 | * In 64-bit mode: we're using 64-bit pointers, but all pointers | 26 | char parity = '\0', bits = '\0', flow = '\0'; |
32 | * in the PROM structures are only 32-bit, so we need some | 27 | char *s; |
33 | * workarounds, if we are running in 64-bit mode. | 28 | |
34 | */ | 29 | if ((strstr(fw_getcmdline(), "console=")) == NULL) { |
35 | int i, index = 0; | 30 | s = fw_getenv("modetty0"); |
36 | 31 | if (s) { | |
37 | i = strlen(envname); | 32 | while (*s >= '0' && *s <= '9') |
38 | 33 | baud = baud*10 + *s++ - '0'; | |
39 | while (prom_envp(index)) { | 34 | if (*s == ',') |
40 | if (strncmp(envname, prom_envp(index), i) == 0) | 35 | s++; |
41 | return prom_envp(index+1); | 36 | if (*s) |
42 | index += 2; | 37 | parity = *s++; |
38 | if (*s == ',') | ||
39 | s++; | ||
40 | if (*s) | ||
41 | bits = *s++; | ||
42 | if (*s == ',') | ||
43 | s++; | ||
44 | if (*s == 'h') | ||
45 | flow = 'r'; | ||
46 | } | ||
47 | if (baud == 0) | ||
48 | baud = 38400; | ||
49 | if (parity != 'n' && parity != 'o' && parity != 'e') | ||
50 | parity = 'n'; | ||
51 | if (bits != '7' && bits != '8') | ||
52 | bits = '8'; | ||
53 | if (flow == '\0') | ||
54 | flow = 'r'; | ||
55 | sprintf(console_string, " console=ttyS0,%d%c%c%c", baud, | ||
56 | parity, bits, flow); | ||
57 | strcat(fw_getcmdline(), console_string); | ||
43 | } | 58 | } |
44 | |||
45 | return NULL; | ||
46 | } | 59 | } |
60 | #endif | ||
47 | 61 | ||
48 | static void __init mips_nmi_setup(void) | 62 | static void __init mips_nmi_setup(void) |
49 | { | 63 | { |
@@ -69,23 +83,20 @@ static void __init mips_ejtag_setup(void) | |||
69 | 83 | ||
70 | void __init prom_init(void) | 84 | void __init prom_init(void) |
71 | { | 85 | { |
72 | prom_argc = fw_arg0; | ||
73 | _prom_argv = (int *) fw_arg1; | ||
74 | _prom_envp = (int *) fw_arg2; | ||
75 | |||
76 | board_nmi_handler_setup = mips_nmi_setup; | 86 | board_nmi_handler_setup = mips_nmi_setup; |
77 | board_ejtag_handler_setup = mips_ejtag_setup; | 87 | board_ejtag_handler_setup = mips_ejtag_setup; |
78 | 88 | ||
79 | prom_init_cmdline(); | 89 | fw_init_cmdline(); |
80 | #ifdef CONFIG_EARLY_PRINTK | 90 | #ifdef CONFIG_EARLY_PRINTK |
81 | if ((strstr(prom_getcmdline(), "console=ttyS0")) != NULL) | 91 | if ((strstr(fw_getcmdline(), "console=ttyS0")) != NULL) |
82 | prom_init_early_console(0); | 92 | fw_init_early_console(0); |
83 | else if ((strstr(prom_getcmdline(), "console=ttyS1")) != NULL) | 93 | else if ((strstr(fw_getcmdline(), "console=ttyS1")) != NULL) |
84 | prom_init_early_console(1); | 94 | fw_init_early_console(1); |
85 | #endif | 95 | #endif |
86 | #ifdef CONFIG_SERIAL_8250_CONSOLE | 96 | #ifdef CONFIG_SERIAL_8250_CONSOLE |
87 | if ((strstr(prom_getcmdline(), "console=")) == NULL) | 97 | if ((strstr(fw_getcmdline(), "console=")) == NULL) |
88 | strcat(prom_getcmdline(), " console=ttyS0,38400n8r"); | 98 | strcat(fw_getcmdline(), " console=ttyS0,38400n8r"); |
99 | console_config(); | ||
89 | #endif | 100 | #endif |
90 | } | 101 | } |
91 | 102 | ||