aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel/early_printk.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/kernel/early_printk.c')
-rw-r--r--arch/sh/kernel/early_printk.c49
1 files changed, 36 insertions, 13 deletions
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 80b637c30203..2f30977558ad 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka 4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2002 M. R. Brown 5 * Copyright (C) 2002 M. R. Brown
6 * Copyright (C) 2004 - 2006 Paul Mundt 6 * Copyright (C) 2004 - 2007 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -13,6 +13,7 @@
13#include <linux/tty.h> 13#include <linux/tty.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/delay.h>
16 17
17#ifdef CONFIG_SH_STANDARD_BIOS 18#ifdef CONFIG_SH_STANDARD_BIOS
18#include <asm/sh_bios.h> 19#include <asm/sh_bios.h>
@@ -62,6 +63,16 @@ static struct console bios_console = {
62#include <linux/serial_core.h> 63#include <linux/serial_core.h>
63#include "../../../drivers/serial/sh-sci.h" 64#include "../../../drivers/serial/sh-sci.h"
64 65
66#if defined(CONFIG_CPU_SUBTYPE_SH7720)
67#define EPK_SCSMR_VALUE 0x000
68#define EPK_SCBRR_VALUE 0x00C
69#define EPK_FIFO_SIZE 64
70#define EPK_FIFO_BITS (0x7f00 >> 8)
71#else
72#define EPK_FIFO_SIZE 16
73#define EPK_FIFO_BITS (0x1f00 >> 8)
74#endif
75
65static struct uart_port scif_port = { 76static struct uart_port scif_port = {
66 .mapbase = CONFIG_EARLY_SCIF_CONSOLE_PORT, 77 .mapbase = CONFIG_EARLY_SCIF_CONSOLE_PORT,
67 .membase = (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT, 78 .membase = (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT,
@@ -69,7 +80,7 @@ static struct uart_port scif_port = {
69 80
70static void scif_sercon_putc(int c) 81static void scif_sercon_putc(int c)
71{ 82{
72 while (((sci_in(&scif_port, SCFDR) & 0x1f00 >> 8) == 16)) 83 while (((sci_in(&scif_port, SCFDR) & EPK_FIFO_BITS) >= EPK_FIFO_SIZE))
73 ; 84 ;
74 85
75 sci_out(&scif_port, SCxTDR, c); 86 sci_out(&scif_port, SCxTDR, c);
@@ -105,7 +116,22 @@ static struct console scif_console = {
105 .index = -1, 116 .index = -1,
106}; 117};
107 118
108#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) 119#if !defined(CONFIG_SH_STANDARD_BIOS)
120#if defined(CONFIG_CPU_SUBTYPE_SH7720)
121static void scif_sercon_init(char *s)
122{
123 sci_out(&scif_port, SCSCR, 0x0000); /* clear TE and RE */
124 sci_out(&scif_port, SCFCR, 0x4006); /* reset */
125 sci_out(&scif_port, SCSCR, 0x0000); /* select internal clock */
126 sci_out(&scif_port, SCSMR, EPK_SCSMR_VALUE);
127 sci_out(&scif_port, SCBRR, EPK_SCBRR_VALUE);
128
129 mdelay(1); /* wait 1-bit time */
130
131 sci_out(&scif_port, SCFCR, 0x0030); /* TTRG=b'11 */
132 sci_out(&scif_port, SCSCR, 0x0030); /* TE, RE */
133}
134#elif defined(CONFIG_CPU_SH4)
109#define DEFAULT_BAUD 115200 135#define DEFAULT_BAUD 115200
110/* 136/*
111 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4 137 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4
@@ -146,7 +172,8 @@ static void scif_sercon_init(char *s)
146 ctrl_outw(0, scif_port.mapbase + 36); 172 ctrl_outw(0, scif_port.mapbase + 36);
147 ctrl_outw(0x30, scif_port.mapbase + 8); 173 ctrl_outw(0x30, scif_port.mapbase + 8);
148} 174}
149#endif /* CONFIG_CPU_SH4 && !CONFIG_SH_STANDARD_BIOS */ 175#endif /* defined(CONFIG_CPU_SUBTYPE_SH7720) */
176#endif /* !defined(CONFIG_SH_STANDARD_BIOS) */
150#endif /* CONFIG_EARLY_SCIF_CONSOLE */ 177#endif /* CONFIG_EARLY_SCIF_CONSOLE */
151 178
152/* 179/*
@@ -163,17 +190,12 @@ static struct console *early_console =
163#endif 190#endif
164 ; 191 ;
165 192
166static int __initdata keep_early; 193static int __init setup_early_printk(char *buf)
167static int early_console_initialized;
168
169int __init setup_early_printk(char *buf)
170{ 194{
171 if (!buf) 195 int keep_early = 0;
172 return 0;
173 196
174 if (early_console_initialized) 197 if (!buf)
175 return 0; 198 return 0;
176 early_console_initialized = 1;
177 199
178 if (strstr(buf, "keep")) 200 if (strstr(buf, "keep"))
179 keep_early = 1; 201 keep_early = 1;
@@ -186,7 +208,8 @@ int __init setup_early_printk(char *buf)
186 if (!strncmp(buf, "serial", 6)) { 208 if (!strncmp(buf, "serial", 6)) {
187 early_console = &scif_console; 209 early_console = &scif_console;
188 210
189#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) 211#if (defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SUBTYPE_SH7720)) && \
212 !defined(CONFIG_SH_STANDARD_BIOS)
190 scif_sercon_init(buf + 6); 213 scif_sercon_init(buf + 6);
191#endif 214#endif
192 } 215 }