All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.X] Early console for Cobalt
@ 2006-02-12 17:10 Peter Horton
  2006-02-13  2:43 ` Atsushi Nemoto
  2006-02-13  9:56 ` Ralf Baechle
  0 siblings, 2 replies; 6+ messages in thread
From: Peter Horton @ 2006-02-12 17:10 UTC (permalink / raw)
  To: linux-mips; +Cc: ralf

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.X] Early console for Cobalt
  2006-02-12 17:10 [PATCH 2.6.X] Early console for Cobalt Peter Horton
@ 2006-02-13  2:43 ` Atsushi Nemoto
  2006-02-13  4:18   ` Kumba
  2006-02-13 13:19   ` Ralf Baechle
  2006-02-13  9:56 ` Ralf Baechle
  1 sibling, 2 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2006-02-13  2:43 UTC (permalink / raw)
  To: pdh; +Cc: linux-mips, ralf

>>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
pdh> Adds early console support for Cobalts.

We already have EARLY_PRINTK.  How about using it?  (like dec does)

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.X] Early console for Cobalt
  2006-02-13  2:43 ` Atsushi Nemoto
@ 2006-02-13  4:18   ` Kumba
  2006-02-13  4:38     ` Atsushi Nemoto
  2006-02-13 13:19   ` Ralf Baechle
  1 sibling, 1 reply; 6+ messages in thread
From: Kumba @ 2006-02-13  4:18 UTC (permalink / raw)
  To: linux-mips

Atsushi Nemoto wrote:
>>>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
> pdh> Adds early console support for Cobalts.
> 
> We already have EARLY_PRINTK.  How about using it?  (like dec does)

I already tried getting early printk to work....Either it wasn't initializing 
early enough for my needs, I was enabling it incorrectly, or it just doesn't 
work on Cobalt.  This does work, however, and already pointed out one obvious 
flaw I have in a patch I've been using on Cobalt (setting cpu_scache_line_size 
to > 0 when cobalt lacks an scache).

For systems where the serial device can be difficult to use until initialized 
late in the boot cycle (Octane comes to mind), early_printk won't function either.

Maybe some kind of framework is needed for defining the kinds of early console 
various systems can support?


--Kumba

-- 
Gentoo/MIPS Team Lead
Gentoo Foundation Board of Trustees

"Such is oft the course of deeds that move the wheels of the world: small hands 
do them because they must, while the eyes of the great are elsewhere."  --Elrond

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.X] Early console for Cobalt
  2006-02-13  4:18   ` Kumba
@ 2006-02-13  4:38     ` Atsushi Nemoto
  0 siblings, 0 replies; 6+ messages in thread
From: Atsushi Nemoto @ 2006-02-13  4:38 UTC (permalink / raw)
  To: kumba; +Cc: linux-mips

>>>>> On Sun, 12 Feb 2006 23:18:57 -0500, Kumba <kumba@gentoo.org> said:
kumba> I already tried getting early printk to work....Either it
kumba> wasn't initializing early enough for my needs, I was enabling
kumba> it incorrectly, or it just doesn't work on Cobalt.  This does
kumba> work, however, and already pointed out one obvious flaw I have
kumba> in a patch I've been using on Cobalt (setting
kumba> cpu_scache_line_size to > 0 when cobalt lacks an scache).

Well, I do not have any objection to cobalt/console.c itself.  I just
mean let's use CONFIG_EARLY_PRINTK symbol instead of
CONFIG_COBALT_EARLY_CONSOLE (and add some other tweaks such as
implementing disable_early_printk()).

---
Atsushi Nemoto

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.X] Early console for Cobalt
  2006-02-12 17:10 [PATCH 2.6.X] Early console for Cobalt Peter Horton
  2006-02-13  2:43 ` Atsushi Nemoto
@ 2006-02-13  9:56 ` Ralf Baechle
  1 sibling, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2006-02-13  9:56 UTC (permalink / raw)
  To: Peter Horton; +Cc: linux-mips

On Sun, Feb 12, 2006 at 05:10:25PM +0000, Peter Horton wrote:

> Adds early console support for Cobalts.
> 
> Signed-off-by: Peter Horton <pdh@colonel-panic.org>

Queued for 2.6.17.

Please never include pathnames using the asm symlink like
linux.git/include/asm/mach-cobalt/cobalt.h in patches.  They do cause
rejects and are generally a PITA.  I also sent the #if 0'ed code in
console.c to /dev/hell.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2.6.X] Early console for Cobalt
  2006-02-13  2:43 ` Atsushi Nemoto
  2006-02-13  4:18   ` Kumba
@ 2006-02-13 13:19   ` Ralf Baechle
  1 sibling, 0 replies; 6+ messages in thread
From: Ralf Baechle @ 2006-02-13 13:19 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: pdh, linux-mips

On Mon, Feb 13, 2006 at 11:43:59AM +0900, Atsushi Nemoto wrote:

> >>>>> On Sun, 12 Feb 2006 17:10:25 +0000, Peter Horton <pdh@colonel-panic.org> said:
> pdh> Adds early console support for Cobalts.
> 
> We already have EARLY_PRINTK.  How about using it?  (like dec does)

Indeed, done.

  Ralf

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-02-13 13:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-12 17:10 [PATCH 2.6.X] Early console for Cobalt Peter Horton
2006-02-13  2:43 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.