]> err.no Git - linux-2.6/commitdiff
[MIPS] Add early console for Cobalt.
authorPeter Horton <pdh@colonel-panic.org>
Sun, 12 Feb 2006 17:10:25 +0000 (17:10 +0000)
committerRalf Baechle <ralf@linux-mips.org>
Tue, 21 Mar 2006 13:27:44 +0000 (13:27 +0000)
Signed-off-by: Peter Horton <pdh@colonel-panic.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/Kconfig
arch/mips/cobalt/Kconfig [new file with mode: 0644]
arch/mips/cobalt/Makefile
arch/mips/cobalt/console.c [new file with mode: 0644]
arch/mips/cobalt/setup.c
include/asm-mips/mach-cobalt/cobalt.h

index 3a0f89d2c8dc91586e6e189cf9d0eaa2082e916e..9d1e78f9c0604b7a4a077bb11cb0b81f250b97ed 100644 (file)
@@ -790,6 +790,7 @@ source "arch/mips/tx4927/Kconfig"
 source "arch/mips/tx4938/Kconfig"
 source "arch/mips/vr41xx/Kconfig"
 source "arch/mips/philips/pnx8550/common/Kconfig"
+source "arch/mips/cobalt/Kconfig"
 
 endmenu
 
diff --git a/arch/mips/cobalt/Kconfig b/arch/mips/cobalt/Kconfig
new file mode 100644 (file)
index 0000000..7c42b08
--- /dev/null
@@ -0,0 +1,7 @@
+config EARLY_PRINTK
+       bool "Early console support"
+       depends on MIPS_COBALT
+       help
+         Provide early console support by direct access to the
+         on board UART. The UART must have been previously
+         initialised by the boot loader.
index 3b6b7579d1dee8e36b86189069cecffba594f218..720e757b2b6413cded55f094fc802bd565671412 100644 (file)
@@ -4,4 +4,6 @@
 
 obj-y   := irq.o int-handler.o reset.o setup.o
 
+obj-$(CONFIG_EARLY_PRINTK)     += console.o
+
 EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/cobalt/console.c b/arch/mips/cobalt/console.c
new file mode 100644 (file)
index 0000000..45c2d27
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * (C) P. Horton 2006
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/console.h>
+#include <linux/serial_reg.h>
+#include <asm/addrspace.h>
+#include <asm/mach-cobalt/cobalt.h>
+
+static void putchar(int c)
+{
+       if(c == '\n')
+               putchar('\r');
+
+       while(!(COBALT_UART[UART_LSR] & UART_LSR_THRE))
+               ;
+
+       COBALT_UART[UART_TX] = c;
+}
+
+static void cons_write(struct console *c, const char *s, unsigned n)
+{
+       while(n-- && *s)
+               putchar(*s++);
+}
+
+static struct console cons_info =
+{
+       .name   = "uart",
+       .write  = cons_write,
+       .flags  = CON_PRINTBUFFER | CON_BOOT,
+       .index  = -1,
+};
+
+void __init cobalt_early_console(void)
+{
+       register_console(&cons_info);
+
+       printk("Cobalt: early console registered\n");
+}
index b9713a7230536aeaf098d82538c092f34d26ae8c..4f9ea121002389cdbd5ce874017efbc0e40d12af 100644 (file)
@@ -31,6 +31,7 @@
 extern void cobalt_machine_restart(char *command);
 extern void cobalt_machine_halt(void);
 extern void cobalt_machine_power_off(void);
+extern void cobalt_early_console(void);
 
 int cobalt_board_id;
 
@@ -109,14 +110,6 @@ void __init plat_setup(void)
        /* I/O port resource must include UART and LCD/buttons */
        ioport_resource.end = 0x0fffffff;
 
-       /*
-        * This is a prom style console. We just poke at the
-        *  UART to make it talk.
-        * Only use this console if you really screw up and can't
-        *  get to the stage of setting up a real serial console.
-        */
-       /*ns16550_setup_console();*/
-
        /* request I/O space for devices used on all i[345]86 PCs */
        for (i = 0; i < COBALT_IO_RESOURCES; i++)
                request_resource(&ioport_resource, cobalt_io_resources + i);
@@ -136,6 +129,10 @@ void __init plat_setup(void)
 #ifdef CONFIG_SERIAL_8250
        if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
 
+#ifdef CONFIG_EARLY_PRINTK
+               cobalt_early_console();
+#endif
+
                uart.line       = 0;
                uart.type       = PORT_UNKNOWN;
                uart.uartclk    = 18432000;
index 78e1df2095fbccf103fb9c159e4317ac531c8dbf..b3c5ecbec03cc75408c516425a53560f8585c9f1 100644 (file)
@@ -113,4 +113,6 @@ do {                                                                        \
 # define COBALT_KEY_SELECT     (1 << 7)
 # define COBALT_KEY_MASK       0xfe
 
+#define COBALT_UART            ((volatile unsigned char *) CKSEG1ADDR(0x1c800000))
+
 #endif /* __ASM_COBALT_H */