aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/8250/8250.c34
-rw-r--r--drivers/tty/serial/of_serial.c26
2 files changed, 29 insertions, 31 deletions
diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
index 5b149b466ec8..dffd623b7974 100644
--- a/drivers/tty/serial/8250/8250.c
+++ b/drivers/tty/serial/8250/8250.c
@@ -1332,27 +1332,6 @@ static void serial8250_enable_ms(struct uart_port *port)
1332} 1332}
1333 1333
1334/* 1334/*
1335 * Clear the Tegra rx fifo after a break
1336 *
1337 * FIXME: This needs to become a port specific callback once we have a
1338 * framework for this
1339 */
1340static void clear_rx_fifo(struct uart_8250_port *up)
1341{
1342 unsigned int status, tmout = 10000;
1343 do {
1344 status = serial_in(up, UART_LSR);
1345 if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
1346 status = serial_in(up, UART_RX);
1347 else
1348 break;
1349 if (--tmout == 0)
1350 break;
1351 udelay(1);
1352 } while (1);
1353}
1354
1355/*
1356 * serial8250_rx_chars: processes according to the passed in LSR 1335 * serial8250_rx_chars: processes according to the passed in LSR
1357 * value, and returns the remaining LSR bits not handled 1336 * value, and returns the remaining LSR bits not handled
1358 * by this Rx routine. 1337 * by this Rx routine.
@@ -1386,20 +1365,10 @@ serial8250_rx_chars(struct uart_8250_port *up, unsigned char lsr)
1386 up->lsr_saved_flags = 0; 1365 up->lsr_saved_flags = 0;
1387 1366
1388 if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) { 1367 if (unlikely(lsr & UART_LSR_BRK_ERROR_BITS)) {
1389 /*
1390 * For statistics only
1391 */
1392 if (lsr & UART_LSR_BI) { 1368 if (lsr & UART_LSR_BI) {
1393 lsr &= ~(UART_LSR_FE | UART_LSR_PE); 1369 lsr &= ~(UART_LSR_FE | UART_LSR_PE);
1394 port->icount.brk++; 1370 port->icount.brk++;
1395 /* 1371 /*
1396 * If tegra port then clear the rx fifo to
1397 * accept another break/character.
1398 */
1399 if (port->type == PORT_TEGRA)
1400 clear_rx_fifo(up);
1401
1402 /*
1403 * We do the SysRQ and SAK checking 1372 * We do the SysRQ and SAK checking
1404 * here because otherwise the break 1373 * here because otherwise the break
1405 * may get masked by ignore_status_mask 1374 * may get masked by ignore_status_mask
@@ -3037,6 +3006,7 @@ static int __devinit serial8250_probe(struct platform_device *dev)
3037 port.serial_in = p->serial_in; 3006 port.serial_in = p->serial_in;
3038 port.serial_out = p->serial_out; 3007 port.serial_out = p->serial_out;
3039 port.handle_irq = p->handle_irq; 3008 port.handle_irq = p->handle_irq;
3009 port.handle_break = p->handle_break;
3040 port.set_termios = p->set_termios; 3010 port.set_termios = p->set_termios;
3041 port.pm = p->pm; 3011 port.pm = p->pm;
3042 port.dev = &dev->dev; 3012 port.dev = &dev->dev;
@@ -3209,6 +3179,8 @@ int serial8250_register_port(struct uart_port *port)
3209 uart->port.set_termios = port->set_termios; 3179 uart->port.set_termios = port->set_termios;
3210 if (port->pm) 3180 if (port->pm)
3211 uart->port.pm = port->pm; 3181 uart->port.pm = port->pm;
3182 if (port->handle_break)
3183 uart->port.handle_break = port->handle_break;
3212 3184
3213 if (serial8250_isa_config != NULL) 3185 if (serial8250_isa_config != NULL)
3214 serial8250_isa_config(0, &uart->port, 3186 serial8250_isa_config(0, &uart->port,
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index e8c9cee07d00..5410c0637266 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -12,10 +12,13 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/slab.h> 14#include <linux/slab.h>
15#include <linux/delay.h>
15#include <linux/serial_core.h> 16#include <linux/serial_core.h>
16#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/serial_reg.h>
17#include <linux/of_address.h> 19#include <linux/of_address.h>
18#include <linux/of_irq.h> 20#include <linux/of_irq.h>
21#include <linux/of_serial.h>
19#include <linux/of_platform.h> 22#include <linux/of_platform.h>
20#include <linux/nwpserial.h> 23#include <linux/nwpserial.h>
21 24
@@ -24,6 +27,26 @@ struct of_serial_info {
24 int line; 27 int line;
25}; 28};
26 29
30#ifdef CONFIG_ARCH_TEGRA
31void tegra_serial_handle_break(struct uart_port *p)
32{
33 unsigned int status, tmout = 10000;
34
35 do {
36 status = p->serial_in(p, UART_LSR);
37 if (status & (UART_LSR_FIFOE | UART_LSR_BRK_ERROR_BITS))
38 status = p->serial_in(p, UART_RX);
39 else
40 break;
41 if (--tmout == 0)
42 break;
43 udelay(1);
44 } while (1);
45}
46/* FIXME remove this export when tegra finishes conversion to open firmware */
47EXPORT_SYMBOL_GPL(tegra_serial_handle_break);
48#endif
49
27/* 50/*
28 * Fill a struct uart_port for a given device node 51 * Fill a struct uart_port for a given device node
29 */ 52 */
@@ -84,6 +107,9 @@ static int __devinit of_platform_serial_setup(struct platform_device *ofdev,
84 | UPF_FIXED_PORT | UPF_FIXED_TYPE; 107 | UPF_FIXED_PORT | UPF_FIXED_TYPE;
85 port->dev = &ofdev->dev; 108 port->dev = &ofdev->dev;
86 109
110 if (type == PORT_TEGRA)
111 port->handle_break = tegra_serial_handle_break;
112
87 return 0; 113 return 0;
88} 114}
89 115