From: Peter Horton <pdh@colonel-panic.org>
To: linux-mips@linux-mips.org
Cc: ralf@linux-mips.org
Subject: [PATCH 2.6.X] Early console for Cobalt
Date: Sun, 12 Feb 2006 17:10:25 +0000 [thread overview]
Message-ID: <20060212171025.GB1562@colonel-panic.org> (raw)
Adds early console support for Cobalts.
Signed-off-by: Peter Horton <pdh@colonel-panic.org>
P.
Index: linux.git/arch/mips/cobalt/setup.c
===================================================================
--- linux.git.orig/arch/mips/cobalt/setup.c 2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/cobalt/setup.c 2006-02-12 16:40:54.000000000 +0000
@@ -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 @@
/* 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 @@
#ifdef CONFIG_SERIAL_8250
if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
+#ifdef CONFIG_COBALT_EARLY_CONSOLE
+ cobalt_early_console();
+#endif
+
uart.line = 0;
uart.type = PORT_UNKNOWN;
uart.uartclk = 18432000;
Index: linux.git/arch/mips/cobalt/Makefile
===================================================================
--- linux.git.orig/arch/mips/cobalt/Makefile 2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/cobalt/Makefile 2006-02-12 16:39:25.000000000 +0000
@@ -4,4 +4,6 @@
obj-y := irq.o int-handler.o reset.o setup.o
+obj-$(CONFIG_COBALT_EARLY_CONSOLE) += console.o
+
EXTRA_AFLAGS := $(CFLAGS)
Index: linux.git/arch/mips/cobalt/console.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux.git/arch/mips/cobalt/console.c 2006-02-12 16:42:05.000000000 +0000
@@ -0,0 +1,60 @@
+/*
+ * (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>
+
+#if 0
+
+static int kbhit(void)
+{
+ return COBALT_UART[UART_LSR] & UART_LSR_DR;
+}
+
+static int getch(void)
+{
+ while(!kbhit())
+ ;
+
+ return (unsigned char) COBALT_UART[UART_RX];
+}
+
+#endif
+
+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: linux.git/include/asm/mach-cobalt/cobalt.h
===================================================================
--- linux.git.orig/include/asm/mach-cobalt/cobalt.h 2006-02-12 14:34:12.000000000 +0000
+++ linux.git/include/asm/mach-cobalt/cobalt.h 2006-02-12 15:54:51.000000000 +0000
@@ -113,4 +113,6 @@
# define COBALT_KEY_SELECT (1 << 7)
# define COBALT_KEY_MASK 0xfe
+#define COBALT_UART ((volatile unsigned char *) CKSEG1ADDR(0x1c800000))
+
#endif /* __ASM_COBALT_H */
Index: linux.git/arch/mips/Kconfig
===================================================================
--- linux.git.orig/arch/mips/Kconfig 2006-02-12 14:33:51.000000000 +0000
+++ linux.git/arch/mips/Kconfig 2006-02-12 16:33:25.000000000 +0000
@@ -787,6 +787,7 @@
source "arch/mips/tx4938/Kconfig"
source "arch/mips/vr41xx/Kconfig"
source "arch/mips/philips/pnx8550/common/Kconfig"
+source "arch/mips/cobalt/Kconfig"
endmenu
Index: linux.git/arch/mips/cobalt/Kconfig
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux.git/arch/mips/cobalt/Kconfig 2006-02-12 16:45:14.000000000 +0000
@@ -0,0 +1,7 @@
+config COBALT_EARLY_CONSOLE
+ 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.
next reply other threads:[~2006-02-12 17:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-12 17:10 Peter Horton [this message]
2006-02-13 2:43 ` [PATCH 2.6.X] Early console for Cobalt Atsushi Nemoto
2006-02-13 4:18 ` Kumba
2006-02-13 4:38 ` Atsushi Nemoto
2006-02-13 13:19 ` Ralf Baechle
2006-02-13 9:56 ` Ralf Baechle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060212171025.GB1562@colonel-panic.org \
--to=pdh@colonel-panic.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox