aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/68360serial.c3
-rw-r--r--drivers/serial/8250.c9
-rw-r--r--drivers/serial/8250_pci.c2
-rw-r--r--drivers/serial/atmel_serial.c1
-rw-r--r--drivers/serial/crisv10.c7
-rw-r--r--drivers/serial/dz.c2
-rw-r--r--drivers/serial/serial_core.c15
-rw-r--r--drivers/serial/sunzilog.c4
-rw-r--r--drivers/serial/vr41xx_siu.c15
9 files changed, 44 insertions, 14 deletions
diff --git a/drivers/serial/68360serial.c b/drivers/serial/68360serial.c
index 2aa6bfe8fdb3..f59463601874 100644
--- a/drivers/serial/68360serial.c
+++ b/drivers/serial/68360serial.c
@@ -51,6 +51,7 @@ extern int kgdb_output_string (const char* s, unsigned int count);
51 51
52/* #ifdef CONFIG_SERIAL_CONSOLE */ /* This seems to be a post 2.0 thing - mles */ 52/* #ifdef CONFIG_SERIAL_CONSOLE */ /* This seems to be a post 2.0 thing - mles */
53#include <linux/console.h> 53#include <linux/console.h>
54#include <linux/jiffies.h>
54 55
55/* this defines the index into rs_table for the port to use 56/* this defines the index into rs_table for the port to use
56 */ 57 */
@@ -1729,7 +1730,7 @@ static void rs_360_wait_until_sent(struct tty_struct *tty, int timeout)
1729 msleep_interruptible(jiffies_to_msecs(char_time)); 1730 msleep_interruptible(jiffies_to_msecs(char_time));
1730 if (signal_pending(current)) 1731 if (signal_pending(current))
1731 break; 1732 break;
1732 if (timeout && ((orig_jiffies + timeout) < jiffies)) 1733 if (timeout && (time_after(jiffies, orig_jiffies + timeout)))
1733 break; 1734 break;
1734 /* The 'tx_cur' is really the next buffer to send. We 1735 /* The 'tx_cur' is really the next buffer to send. We
1735 * have to back up to the previous BD and wait for it 1736 * have to back up to the previous BD and wait for it
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 96a585e1cee8..ea41f2626458 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1868,6 +1868,7 @@ static int serial8250_startup(struct uart_port *port)
1868 } 1868 }
1869 1869
1870 if (is_real_interrupt(up->port.irq)) { 1870 if (is_real_interrupt(up->port.irq)) {
1871 unsigned char iir1;
1871 /* 1872 /*
1872 * Test for UARTs that do not reassert THRE when the 1873 * Test for UARTs that do not reassert THRE when the
1873 * transmitter is idle and the interrupt has already 1874 * transmitter is idle and the interrupt has already
@@ -1881,7 +1882,7 @@ static int serial8250_startup(struct uart_port *port)
1881 wait_for_xmitr(up, UART_LSR_THRE); 1882 wait_for_xmitr(up, UART_LSR_THRE);
1882 serial_out_sync(up, UART_IER, UART_IER_THRI); 1883 serial_out_sync(up, UART_IER, UART_IER_THRI);
1883 udelay(1); /* allow THRE to set */ 1884 udelay(1); /* allow THRE to set */
1884 serial_in(up, UART_IIR); 1885 iir1 = serial_in(up, UART_IIR);
1885 serial_out(up, UART_IER, 0); 1886 serial_out(up, UART_IER, 0);
1886 serial_out_sync(up, UART_IER, UART_IER_THRI); 1887 serial_out_sync(up, UART_IER, UART_IER_THRI);
1887 udelay(1); /* allow a working UART time to re-assert THRE */ 1888 udelay(1); /* allow a working UART time to re-assert THRE */
@@ -1894,7 +1895,7 @@ static int serial8250_startup(struct uart_port *port)
1894 * If the interrupt is not reasserted, setup a timer to 1895 * If the interrupt is not reasserted, setup a timer to
1895 * kick the UART on a regular basis. 1896 * kick the UART on a regular basis.
1896 */ 1897 */
1897 if (iir & UART_IIR_NO_INT) { 1898 if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
1898 pr_debug("ttyS%d - using backup timer\n", port->line); 1899 pr_debug("ttyS%d - using backup timer\n", port->line);
1899 up->timer.function = serial8250_backup_timeout; 1900 up->timer.function = serial8250_backup_timeout;
1900 up->timer.data = (unsigned long)up; 1901 up->timer.data = (unsigned long)up;
@@ -2228,7 +2229,9 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
2228 } 2229 }
2229 serial8250_set_mctrl(&up->port, up->port.mctrl); 2230 serial8250_set_mctrl(&up->port, up->port.mctrl);
2230 spin_unlock_irqrestore(&up->port.lock, flags); 2231 spin_unlock_irqrestore(&up->port.lock, flags);
2231 tty_termios_encode_baud_rate(termios, baud, baud); 2232 /* Don't rewrite B0 */
2233 if (tty_termios_baud_rate(termios))
2234 tty_termios_encode_baud_rate(termios, baud, baud);
2232} 2235}
2233 2236
2234static void 2237static void
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index f97224ce59da..6e57382b9137 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -775,7 +775,7 @@ pci_default_setup(struct serial_private *priv, struct pciserial_board *board,
775 * This list is ordered alphabetically by vendor then device. 775 * This list is ordered alphabetically by vendor then device.
776 * Specific entries must come before more generic entries. 776 * Specific entries must come before more generic entries.
777 */ 777 */
778static struct pci_serial_quirk pci_serial_quirks[] = { 778static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
779 /* 779 /*
780 * ADDI-DATA GmbH communication cards <info@addi-data.com> 780 * ADDI-DATA GmbH communication cards <info@addi-data.com>
781 */ 781 */
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 55492fa095a2..c065a704a93a 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -96,7 +96,6 @@
96 96
97 /* PDC registers */ 97 /* PDC registers */
98#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR) 98#define UART_PUT_PTCR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_PTCR)
99#define UART_GET_TCR(port) __raw_readl((port)->membase + ATMEL_PDC_TCR)
100#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR) 99#define UART_GET_PTSR(port) __raw_readl((port)->membase + ATMEL_PDC_PTSR)
101 100
102#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR) 101#define UART_PUT_RPR(port,v) __raw_writel(v, (port)->membase + ATMEL_PDC_RPR)
diff --git a/drivers/serial/crisv10.c b/drivers/serial/crisv10.c
index 383c4e660cd5..88e7c1d5b919 100644
--- a/drivers/serial/crisv10.c
+++ b/drivers/serial/crisv10.c
@@ -3582,6 +3582,8 @@ rs_tiocmset(struct tty_struct *tty, struct file *file,
3582{ 3582{
3583 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3583 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3584 3584
3585 lock_kernel();
3586
3585 if (clear & TIOCM_RTS) 3587 if (clear & TIOCM_RTS)
3586 e100_rts(info, 0); 3588 e100_rts(info, 0);
3587 if (clear & TIOCM_DTR) 3589 if (clear & TIOCM_DTR)
@@ -3601,6 +3603,8 @@ rs_tiocmset(struct tty_struct *tty, struct file *file,
3601 e100_ri_out(info, 1); 3603 e100_ri_out(info, 1);
3602 if (set & TIOCM_CD) 3604 if (set & TIOCM_CD)
3603 e100_cd_out(info, 1); 3605 e100_cd_out(info, 1);
3606
3607 unlock_kernel();
3604 return 0; 3608 return 0;
3605} 3609}
3606 3610
@@ -3610,6 +3614,7 @@ rs_tiocmget(struct tty_struct *tty, struct file *file)
3610 struct e100_serial *info = (struct e100_serial *)tty->driver_data; 3614 struct e100_serial *info = (struct e100_serial *)tty->driver_data;
3611 unsigned int result; 3615 unsigned int result;
3612 3616
3617 lock_kernel();
3613 result = 3618 result =
3614 (!E100_RTS_GET(info) ? TIOCM_RTS : 0) 3619 (!E100_RTS_GET(info) ? TIOCM_RTS : 0)
3615 | (!E100_DTR_GET(info) ? TIOCM_DTR : 0) 3620 | (!E100_DTR_GET(info) ? TIOCM_DTR : 0)
@@ -3618,6 +3623,8 @@ rs_tiocmget(struct tty_struct *tty, struct file *file)
3618 | (!E100_CD_GET(info) ? TIOCM_CAR : 0) 3623 | (!E100_CD_GET(info) ? TIOCM_CAR : 0)
3619 | (!E100_CTS_GET(info) ? TIOCM_CTS : 0); 3624 | (!E100_CTS_GET(info) ? TIOCM_CTS : 0);
3620 3625
3626 unlock_kernel();
3627
3621#ifdef SERIAL_DEBUG_IO 3628#ifdef SERIAL_DEBUG_IO
3622 printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n", 3629 printk(KERN_DEBUG "ser%i: modem state: %i 0x%08X\n",
3623 info->line, result, result); 3630 info->line, result, result);
diff --git a/drivers/serial/dz.c b/drivers/serial/dz.c
index 116211fcd36f..0dddd68b20d2 100644
--- a/drivers/serial/dz.c
+++ b/drivers/serial/dz.c
@@ -819,7 +819,7 @@ static void dz_console_putchar(struct uart_port *uport, int ch)
819 dz_out(dport, DZ_TCR, mask); 819 dz_out(dport, DZ_TCR, mask);
820 iob(); 820 iob();
821 udelay(2); 821 udelay(2);
822 } while (loops--); 822 } while (--loops);
823 823
824 if (loops) /* Cannot send otherwise. */ 824 if (loops) /* Cannot send otherwise. */
825 dz_out(dport, DZ_TDR, ch); 825 dz_out(dport, DZ_TDR, ch);
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index a9ca03ead3e5..977ce820ce30 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -329,13 +329,15 @@ EXPORT_SYMBOL(uart_update_timeout);
329 * If it's still invalid, we try 9600 baud. 329 * If it's still invalid, we try 9600 baud.
330 * 330 *
331 * Update the @termios structure to reflect the baud rate 331 * Update the @termios structure to reflect the baud rate
332 * we're actually going to be using. 332 * we're actually going to be using. Don't do this for the case
333 * where B0 is requested ("hang up").
333 */ 334 */
334unsigned int 335unsigned int
335uart_get_baud_rate(struct uart_port *port, struct ktermios *termios, 336uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
336 struct ktermios *old, unsigned int min, unsigned int max) 337 struct ktermios *old, unsigned int min, unsigned int max)
337{ 338{
338 unsigned int try, baud, altbaud = 38400; 339 unsigned int try, baud, altbaud = 38400;
340 int hung_up = 0;
339 upf_t flags = port->flags & UPF_SPD_MASK; 341 upf_t flags = port->flags & UPF_SPD_MASK;
340 342
341 if (flags == UPF_SPD_HI) 343 if (flags == UPF_SPD_HI)
@@ -360,8 +362,10 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
360 /* 362 /*
361 * Special case: B0 rate. 363 * Special case: B0 rate.
362 */ 364 */
363 if (baud == 0) 365 if (baud == 0) {
366 hung_up = 1;
364 baud = 9600; 367 baud = 9600;
368 }
365 369
366 if (baud >= min && baud <= max) 370 if (baud >= min && baud <= max)
367 return baud; 371 return baud;
@@ -373,7 +377,9 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
373 termios->c_cflag &= ~CBAUD; 377 termios->c_cflag &= ~CBAUD;
374 if (old) { 378 if (old) {
375 baud = tty_termios_baud_rate(old); 379 baud = tty_termios_baud_rate(old);
376 tty_termios_encode_baud_rate(termios, baud, baud); 380 if (!hung_up)
381 tty_termios_encode_baud_rate(termios,
382 baud, baud);
377 old = NULL; 383 old = NULL;
378 continue; 384 continue;
379 } 385 }
@@ -382,7 +388,8 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
382 * As a last resort, if the quotient is zero, 388 * As a last resort, if the quotient is zero,
383 * default to 9600 bps 389 * default to 9600 bps
384 */ 390 */
385 tty_termios_encode_baud_rate(termios, 9600, 9600); 391 if (!hung_up)
392 tty_termios_encode_baud_rate(termios, 9600, 9600);
386 } 393 }
387 394
388 return 0; 395 return 0;
diff --git a/drivers/serial/sunzilog.c b/drivers/serial/sunzilog.c
index 3271379a36db..90a20a152ebf 100644
--- a/drivers/serial/sunzilog.c
+++ b/drivers/serial/sunzilog.c
@@ -1231,7 +1231,7 @@ static inline struct console *SUNZILOG_CONSOLE(void)
1231#define SUNZILOG_CONSOLE() (NULL) 1231#define SUNZILOG_CONSOLE() (NULL)
1232#endif 1232#endif
1233 1233
1234static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up, int channel) 1234static void __devinit sunzilog_init_kbdms(struct uart_sunzilog_port *up)
1235{ 1235{
1236 int baud, brg; 1236 int baud, brg;
1237 1237
@@ -1305,7 +1305,7 @@ static void __devinit sunzilog_init_hw(struct uart_sunzilog_port *up)
1305 up->curregs[R7] = 0x7E; /* SDLC Flag */ 1305 up->curregs[R7] = 0x7E; /* SDLC Flag */
1306 up->curregs[R9] = NV; 1306 up->curregs[R9] = NV;
1307 up->curregs[R7p] = 0x00; 1307 up->curregs[R7p] = 0x00;
1308 sunzilog_init_kbdms(up, up->port.line); 1308 sunzilog_init_kbdms(up);
1309 /* Only enable interrupts if an ISR handler available */ 1309 /* Only enable interrupts if an ISR handler available */
1310 if (up->flags & SUNZILOG_FLAG_ISR_HANDLER) 1310 if (up->flags & SUNZILOG_FLAG_ISR_HANDLER)
1311 up->curregs[R9] |= MIE; 1311 up->curregs[R9] |= MIE;
diff --git a/drivers/serial/vr41xx_siu.c b/drivers/serial/vr41xx_siu.c
index 98ab649c1ff9..bb6ce6bba32f 100644
--- a/drivers/serial/vr41xx_siu.c
+++ b/drivers/serial/vr41xx_siu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Driver for NEC VR4100 series Serial Interface Unit. 2 * Driver for NEC VR4100 series Serial Interface Unit.
3 * 3 *
4 * Copyright (C) 2004-2007 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 4 * Copyright (C) 2004-2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * Based on drivers/serial/8250.c, by Russell King. 6 * Based on drivers/serial/8250.c, by Russell King.
7 * 7 *
@@ -840,6 +840,19 @@ static int __devinit siu_console_init(void)
840 840
841console_initcall(siu_console_init); 841console_initcall(siu_console_init);
842 842
843void __init vr41xx_siu_early_setup(struct uart_port *port)
844{
845 if (port->type == PORT_UNKNOWN)
846 return;
847
848 siu_uart_ports[port->line].line = port->line;
849 siu_uart_ports[port->line].type = port->type;
850 siu_uart_ports[port->line].uartclk = SIU_BAUD_BASE * 16;
851 siu_uart_ports[port->line].mapbase = port->mapbase;
852 siu_uart_ports[port->line].mapbase = port->mapbase;
853 siu_uart_ports[port->line].ops = &siu_uart_ops;
854}
855
843#define SERIAL_VR41XX_CONSOLE &siu_console 856#define SERIAL_VR41XX_CONSOLE &siu_console
844#else 857#else
845#define SERIAL_VR41XX_CONSOLE NULL 858#define SERIAL_VR41XX_CONSOLE NULL