diff options
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r-- | drivers/serial/8250.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index be95e55b228b..342e12fb1c25 100644 --- a/drivers/serial/8250.c +++ b/drivers/serial/8250.c | |||
@@ -12,8 +12,6 @@ | |||
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * the Free Software Foundation; either version 2 of the License, or |
13 | * (at your option) any later version. | 13 | * (at your option) any later version. |
14 | * | 14 | * |
15 | * $Id: 8250.c,v 1.90 2002/07/28 10:03:27 rmk Exp $ | ||
16 | * | ||
17 | * A note about mapbase / membase | 15 | * A note about mapbase / membase |
18 | * | 16 | * |
19 | * mapbase is the physical address of the IO port. | 17 | * mapbase is the physical address of the IO port. |
@@ -1289,13 +1287,24 @@ static void serial8250_enable_ms(struct uart_port *port) | |||
1289 | static void | 1287 | static void |
1290 | receive_chars(struct uart_8250_port *up, unsigned int *status) | 1288 | receive_chars(struct uart_8250_port *up, unsigned int *status) |
1291 | { | 1289 | { |
1292 | struct tty_struct *tty = up->port.info->tty; | 1290 | struct tty_struct *tty = up->port.info->port.tty; |
1293 | unsigned char ch, lsr = *status; | 1291 | unsigned char ch, lsr = *status; |
1294 | int max_count = 256; | 1292 | int max_count = 256; |
1295 | char flag; | 1293 | char flag; |
1296 | 1294 | ||
1297 | do { | 1295 | do { |
1298 | ch = serial_inp(up, UART_RX); | 1296 | if (likely(lsr & UART_LSR_DR)) |
1297 | ch = serial_inp(up, UART_RX); | ||
1298 | else | ||
1299 | /* | ||
1300 | * Intel 82571 has a Serial Over Lan device that will | ||
1301 | * set UART_LSR_BI without setting UART_LSR_DR when | ||
1302 | * it receives a break. To avoid reading from the | ||
1303 | * receive buffer without UART_LSR_DR bit set, we | ||
1304 | * just force the read character to be 0 | ||
1305 | */ | ||
1306 | ch = 0; | ||
1307 | |||
1299 | flag = TTY_NORMAL; | 1308 | flag = TTY_NORMAL; |
1300 | up->port.icount.rx++; | 1309 | up->port.icount.rx++; |
1301 | 1310 | ||
@@ -1344,7 +1353,7 @@ receive_chars(struct uart_8250_port *up, unsigned int *status) | |||
1344 | 1353 | ||
1345 | ignore_char: | 1354 | ignore_char: |
1346 | lsr = serial_inp(up, UART_LSR); | 1355 | lsr = serial_inp(up, UART_LSR); |
1347 | } while ((lsr & UART_LSR_DR) && (max_count-- > 0)); | 1356 | } while ((lsr & (UART_LSR_DR | UART_LSR_BI)) && (max_count-- > 0)); |
1348 | spin_unlock(&up->port.lock); | 1357 | spin_unlock(&up->port.lock); |
1349 | tty_flip_buffer_push(tty); | 1358 | tty_flip_buffer_push(tty); |
1350 | spin_lock(&up->port.lock); | 1359 | spin_lock(&up->port.lock); |
@@ -1427,7 +1436,7 @@ serial8250_handle_port(struct uart_8250_port *up) | |||
1427 | 1436 | ||
1428 | DEBUG_INTR("status = %x...", status); | 1437 | DEBUG_INTR("status = %x...", status); |
1429 | 1438 | ||
1430 | if (status & UART_LSR_DR) | 1439 | if (status & (UART_LSR_DR | UART_LSR_BI)) |
1431 | receive_chars(up, &status); | 1440 | receive_chars(up, &status); |
1432 | check_modem_status(up); | 1441 | check_modem_status(up); |
1433 | if (status & UART_LSR_THRE) | 1442 | if (status & UART_LSR_THRE) |
@@ -1877,6 +1886,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1877 | * allow register changes to become visible. | 1886 | * allow register changes to become visible. |
1878 | */ | 1887 | */ |
1879 | spin_lock_irqsave(&up->port.lock, flags); | 1888 | spin_lock_irqsave(&up->port.lock, flags); |
1889 | if (up->port.flags & UPF_SHARE_IRQ) | ||
1890 | disable_irq_nosync(up->port.irq); | ||
1880 | 1891 | ||
1881 | wait_for_xmitr(up, UART_LSR_THRE); | 1892 | wait_for_xmitr(up, UART_LSR_THRE); |
1882 | serial_out_sync(up, UART_IER, UART_IER_THRI); | 1893 | serial_out_sync(up, UART_IER, UART_IER_THRI); |
@@ -1888,6 +1899,8 @@ static int serial8250_startup(struct uart_port *port) | |||
1888 | iir = serial_in(up, UART_IIR); | 1899 | iir = serial_in(up, UART_IIR); |
1889 | serial_out(up, UART_IER, 0); | 1900 | serial_out(up, UART_IER, 0); |
1890 | 1901 | ||
1902 | if (up->port.flags & UPF_SHARE_IRQ) | ||
1903 | enable_irq(up->port.irq); | ||
1891 | spin_unlock_irqrestore(&up->port.lock, flags); | 1904 | spin_unlock_irqrestore(&up->port.lock, flags); |
1892 | 1905 | ||
1893 | /* | 1906 | /* |
@@ -2934,7 +2947,7 @@ static int __init serial8250_init(void) | |||
2934 | if (nr_uarts > UART_NR) | 2947 | if (nr_uarts > UART_NR) |
2935 | nr_uarts = UART_NR; | 2948 | nr_uarts = UART_NR; |
2936 | 2949 | ||
2937 | printk(KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ " | 2950 | printk(KERN_INFO "Serial: 8250/16550 driver" |
2938 | "%d ports, IRQ sharing %sabled\n", nr_uarts, | 2951 | "%d ports, IRQ sharing %sabled\n", nr_uarts, |
2939 | share_irqs ? "en" : "dis"); | 2952 | share_irqs ? "en" : "dis"); |
2940 | 2953 | ||
@@ -2995,7 +3008,7 @@ EXPORT_SYMBOL(serial8250_suspend_port); | |||
2995 | EXPORT_SYMBOL(serial8250_resume_port); | 3008 | EXPORT_SYMBOL(serial8250_resume_port); |
2996 | 3009 | ||
2997 | MODULE_LICENSE("GPL"); | 3010 | MODULE_LICENSE("GPL"); |
2998 | MODULE_DESCRIPTION("Generic 8250/16x50 serial driver $Revision: 1.90 $"); | 3011 | MODULE_DESCRIPTION("Generic 8250/16x50 serial driver"); |
2999 | 3012 | ||
3000 | module_param(share_irqs, uint, 0644); | 3013 | module_param(share_irqs, uint, 0644); |
3001 | MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" | 3014 | MODULE_PARM_DESC(share_irqs, "Share IRQs with other non-8250/16x50 devices" |