aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/68360serial.c7
-rw-r--r--drivers/serial/8250.c28
-rw-r--r--drivers/serial/8250_early.c117
-rw-r--r--drivers/serial/Kconfig14
-rw-r--r--drivers/serial/atmel_serial.c32
-rw-r--r--drivers/serial/ip22zilog.c3
-rw-r--r--drivers/serial/serial_core.c6
-rw-r--r--drivers/serial/sh-sci.c4
-rw-r--r--drivers/serial/sh-sci.h50
-rw-r--r--drivers/serial/sn_console.c4
10 files changed, 166 insertions, 99 deletions
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index 68817a7d8c0d..2aa6bfe8fdb3 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -934,8 +934,6 @@ static void change_speed(ser_info_t *info)
934 /* 934 /*
935 * Set up parity check flag 935 * Set up parity check flag
936 */ 936 */
937#define RELEVANT_IFLAG(iflag) (iflag & (IGNBRK|BRKINT|IGNPAR|PARMRK|INPCK))
938
939 info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV); 937 info->read_status_mask = (BD_SC_EMPTY | BD_SC_OV);
940 if (I_INPCK(info->tty)) 938 if (I_INPCK(info->tty))
941 info->read_status_mask |= BD_SC_FR | BD_SC_PR; 939 info->read_status_mask |= BD_SC_FR | BD_SC_PR;
@@ -1527,11 +1525,6 @@ static void rs_360_set_termios(struct tty_struct *tty, struct ktermios *old_term
1527{ 1525{
1528 ser_info_t *info = (ser_info_t *)tty->driver_data; 1526 ser_info_t *info = (ser_info_t *)tty->driver_data;
1529 1527
1530 if ( (tty->termios->c_cflag == old_termios->c_cflag)
1531 && ( RELEVANT_IFLAG(tty->termios->c_iflag)
1532 == RELEVANT_IFLAG(old_termios->c_iflag)))
1533 return;
1534
1535 change_speed(info); 1528 change_speed(info);
1536 1529
1537#ifdef modem_control 1530#ifdef modem_control
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index c84dab083a85..0b3ec38ae614 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -2514,12 +2514,18 @@ static int __init serial8250_console_setup(struct console *co, char *options)
2514 return uart_set_options(port, co, baud, parity, bits, flow); 2514 return uart_set_options(port, co, baud, parity, bits, flow);
2515} 2515}
2516 2516
2517static int __init serial8250_console_early_setup(void)
2518{
2519 return serial8250_find_port_for_earlycon();
2520}
2521
2517static struct uart_driver serial8250_reg; 2522static struct uart_driver serial8250_reg;
2518static struct console serial8250_console = { 2523static struct console serial8250_console = {
2519 .name = "ttyS", 2524 .name = "ttyS",
2520 .write = serial8250_console_write, 2525 .write = serial8250_console_write,
2521 .device = uart_console_device, 2526 .device = uart_console_device,
2522 .setup = serial8250_console_setup, 2527 .setup = serial8250_console_setup,
2528 .early_setup = serial8250_console_early_setup,
2523 .flags = CON_PRINTBUFFER, 2529 .flags = CON_PRINTBUFFER,
2524 .index = -1, 2530 .index = -1,
2525 .data = &serial8250_reg, 2531 .data = &serial8250_reg,
@@ -2533,7 +2539,7 @@ static int __init serial8250_console_init(void)
2533} 2539}
2534console_initcall(serial8250_console_init); 2540console_initcall(serial8250_console_init);
2535 2541
2536static int __init find_port(struct uart_port *p) 2542int serial8250_find_port(struct uart_port *p)
2537{ 2543{
2538 int line; 2544 int line;
2539 struct uart_port *port; 2545 struct uart_port *port;
@@ -2546,26 +2552,6 @@ static int __init find_port(struct uart_port *p)
2546 return -ENODEV; 2552 return -ENODEV;
2547} 2553}
2548 2554
2549int __init serial8250_start_console(struct uart_port *port, char *options)
2550{
2551 int line;
2552
2553 line = find_port(port);
2554 if (line < 0)
2555 return -ENODEV;
2556
2557 add_preferred_console("ttyS", line, options);
2558 printk("Adding console on ttyS%d at %s 0x%lx (options '%s')\n",
2559 line, port->iotype == UPIO_MEM ? "MMIO" : "I/O port",
2560 port->iotype == UPIO_MEM ? (unsigned long) port->mapbase :
2561 (unsigned long) port->iobase, options);
2562 if (!(serial8250_console.flags & CON_ENABLED)) {
2563 serial8250_console.flags &= ~CON_PRINTBUFFER;
2564 register_console(&serial8250_console);
2565 }
2566 return line;
2567}
2568
2569#define SERIAL8250_CONSOLE &serial8250_console 2555#define SERIAL8250_CONSOLE &serial8250_console
2570#else 2556#else
2571#define SERIAL8250_CONSOLE NULL 2557#define SERIAL8250_CONSOLE NULL
diff --git a/drivers/serial/8250_early.c b/drivers/serial/8250_early.c
index 7e511199b4c5..947c20507e1f 100644
--- a/drivers/serial/8250_early.c
+++ b/drivers/serial/8250_early.c
@@ -17,13 +17,11 @@
17 * we locate the device directly by its MMIO or I/O port address. 17 * we locate the device directly by its MMIO or I/O port address.
18 * 18 *
19 * The user can specify the device directly, e.g., 19 * The user can specify the device directly, e.g.,
20 * console=uart,io,0x3f8,9600n8 20 * earlycon=uart8250,io,0x3f8,9600n8
21 * console=uart,mmio,0xff5e0000,115200n8 21 * earlycon=uart8250,mmio,0xff5e0000,115200n8
22 * or platform code can call early_uart_console_init() to set 22 * or
23 * the early UART device. 23 * console=uart8250,io,0x3f8,9600n8
24 * 24 * console=uart8250,mmio,0xff5e0000,115200n8
25 * After the normal serial driver starts, we try to locate the
26 * matching ttyS device and start a console there.
27 */ 25 */
28 26
29#include <linux/tty.h> 27#include <linux/tty.h>
@@ -32,17 +30,21 @@
32#include <linux/serial_core.h> 30#include <linux/serial_core.h>
33#include <linux/serial_reg.h> 31#include <linux/serial_reg.h>
34#include <linux/serial.h> 32#include <linux/serial.h>
33#include <linux/serial_8250.h>
35#include <asm/io.h> 34#include <asm/io.h>
36#include <asm/serial.h> 35#include <asm/serial.h>
36#ifdef CONFIG_FIX_EARLYCON_MEM
37#include <asm/pgtable.h>
38#include <asm/fixmap.h>
39#endif
37 40
38struct early_uart_device { 41struct early_serial8250_device {
39 struct uart_port port; 42 struct uart_port port;
40 char options[16]; /* e.g., 115200n8 */ 43 char options[16]; /* e.g., 115200n8 */
41 unsigned int baud; 44 unsigned int baud;
42}; 45};
43 46
44static struct early_uart_device early_device __initdata; 47static struct early_serial8250_device early_device;
45static int early_uart_registered __initdata;
46 48
47static unsigned int __init serial_in(struct uart_port *port, int offset) 49static unsigned int __init serial_in(struct uart_port *port, int offset)
48{ 50{
@@ -80,7 +82,7 @@ static void __init putc(struct uart_port *port, int c)
80 serial_out(port, UART_TX, c); 82 serial_out(port, UART_TX, c);
81} 83}
82 84
83static void __init early_uart_write(struct console *console, const char *s, unsigned int count) 85static void __init early_serial8250_write(struct console *console, const char *s, unsigned int count)
84{ 86{
85 struct uart_port *port = &early_device.port; 87 struct uart_port *port = &early_device.port;
86 unsigned int ier; 88 unsigned int ier;
@@ -111,7 +113,7 @@ static unsigned int __init probe_baud(struct uart_port *port)
111 return (port->uartclk / 16) / quot; 113 return (port->uartclk / 16) / quot;
112} 114}
113 115
114static void __init init_port(struct early_uart_device *device) 116static void __init init_port(struct early_serial8250_device *device)
115{ 117{
116 struct uart_port *port = &device->port; 118 struct uart_port *port = &device->port;
117 unsigned int divisor; 119 unsigned int divisor;
@@ -130,10 +132,9 @@ static void __init init_port(struct early_uart_device *device)
130 serial_out(port, UART_LCR, c & ~UART_LCR_DLAB); 132 serial_out(port, UART_LCR, c & ~UART_LCR_DLAB);
131} 133}
132 134
133static int __init parse_options(struct early_uart_device *device, char *options) 135static int __init parse_options(struct early_serial8250_device *device, char *options)
134{ 136{
135 struct uart_port *port = &device->port; 137 struct uart_port *port = &device->port;
136 int mapsize = 64;
137 int mmio, length; 138 int mmio, length;
138 139
139 if (!options) 140 if (!options)
@@ -143,12 +144,18 @@ static int __init parse_options(struct early_uart_device *device, char *options)
143 if (!strncmp(options, "mmio,", 5)) { 144 if (!strncmp(options, "mmio,", 5)) {
144 port->iotype = UPIO_MEM; 145 port->iotype = UPIO_MEM;
145 port->mapbase = simple_strtoul(options + 5, &options, 0); 146 port->mapbase = simple_strtoul(options + 5, &options, 0);
146 port->membase = ioremap(port->mapbase, mapsize); 147#ifdef CONFIG_FIX_EARLYCON_MEM
148 set_fixmap_nocache(FIX_EARLYCON_MEM_BASE, port->mapbase & PAGE_MASK);
149 port->membase = (void __iomem *)__fix_to_virt(FIX_EARLYCON_MEM_BASE);
150 port->membase += port->mapbase & ~PAGE_MASK;
151#else
152 port->membase = ioremap(port->mapbase, 64);
147 if (!port->membase) { 153 if (!port->membase) {
148 printk(KERN_ERR "%s: Couldn't ioremap 0x%lx\n", 154 printk(KERN_ERR "%s: Couldn't ioremap 0x%lx\n",
149 __FUNCTION__, port->mapbase); 155 __FUNCTION__, port->mapbase);
150 return -ENOMEM; 156 return -ENOMEM;
151 } 157 }
158#endif
152 mmio = 1; 159 mmio = 1;
153 } else if (!strncmp(options, "io,", 3)) { 160 } else if (!strncmp(options, "io,", 3)) {
154 port->iotype = UPIO_PORT; 161 port->iotype = UPIO_PORT;
@@ -175,9 +182,16 @@ static int __init parse_options(struct early_uart_device *device, char *options)
175 return 0; 182 return 0;
176} 183}
177 184
178static int __init early_uart_setup(struct console *console, char *options) 185static struct console early_serial8250_console __initdata = {
186 .name = "uart",
187 .write = early_serial8250_write,
188 .flags = CON_PRINTBUFFER | CON_BOOT,
189 .index = -1,
190};
191
192static int __init early_serial8250_setup(char *options)
179{ 193{
180 struct early_uart_device *device = &early_device; 194 struct early_serial8250_device *device = &early_device;
181 int err; 195 int err;
182 196
183 if (device->port.membase || device->port.iobase) 197 if (device->port.membase || device->port.iobase)
@@ -190,61 +204,48 @@ static int __init early_uart_setup(struct console *console, char *options)
190 return 0; 204 return 0;
191} 205}
192 206
193static struct console early_uart_console __initdata = { 207int __init setup_early_serial8250_console(char *cmdline)
194 .name = "uart",
195 .write = early_uart_write,
196 .setup = early_uart_setup,
197 .flags = CON_PRINTBUFFER,
198 .index = -1,
199};
200
201static int __init early_uart_console_init(void)
202{
203 if (!early_uart_registered) {
204 register_console(&early_uart_console);
205 early_uart_registered = 1;
206 }
207 return 0;
208}
209console_initcall(early_uart_console_init);
210
211int __init early_serial_console_init(char *cmdline)
212{ 208{
213 char *options; 209 char *options;
214 int err; 210 int err;
215 211
216 options = strstr(cmdline, "console=uart,"); 212 options = strstr(cmdline, "uart8250,");
217 if (!options) 213 if (!options) {
218 return -ENODEV; 214 options = strstr(cmdline, "uart,");
215 if (!options)
216 return 0;
217 }
219 218
220 options = strchr(cmdline, ',') + 1; 219 options = strchr(cmdline, ',') + 1;
221 if ((err = early_uart_setup(NULL, options)) < 0) 220 if ((err = early_serial8250_setup(options)) < 0)
222 return err; 221 return err;
223 return early_uart_console_init(); 222
223 register_console(&early_serial8250_console);
224
225 return 0;
224} 226}
225 227
226static int __init early_uart_console_switch(void) 228int __init serial8250_find_port_for_earlycon(void)
227{ 229{
228 struct early_uart_device *device = &early_device; 230 struct early_serial8250_device *device = &early_device;
229 struct uart_port *port = &device->port; 231 struct uart_port *port = &device->port;
230 int mmio, line; 232 int line;
233 int ret;
231 234
232 if (!(early_uart_console.flags & CON_ENABLED)) 235 if (!device->port.membase && !device->port.iobase)
233 return 0; 236 return -ENODEV;
234 237
235 /* Try to start the normal driver on a matching line. */ 238 line = serial8250_find_port(port);
236 mmio = (port->iotype == UPIO_MEM);
237 line = serial8250_start_console(port, device->options);
238 if (line < 0) 239 if (line < 0)
239 printk("No ttyS device at %s 0x%lx for console\n", 240 return -ENODEV;
240 mmio ? "MMIO" : "I/O port",
241 mmio ? port->mapbase :
242 (unsigned long) port->iobase);
243 241
244 unregister_console(&early_uart_console); 242 ret = update_console_cmdline("uart", 8250,
245 if (mmio) 243 "ttyS", line, device->options);
246 iounmap(port->membase); 244 if (ret < 0)
245 ret = update_console_cmdline("uart", 0,
246 "ttyS", line, device->options);
247 247
248 return 0; 248 return ret;
249} 249}
250late_initcall(early_uart_console_switch); 250
251early_param("earlycon", setup_early_serial8250_console);
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 2adbed4e10f3..cab42cbd920d 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -62,8 +62,22 @@ config SERIAL_8250_CONSOLE
62 kernel will automatically use the first serial line, /dev/ttyS0, as 62 kernel will automatically use the first serial line, /dev/ttyS0, as
63 system console. 63 system console.
64 64
65 you can set that using a kernel command line option such as
66 "console=uart8250,io,0x3f8,9600n8"
67 "console=uart8250,mmio,0xff5e0000,115200n8".
68 and it will switch to normal serial console when correponding port is
69 ready.
70 "earlycon=uart8250,io,0x3f8,9600n8"
71 "earlycon=uart8250,mmio,0xff5e0000,115200n8".
72 it will not only setup early console.
73
65 If unsure, say N. 74 If unsure, say N.
66 75
76config FIX_EARLYCON_MEM
77 bool
78 depends on X86
79 default y
80
67config SERIAL_8250_GSC 81config SERIAL_8250_GSC
68 tristate 82 tristate
69 depends on SERIAL_8250 && GSC 83 depends on SERIAL_8250 && GSC
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 3320bcd92c0a..4d6b3c56d20e 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -114,6 +114,7 @@ struct atmel_uart_port {
114 struct uart_port uart; /* uart */ 114 struct uart_port uart; /* uart */
115 struct clk *clk; /* uart clock */ 115 struct clk *clk; /* uart clock */
116 unsigned short suspended; /* is port suspended? */ 116 unsigned short suspended; /* is port suspended? */
117 int break_active; /* break being received */
117}; 118};
118 119
119static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART]; 120static struct atmel_uart_port atmel_ports[ATMEL_MAX_UART];
@@ -252,6 +253,7 @@ static void atmel_break_ctl(struct uart_port *port, int break_state)
252 */ 253 */
253static void atmel_rx_chars(struct uart_port *port) 254static void atmel_rx_chars(struct uart_port *port)
254{ 255{
256 struct atmel_uart_port *atmel_port = (struct atmel_uart_port *) port;
255 struct tty_struct *tty = port->info->tty; 257 struct tty_struct *tty = port->info->tty;
256 unsigned int status, ch, flg; 258 unsigned int status, ch, flg;
257 259
@@ -267,13 +269,29 @@ static void atmel_rx_chars(struct uart_port *port)
267 * note that the error handling code is 269 * note that the error handling code is
268 * out of the main execution path 270 * out of the main execution path
269 */ 271 */
270 if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME | ATMEL_US_OVRE | ATMEL_US_RXBRK))) { 272 if (unlikely(status & (ATMEL_US_PARE | ATMEL_US_FRAME
273 | ATMEL_US_OVRE | ATMEL_US_RXBRK)
274 || atmel_port->break_active)) {
271 UART_PUT_CR(port, ATMEL_US_RSTSTA); /* clear error */ 275 UART_PUT_CR(port, ATMEL_US_RSTSTA); /* clear error */
272 if (status & ATMEL_US_RXBRK) { 276 if (status & ATMEL_US_RXBRK
277 && !atmel_port->break_active) {
273 status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME); /* ignore side-effect */ 278 status &= ~(ATMEL_US_PARE | ATMEL_US_FRAME); /* ignore side-effect */
274 port->icount.brk++; 279 port->icount.brk++;
280 atmel_port->break_active = 1;
281 UART_PUT_IER(port, ATMEL_US_RXBRK);
275 if (uart_handle_break(port)) 282 if (uart_handle_break(port))
276 goto ignore_char; 283 goto ignore_char;
284 } else {
285 /*
286 * This is either the end-of-break
287 * condition or we've received at
288 * least one character without RXBRK
289 * being set. In both cases, the next
290 * RXBRK will indicate start-of-break.
291 */
292 UART_PUT_IDR(port, ATMEL_US_RXBRK);
293 status &= ~ATMEL_US_RXBRK;
294 atmel_port->break_active = 0;
277 } 295 }
278 if (status & ATMEL_US_PARE) 296 if (status & ATMEL_US_PARE)
279 port->icount.parity++; 297 port->icount.parity++;
@@ -352,6 +370,16 @@ static irqreturn_t atmel_interrupt(int irq, void *dev_id)
352 /* Interrupt receive */ 370 /* Interrupt receive */
353 if (pending & ATMEL_US_RXRDY) 371 if (pending & ATMEL_US_RXRDY)
354 atmel_rx_chars(port); 372 atmel_rx_chars(port);
373 else if (pending & ATMEL_US_RXBRK) {
374 /*
375 * End of break detected. If it came along
376 * with a character, atmel_rx_chars will
377 * handle it.
378 */
379 UART_PUT_CR(port, ATMEL_US_RSTSTA);
380 UART_PUT_IDR(port, ATMEL_US_RXBRK);
381 atmel_port->break_active = 0;
382 }
355 383
356 // TODO: All reads to CSR will clear these interrupts! 384 // TODO: All reads to CSR will clear these interrupts!
357 if (pending & ATMEL_US_RIIC) port->icount.rng++; 385 if (pending & ATMEL_US_RIIC) port->icount.rng++;
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c
index c3abfb39f316..f3257f708ef9 100644
--- a/drivers/serial/ip22zilog.c
+++ b/drivers/serial/ip22zilog.c
@@ -862,6 +862,7 @@ ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios,
862 up->cflag = termios->c_cflag; 862 up->cflag = termios->c_cflag;
863 863
864 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); 864 ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port));
865 uart_update_timeout(port, termios->c_cflag, baud);
865 866
866 spin_unlock_irqrestore(&up->port.lock, flags); 867 spin_unlock_irqrestore(&up->port.lock, flags);
867} 868}
@@ -1017,6 +1018,8 @@ ip22serial_console_termios(struct console *con, char *options)
1017 } 1018 }
1018 1019
1019 con->cflag = cflag | CS8; /* 8N1 */ 1020 con->cflag = cflag | CS8; /* 8N1 */
1021
1022 uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud);
1020} 1023}
1021 1024
1022static int __init ip22zilog_console_setup(struct console *con, char *options) 1025static int __init ip22zilog_console_setup(struct console *con, char *options)
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index 326020f86f75..9c57486c2e7f 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1910,6 +1910,12 @@ uart_set_options(struct uart_port *port, struct console *co,
1910 if (flow == 'r') 1910 if (flow == 'r')
1911 termios.c_cflag |= CRTSCTS; 1911 termios.c_cflag |= CRTSCTS;
1912 1912
1913 /*
1914 * some uarts on other side don't support no flow control.
1915 * So we set * DTR in host uart to make them happy
1916 */
1917 port->mctrl |= TIOCM_DTR;
1918
1913 port->ops->set_termios(port, &termios, NULL); 1919 port->ops->set_termios(port, &termios, NULL);
1914 co->cflag = termios.c_cflag; 1920 co->cflag = termios.c_cflag;
1915 1921
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 1f89496d530e..672cd1042539 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -367,7 +367,9 @@ static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
367 } else { 367 } else {
368#ifdef CONFIG_CPU_SUBTYPE_SH7343 368#ifdef CONFIG_CPU_SUBTYPE_SH7343
369 /* Nothing */ 369 /* Nothing */
370#elif defined(CONFIG_CPU_SUBTYPE_SH7780) || defined(CONFIG_CPU_SUBTYPE_SH7785) 370#elif defined(CONFIG_CPU_SUBTYPE_SH7780) || \
371 defined(CONFIG_CPU_SUBTYPE_SH7785) || \
372 defined(CONFIG_CPU_SUBTYPE_SHX3)
371 ctrl_outw(0x0080, SCSPTR0); /* Set RTS = 1 */ 373 ctrl_outw(0x0080, SCSPTR0); /* Set RTS = 1 */
372#else 374#else
373 ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */ 375 ctrl_outw(0x0080, SCSPTR2); /* Set RTS = 1 */
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h
index fb04fb5f9843..247fb66bf0f4 100644
--- a/drivers/serial/sh-sci.h
+++ b/drivers/serial/sh-sci.h
@@ -53,7 +53,12 @@
53# define SCIF_ORER 0x0001 /* overrun error bit */ 53# define SCIF_ORER 0x0001 /* overrun error bit */
54# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 54# define SCSCR_INIT(port) 0x3a /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
55# define SCIF_ONLY 55# define SCIF_ONLY
56#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || defined(CONFIG_CPU_SUBTYPE_SH7751) 56#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
57 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
58 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
59 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
60 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
61 defined(CONFIG_CPU_SUBTYPE_SH7751R)
57# define SCSPTR1 0xffe0001c /* 8 bit SCI */ 62# define SCSPTR1 0xffe0001c /* 8 bit SCI */
58# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */ 63# define SCSPTR2 0xFFE80020 /* 16 bit SCIF */
59# define SCIF_ORER 0x0001 /* overrun error bit */ 64# define SCIF_ORER 0x0001 /* overrun error bit */
@@ -73,7 +78,7 @@
73# define SCPDR 0xA4050136 /* 16 bit SCIF */ 78# define SCPDR 0xA4050136 /* 16 bit SCIF */
74# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */ 79# define SCSCR_INIT(port) 0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
75# define SCIF_ONLY 80# define SCIF_ONLY
76#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 81#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
77# define SCSPTR0 0xA4400000 /* 16 bit SCIF */ 82# define SCSPTR0 0xA4400000 /* 16 bit SCIF */
78# define SCI_NPORTS 2 83# define SCI_NPORTS 2
79# define SCIF_ORER 0x0001 /* overrun error bit */ 84# define SCIF_ORER 0x0001 /* overrun error bit */
@@ -168,6 +173,14 @@
168# define SCIF_ORER 0x0001 /* overrun error bit */ 173# define SCIF_ORER 0x0001 /* overrun error bit */
169# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */ 174# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
170# define SCIF_ONLY 175# define SCIF_ONLY
176#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
177# define SCSPTR0 0xffc30020 /* 16 bit SCIF */
178# define SCSPTR1 0xffc40020 /* 16 bit SCIF */
179# define SCSPTR2 0xffc50020 /* 16 bit SCIF */
180# define SCSPTR3 0xffc60020 /* 16 bit SCIF */
181# define SCIF_ORER 0x0001 /* Overrun error bit */
182# define SCSCR_INIT(port) 0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
183# define SCIF_ONLY
171#else 184#else
172# error CPU subtype not defined 185# error CPU subtype not defined
173#endif 186#endif
@@ -177,10 +190,15 @@
177#define SCI_CTRL_FLAGS_RIE 0x40 /* all */ 190#define SCI_CTRL_FLAGS_RIE 0x40 /* all */
178#define SCI_CTRL_FLAGS_TE 0x20 /* all */ 191#define SCI_CTRL_FLAGS_TE 0x20 /* all */
179#define SCI_CTRL_FLAGS_RE 0x10 /* all */ 192#define SCI_CTRL_FLAGS_RE 0x10 /* all */
180#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \ 193#if defined(CONFIG_CPU_SUBTYPE_SH7750) || \
181 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 194 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
182 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 195 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
183 defined(CONFIG_CPU_SUBTYPE_SH7785) 196 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
197 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
198 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
199 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
200 defined(CONFIG_CPU_SUBTYPE_SH7785) || \
201 defined(CONFIG_CPU_SUBTYPE_SHX3)
184#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */ 202#define SCI_CTRL_FLAGS_REIE 0x08 /* 7750 SCIF */
185#else 203#else
186#define SCI_CTRL_FLAGS_REIE 0 204#define SCI_CTRL_FLAGS_REIE 0
@@ -514,8 +532,12 @@ static inline void set_sh771x_scif_pfc(struct uart_port *port)
514 } 532 }
515} 533}
516 534
517#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \ 535#elif defined(CONFIG_CPU_SUBTYPE_SH7750) || \
518 defined(CONFIG_CPU_SUBTYPE_SH7751) || \ 536 defined(CONFIG_CPU_SUBTYPE_SH7751) || \
537 defined(CONFIG_CPU_SUBTYPE_SH7751R) || \
538 defined(CONFIG_CPU_SUBTYPE_SH7750R) || \
539 defined(CONFIG_CPU_SUBTYPE_SH7750S) || \
540 defined(CONFIG_CPU_SUBTYPE_SH7091) || \
519 defined(CONFIG_CPU_SUBTYPE_SH4_202) 541 defined(CONFIG_CPU_SUBTYPE_SH4_202)
520static inline int sci_rxd_in(struct uart_port *port) 542static inline int sci_rxd_in(struct uart_port *port)
521{ 543{
@@ -653,6 +675,18 @@ static inline int sci_rxd_in(struct uart_port *port)
653 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */ 675 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
654 return 1; 676 return 1;
655} 677}
678#elif defined(CONFIG_CPU_SUBTYPE_SHX3)
679static inline int sci_rxd_in(struct uart_port *port)
680{
681 if (port->mapbase == 0xffc30000)
682 return ctrl_inw(SCSPTR0) & 0x0001 ? 1 : 0; /* SCIF */
683 if (port->mapbase == 0xffc40000)
684 return ctrl_inw(SCSPTR1) & 0x0001 ? 1 : 0; /* SCIF */
685 if (port->mapbase == 0xffc50000)
686 return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
687 if (port->mapbase == 0xffc60000)
688 return ctrl_inw(SCSPTR3) & 0x0001 ? 1 : 0; /* SCIF */
689}
656#endif 690#endif
657 691
658/* 692/*
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index a27e9e92cb5e..41fc61264443 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -759,7 +759,7 @@ static void __init sn_sal_switch_to_interrupts(struct sn_cons_port *port)
759 */ 759 */
760 760
761static void sn_sal_console_write(struct console *, const char *, unsigned); 761static void sn_sal_console_write(struct console *, const char *, unsigned);
762static int __init sn_sal_console_setup(struct console *, char *); 762static int sn_sal_console_setup(struct console *, char *);
763static struct uart_driver sal_console_uart; 763static struct uart_driver sal_console_uart;
764extern struct tty_driver *uart_console_device(struct console *, int *); 764extern struct tty_driver *uart_console_device(struct console *, int *);
765 765
@@ -1006,7 +1006,7 @@ sn_sal_console_write(struct console *co, const char *s, unsigned count)
1006 * here so providing it is easier. 1006 * here so providing it is easier.
1007 * 1007 *
1008 */ 1008 */
1009static int __init sn_sal_console_setup(struct console *co, char *options) 1009static int sn_sal_console_setup(struct console *co, char *options)
1010{ 1010{
1011 return 0; 1011 return 0;
1012} 1012}