aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2006-11-26 22:10:23 -0500
committerPaul Mundt <lethal@linux-sh.org>2006-12-05 20:45:39 -0500
commit6fc21b82ef74911887ced1aff8d37ce079bb8b36 (patch)
tree7accfcb402a530dcddb4d755f413e8098037801f /arch/sh
parent510c72ad2dd4e05e6908755f51ac89482c6eb987 (diff)
sh: More flexible + SH7780 earlyprintk SCIF support.
This makes the early printk support somewhat more flexible, moving the port definition to a config option, and making the port initialization configurable for sh-ipl+g users. At the same time, this allows us to trivially wire up the SH7780 SCIF0, so that's thrown in too more or less for free. Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig.debug18
-rw-r--r--arch/sh/kernel/early_printk.c44
2 files changed, 38 insertions, 24 deletions
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 48479e014dac..dcceec95a2d5 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -17,7 +17,18 @@ config SH_STANDARD_BIOS
17 17
18config EARLY_SCIF_CONSOLE 18config EARLY_SCIF_CONSOLE
19 bool "Use early SCIF console" 19 bool "Use early SCIF console"
20 depends on CPU_SH4 || CPU_SH2A && !SH_STANDARD_BIOS 20 help
21 This enables an early console using a fixed SCIF port. This can
22 be used by platforms that are either not running the SH
23 standard BIOS, or do not wish to use the BIOS callbacks for the
24 serial I/O.
25
26config EARLY_SCIF_CONSOLE_PORT
27 hex "SCIF port for early console"
28 depends on EARLY_SCIF_CONSOLE
29 default "0xffe00000" if CPU_SUBTYPE_SH7780
30 default "0xfffe9800" if CPU_SUBTYPE_SH72060
31 default "0xffe80000" if CPU_SH4
21 32
22config EARLY_PRINTK 33config EARLY_PRINTK
23 bool "Early printk support" 34 bool "Early printk support"
@@ -30,6 +41,11 @@ config EARLY_PRINTK
30 when the kernel may crash or hang before the serial console is 41 when the kernel may crash or hang before the serial console is
31 initialised. If unsure, say N. 42 initialised. If unsure, say N.
32 43
44 On devices that are running SH-IPL and want to keep the port
45 initialization consistent while not using the BIOS callbacks,
46 select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using
47 the kernel command line option to toggle back and forth.
48
33config DEBUG_STACKOVERFLOW 49config DEBUG_STACKOVERFLOW
34 bool "Check for stack overflows" 50 bool "Check for stack overflows"
35 depends on DEBUG_KERNEL 51 depends on DEBUG_KERNEL
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index a00022722e9e..60340823798a 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -12,7 +12,7 @@
12#include <linux/console.h> 12#include <linux/console.h>
13#include <linux/tty.h> 13#include <linux/tty.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm/io.h> 15#include <linux/io.h>
16 16
17#ifdef CONFIG_SH_STANDARD_BIOS 17#ifdef CONFIG_SH_STANDARD_BIOS
18#include <asm/sh_bios.h> 18#include <asm/sh_bios.h>
@@ -62,17 +62,9 @@ static struct console bios_console = {
62#include <linux/serial_core.h> 62#include <linux/serial_core.h>
63#include "../../../drivers/serial/sh-sci.h" 63#include "../../../drivers/serial/sh-sci.h"
64 64
65#ifdef CONFIG_CPU_SH4
66#define SCIF_REG 0xffe80000
67#elif defined(CONFIG_CPU_SUBTYPE_SH72060)
68#define SCIF_REG 0xfffe9800
69#else
70#error "Undefined SCIF for this subtype"
71#endif
72
73static struct uart_port scif_port = { 65static struct uart_port scif_port = {
74 .mapbase = SCIF_REG, 66 .mapbase = CONFIG_EARLY_SCIF_CONSOLE_PORT,
75 .membase = (char __iomem *)SCIF_REG, 67 .membase = (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT,
76}; 68};
77 69
78static void scif_sercon_putc(int c) 70static void scif_sercon_putc(int c)
@@ -113,23 +105,29 @@ static struct console scif_console = {
113 .index = -1, 105 .index = -1,
114}; 106};
115 107
108#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS)
109/*
110 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4
111 * devices that aren't using sh-ipl+g.
112 */
116static void scif_sercon_init(int baud) 113static void scif_sercon_init(int baud)
117{ 114{
118 ctrl_outw(0, SCIF_REG + 8); 115 ctrl_outw(0, scif_port.mapbase + 8);
119 ctrl_outw(0, SCIF_REG); 116 ctrl_outw(0, scif_port.mapbase);
120 117
121 /* Set baud rate */ 118 /* Set baud rate */
122 ctrl_outb((CONFIG_SH_PCLK_FREQ + 16 * baud) / 119 ctrl_outb((CONFIG_SH_PCLK_FREQ + 16 * baud) /
123 (32 * baud) - 1, SCIF_REG + 4); 120 (32 * baud) - 1, scif_port.mapbase + 4);
124 121
125 ctrl_outw(12, SCIF_REG + 24); 122 ctrl_outw(12, scif_port.mapbase + 24);
126 ctrl_outw(8, SCIF_REG + 24); 123 ctrl_outw(8, scif_port.mapbase + 24);
127 ctrl_outw(0, SCIF_REG + 32); 124 ctrl_outw(0, scif_port.mapbase + 32);
128 ctrl_outw(0x60, SCIF_REG + 16); 125 ctrl_outw(0x60, scif_port.mapbase + 16);
129 ctrl_outw(0, SCIF_REG + 36); 126 ctrl_outw(0, scif_port.mapbase + 36);
130 ctrl_outw(0x30, SCIF_REG + 8); 127 ctrl_outw(0x30, scif_port.mapbase + 8);
131} 128}
132#endif 129#endif /* CONFIG_CPU_SH4 && !CONFIG_SH_STANDARD_BIOS */
130#endif /* CONFIG_EARLY_SCIF_CONSOLE */
133 131
134/* 132/*
135 * Setup a default console, if more than one is compiled in, rely on the 133 * Setup a default console, if more than one is compiled in, rely on the
@@ -168,7 +166,7 @@ int __init setup_early_printk(char *opt)
168 if (!strncmp(buf, "serial", 6)) { 166 if (!strncmp(buf, "serial", 6)) {
169 early_console = &scif_console; 167 early_console = &scif_console;
170 168
171#ifdef CONFIG_CPU_SH4 169#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS)
172 scif_sercon_init(115200); 170 scif_sercon_init(115200);
173#endif 171#endif
174 } 172 }