diff options
author | Peter Horton <pdh@colonel-panic.org> | 2006-02-12 12:10:25 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-03-21 08:27:44 -0500 |
commit | e87dddeb92618d9dbb8b9f946a193739a4447609 (patch) | |
tree | 4a07a4edf9c2ddb2f3f9a36118120144af476d44 /arch/mips/cobalt | |
parent | c4a1745aa09fc110afdefea0e5d025043e348bae (diff) |
[MIPS] Add early console for Cobalt.
Signed-off-by: Peter Horton <pdh@colonel-panic.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/cobalt')
-rw-r--r-- | arch/mips/cobalt/Kconfig | 7 | ||||
-rw-r--r-- | arch/mips/cobalt/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/cobalt/console.c | 43 | ||||
-rw-r--r-- | arch/mips/cobalt/setup.c | 13 |
4 files changed, 57 insertions, 8 deletions
diff --git a/arch/mips/cobalt/Kconfig b/arch/mips/cobalt/Kconfig new file mode 100644 index 000000000000..7c42b088d16c --- /dev/null +++ b/arch/mips/cobalt/Kconfig | |||
@@ -0,0 +1,7 @@ | |||
1 | config EARLY_PRINTK | ||
2 | bool "Early console support" | ||
3 | depends on MIPS_COBALT | ||
4 | help | ||
5 | Provide early console support by direct access to the | ||
6 | on board UART. The UART must have been previously | ||
7 | initialised by the boot loader. | ||
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile index 3b6b7579d1de..720e757b2b64 100644 --- a/arch/mips/cobalt/Makefile +++ b/arch/mips/cobalt/Makefile | |||
@@ -4,4 +4,6 @@ | |||
4 | 4 | ||
5 | obj-y := irq.o int-handler.o reset.o setup.o | 5 | obj-y := irq.o int-handler.o reset.o setup.o |
6 | 6 | ||
7 | obj-$(CONFIG_EARLY_PRINTK) += console.o | ||
8 | |||
7 | EXTRA_AFLAGS := $(CFLAGS) | 9 | EXTRA_AFLAGS := $(CFLAGS) |
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c new file mode 100644 index 000000000000..45c2d27c7564 --- /dev/null +++ b/arch/mips/cobalt/console.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /* | ||
2 | * (C) P. Horton 2006 | ||
3 | */ | ||
4 | |||
5 | #include <linux/config.h> | ||
6 | #include <linux/init.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/console.h> | ||
9 | #include <linux/serial_reg.h> | ||
10 | #include <asm/addrspace.h> | ||
11 | #include <asm/mach-cobalt/cobalt.h> | ||
12 | |||
13 | static void putchar(int c) | ||
14 | { | ||
15 | if(c == '\n') | ||
16 | putchar('\r'); | ||
17 | |||
18 | while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE)) | ||
19 | ; | ||
20 | |||
21 | COBALT_UART[UART_TX] = c; | ||
22 | } | ||
23 | |||
24 | static void cons_write(struct console *c, const char *s, unsigned n) | ||
25 | { | ||
26 | while(n-- && *s) | ||
27 | putchar(*s++); | ||
28 | } | ||
29 | |||
30 | static struct console cons_info = | ||
31 | { | ||
32 | .name = "uart", | ||
33 | .write = cons_write, | ||
34 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
35 | .index = -1, | ||
36 | }; | ||
37 | |||
38 | void __init cobalt_early_console(void) | ||
39 | { | ||
40 | register_console(&cons_info); | ||
41 | |||
42 | printk("Cobalt: early console registered\n"); | ||
43 | } | ||
diff --git a/arch/mips/cobalt/setup.c b/arch/mips/cobalt/setup.c index b9713a723053..4f9ea1210023 100644 --- a/arch/mips/cobalt/setup.c +++ b/arch/mips/cobalt/setup.c | |||
@@ -31,6 +31,7 @@ | |||
31 | extern void cobalt_machine_restart(char *command); | 31 | extern void cobalt_machine_restart(char *command); |
32 | extern void cobalt_machine_halt(void); | 32 | extern void cobalt_machine_halt(void); |
33 | extern void cobalt_machine_power_off(void); | 33 | extern void cobalt_machine_power_off(void); |
34 | extern void cobalt_early_console(void); | ||
34 | 35 | ||
35 | int cobalt_board_id; | 36 | int cobalt_board_id; |
36 | 37 | ||
@@ -109,14 +110,6 @@ void __init plat_setup(void) | |||
109 | /* I/O port resource must include UART and LCD/buttons */ | 110 | /* I/O port resource must include UART and LCD/buttons */ |
110 | ioport_resource.end = 0x0fffffff; | 111 | ioport_resource.end = 0x0fffffff; |
111 | 112 | ||
112 | /* | ||
113 | * This is a prom style console. We just poke at the | ||
114 | * UART to make it talk. | ||
115 | * Only use this console if you really screw up and can't | ||
116 | * get to the stage of setting up a real serial console. | ||
117 | */ | ||
118 | /*ns16550_setup_console();*/ | ||
119 | |||
120 | /* request I/O space for devices used on all i[345]86 PCs */ | 113 | /* request I/O space for devices used on all i[345]86 PCs */ |
121 | for (i = 0; i < COBALT_IO_RESOURCES; i++) | 114 | for (i = 0; i < COBALT_IO_RESOURCES; i++) |
122 | request_resource(&ioport_resource, cobalt_io_resources + i); | 115 | request_resource(&ioport_resource, cobalt_io_resources + i); |
@@ -136,6 +129,10 @@ void __init plat_setup(void) | |||
136 | #ifdef CONFIG_SERIAL_8250 | 129 | #ifdef CONFIG_SERIAL_8250 |
137 | if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { | 130 | if (cobalt_board_id > COBALT_BRD_ID_RAQ1) { |
138 | 131 | ||
132 | #ifdef CONFIG_EARLY_PRINTK | ||
133 | cobalt_early_console(); | ||
134 | #endif | ||
135 | |||
139 | uart.line = 0; | 136 | uart.line = 0; |
140 | uart.type = PORT_UNKNOWN; | 137 | uart.type = PORT_UNKNOWN; |
141 | uart.uartclk = 18432000; | 138 | uart.uartclk = 18432000; |