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 | |
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')
-rw-r--r-- | arch/mips/mti-sead3/Makefile | 8 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-cmdline.c | 46 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-console.c | 2 | ||||
-rw-r--r-- | arch/mips/mti-sead3/sead3-init.c | 81 |
4 files changed, 51 insertions, 86 deletions
diff --git a/arch/mips/mti-sead3/Makefile b/arch/mips/mti-sead3/Makefile index 10ec701ce6c7..be114209217c 100644 --- a/arch/mips/mti-sead3/Makefile +++ b/arch/mips/mti-sead3/Makefile | |||
@@ -8,10 +8,10 @@ | |||
8 | # Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved. | 8 | # Copyright (C) 2012 MIPS Technoligies, Inc. All rights reserved. |
9 | # Steven J. Hill <sjhill@mips.com> | 9 | # Steven J. Hill <sjhill@mips.com> |
10 | # | 10 | # |
11 | obj-y := sead3-lcd.o sead3-cmdline.o \ | 11 | obj-y := sead3-lcd.o sead3-display.o sead3-init.o \ |
12 | sead3-display.o sead3-init.o sead3-int.o \ | 12 | sead3-int.o sead3-mtd.o sead3-net.o \ |
13 | sead3-mtd.o sead3-net.o sead3-platform.o \ | 13 | sead3-platform.o sead3-reset.o \ |
14 | sead3-reset.o sead3-setup.o sead3-time.o | 14 | sead3-setup.o sead3-time.o |
15 | 15 | ||
16 | obj-y += sead3-i2c-dev.o sead3-i2c.o \ | 16 | obj-y += sead3-i2c-dev.o sead3-i2c.o \ |
17 | sead3-pic32-i2c-drv.o sead3-pic32-bus.o \ | 17 | sead3-pic32-i2c-drv.o sead3-pic32-bus.o \ |
diff --git a/arch/mips/mti-sead3/sead3-cmdline.c b/arch/mips/mti-sead3/sead3-cmdline.c deleted file mode 100644 index a2e6cec67f57..000000000000 --- a/arch/mips/mti-sead3/sead3-cmdline.c +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
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/string.h> | ||
10 | |||
11 | #include <asm/bootinfo.h> | ||
12 | |||
13 | extern int prom_argc; | ||
14 | extern int *_prom_argv; | ||
15 | |||
16 | /* | ||
17 | * YAMON (32-bit PROM) pass arguments and environment as 32-bit pointer. | ||
18 | * This macro take care of sign extension. | ||
19 | */ | ||
20 | #define prom_argv(index) ((char *)(long)_prom_argv[(index)]) | ||
21 | |||
22 | char * __init prom_getcmdline(void) | ||
23 | { | ||
24 | return &(arcs_cmdline[0]); | ||
25 | } | ||
26 | |||
27 | void __init prom_init_cmdline(void) | ||
28 | { | ||
29 | char *cp; | ||
30 | int actr; | ||
31 | |||
32 | actr = 1; /* Always ignore argv[0] */ | ||
33 | |||
34 | cp = &(arcs_cmdline[0]); | ||
35 | while (actr < prom_argc) { | ||
36 | strcpy(cp, prom_argv(actr)); | ||
37 | cp += strlen(prom_argv(actr)); | ||
38 | *cp++ = ' '; | ||
39 | actr++; | ||
40 | } | ||
41 | if (cp != &(arcs_cmdline[0])) { | ||
42 | /* get rid of trailing space */ | ||
43 | --cp; | ||
44 | *cp = '\0'; | ||
45 | } | ||
46 | } | ||
diff --git a/arch/mips/mti-sead3/sead3-console.c b/arch/mips/mti-sead3/sead3-console.c index 2ddef19a9adc..031f47d69770 100644 --- a/arch/mips/mti-sead3/sead3-console.c +++ b/arch/mips/mti-sead3/sead3-console.c | |||
@@ -26,7 +26,7 @@ static inline void serial_out(int offset, int value, unsigned int base_addr) | |||
26 | __raw_writel(value, PORT(base_addr, offset)); | 26 | __raw_writel(value, PORT(base_addr, offset)); |
27 | } | 27 | } |
28 | 28 | ||
29 | void __init prom_init_early_console(char port) | 29 | void __init fw_init_early_console(char port) |
30 | { | 30 | { |
31 | console_port = port; | 31 | console_port = port; |
32 | } | 32 | } |
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 | ||