diff options
author | Kelvin Cheung <keguang.zhang@gmail.com> | 2014-10-09 23:40:00 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:09 -0500 |
commit | 813c14108d0f5bbddc125fb7a6a0819fcdcf61e2 (patch) | |
tree | 30bd13ec0ac48e754a3bb9fe769ce20e5c473484 /arch/mips/loongson1 | |
parent | a13f0795752389f84bc31b9171cb79ad6759e4db (diff) |
MIPS: Loongson1B: Improve early printk
- Determine serial port for early printk according to kernel command line.
- Move to 8250/16550 serial early printk driver.
Signed-off-by: Kelvin Cheung <keguang.zhang@gmail.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8023/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/loongson1')
-rw-r--r-- | arch/mips/loongson1/Kconfig | 1 | ||||
-rw-r--r-- | arch/mips/loongson1/common/prom.c | 30 |
2 files changed, 14 insertions, 17 deletions
diff --git a/arch/mips/loongson1/Kconfig b/arch/mips/loongson1/Kconfig index e23c25d09963..4ed9744fe051 100644 --- a/arch/mips/loongson1/Kconfig +++ b/arch/mips/loongson1/Kconfig | |||
@@ -16,6 +16,7 @@ config LOONGSON1_LS1B | |||
16 | select SYS_SUPPORTS_HIGHMEM | 16 | select SYS_SUPPORTS_HIGHMEM |
17 | select SYS_SUPPORTS_MIPS16 | 17 | select SYS_SUPPORTS_MIPS16 |
18 | select SYS_HAS_EARLY_PRINTK | 18 | select SYS_HAS_EARLY_PRINTK |
19 | select USE_GENERIC_EARLY_PRINTK_8250 | ||
19 | select COMMON_CLK | 20 | select COMMON_CLK |
20 | 21 | ||
21 | endchoice | 22 | endchoice |
diff --git a/arch/mips/loongson1/common/prom.c b/arch/mips/loongson1/common/prom.c index 2a47af5a55c3..68600980ea49 100644 --- a/arch/mips/loongson1/common/prom.c +++ b/arch/mips/loongson1/common/prom.c | |||
@@ -27,7 +27,7 @@ char *prom_getenv(char *envname) | |||
27 | i = strlen(envname); | 27 | i = strlen(envname); |
28 | 28 | ||
29 | while (*env) { | 29 | while (*env) { |
30 | if (strncmp(envname, *env, i) == 0 && *(*env+i) == '=') | 30 | if (strncmp(envname, *env, i) == 0 && *(*env + i) == '=') |
31 | return *env + i + 1; | 31 | return *env + i + 1; |
32 | env++; | 32 | env++; |
33 | } | 33 | } |
@@ -49,7 +49,7 @@ void __init prom_init_cmdline(void) | |||
49 | for (i = 1; i < prom_argc; i++) { | 49 | for (i = 1; i < prom_argc; i++) { |
50 | strcpy(c, prom_argv[i]); | 50 | strcpy(c, prom_argv[i]); |
51 | c += strlen(prom_argv[i]); | 51 | c += strlen(prom_argv[i]); |
52 | if (i < prom_argc-1) | 52 | if (i < prom_argc - 1) |
53 | *c++ = ' '; | 53 | *c++ = ' '; |
54 | } | 54 | } |
55 | *c = 0; | 55 | *c = 0; |
@@ -57,6 +57,7 @@ void __init prom_init_cmdline(void) | |||
57 | 57 | ||
58 | void __init prom_init(void) | 58 | void __init prom_init(void) |
59 | { | 59 | { |
60 | void __iomem *uart_base; | ||
60 | prom_argc = fw_arg0; | 61 | prom_argc = fw_arg0; |
61 | prom_argv = (char **)fw_arg1; | 62 | prom_argv = (char **)fw_arg1; |
62 | prom_envp = (char **)fw_arg2; | 63 | prom_envp = (char **)fw_arg2; |
@@ -65,23 +66,18 @@ void __init prom_init(void) | |||
65 | 66 | ||
66 | memsize = env_or_default("memsize", DEFAULT_MEMSIZE); | 67 | memsize = env_or_default("memsize", DEFAULT_MEMSIZE); |
67 | highmemsize = env_or_default("highmemsize", 0x0); | 68 | highmemsize = env_or_default("highmemsize", 0x0); |
68 | } | ||
69 | 69 | ||
70 | void __init prom_free_prom_memory(void) | 70 | if (strstr(arcs_cmdline, "console=ttyS3")) |
71 | { | 71 | uart_base = ioremap_nocache(LS1X_UART3_BASE, 0x0f); |
72 | else if (strstr(arcs_cmdline, "console=ttyS2")) | ||
73 | uart_base = ioremap_nocache(LS1X_UART2_BASE, 0x0f); | ||
74 | else if (strstr(arcs_cmdline, "console=ttyS1")) | ||
75 | uart_base = ioremap_nocache(LS1X_UART1_BASE, 0x0f); | ||
76 | else | ||
77 | uart_base = ioremap_nocache(LS1X_UART0_BASE, 0x0f); | ||
78 | setup_8250_early_printk_port((unsigned long)uart_base, 0, 0); | ||
72 | } | 79 | } |
73 | 80 | ||
74 | #define PORT(offset) (u8 *)(KSEG1ADDR(LS1X_UART0_BASE + offset)) | 81 | void __init prom_free_prom_memory(void) |
75 | |||
76 | void prom_putchar(char c) | ||
77 | { | 82 | { |
78 | int timeout; | ||
79 | |||
80 | timeout = 1024; | ||
81 | |||
82 | while (((readb(PORT(UART_LSR)) & UART_LSR_THRE) == 0) | ||
83 | && (timeout-- > 0)) | ||
84 | ; | ||
85 | |||
86 | writeb(c, PORT(UART_TX)); | ||
87 | } | 83 | } |