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/console.c | |
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/console.c')
-rw-r--r-- | arch/mips/cobalt/console.c | 43 |
1 files changed, 43 insertions, 0 deletions
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 | } | ||