aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250.c4
-rw-r--r--drivers/serial/8250_pci.c7
-rw-r--r--drivers/serial/Kconfig2
-rw-r--r--drivers/serial/atmel_serial.c2
-rw-r--r--drivers/serial/bfin_5xx.c80
-rw-r--r--drivers/serial/sb1250-duart.c2
-rw-r--r--drivers/serial/serial_core.c19
-rw-r--r--drivers/serial/sh-sci.c8
-rw-r--r--drivers/serial/sunhv.c1
-rw-r--r--drivers/serial/ucc_uart.c2
10 files changed, 62 insertions, 65 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index a1ca9b7bf2d5..be95e55b228b 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -93,7 +93,6 @@ static unsigned int nr_uarts = CONFIG_SERIAL_8250_RUNTIME_UARTS;
93#define CONFIG_HUB6 1 93#define CONFIG_HUB6 1
94 94
95#include <asm/serial.h> 95#include <asm/serial.h>
96
97/* 96/*
98 * SERIAL_PORT_DFNS tells us about built-in ports that have no 97 * SERIAL_PORT_DFNS tells us about built-in ports that have no
99 * standard enumeration mechanism. Platforms that can find all 98 * standard enumeration mechanism. Platforms that can find all
@@ -2624,6 +2623,9 @@ static struct console serial8250_console = {
2624 2623
2625static int __init serial8250_console_init(void) 2624static int __init serial8250_console_init(void)
2626{ 2625{
2626 if (nr_uarts > UART_NR)
2627 nr_uarts = UART_NR;
2628
2627 serial8250_isa_init_ports(); 2629 serial8250_isa_init_ports();
2628 register_console(&serial8250_console); 2630 register_console(&serial8250_console);
2629 return 0; 2631 return 0;
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c
index 53fa19cf2f06..788c3559522d 100644
--- a/drivers/serial/8250_pci.c
+++ b/drivers/serial/8250_pci.c
@@ -2602,7 +2602,12 @@ static struct pci_device_id serial_pci_tbl[] = {
2602 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200, 2602 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS200,
2603 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */ 2603 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0811 */
2604 pbn_b2_2_115200 }, 2604 pbn_b2_2_115200 },
2605 2605 /*
2606 * IntaShield IS-400
2607 */
2608 { PCI_VENDOR_ID_INTASHIELD, PCI_DEVICE_ID_INTASHIELD_IS400,
2609 PCI_ANY_ID, PCI_ANY_ID, 0, 0, /* 135a.0dc0 */
2610 pbn_b2_4_115200 },
2606 /* 2611 /*
2607 * Perle PCI-RAS cards 2612 * Perle PCI-RAS cards
2608 */ 2613 */
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
index 62e6eb136a3c..9bc42763623c 100644
--- a/drivers/serial/Kconfig
+++ b/drivers/serial/Kconfig
@@ -1361,7 +1361,7 @@ config SERIAL_SC26XX_CONSOLE
1361 1361
1362config SERIAL_BFIN_SPORT 1362config SERIAL_BFIN_SPORT
1363 tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)" 1363 tristate "Blackfin SPORT emulate UART (EXPERIMENTAL)"
1364 depends on BFIN && EXPERIMENTAL 1364 depends on BLACKFIN && EXPERIMENTAL
1365 select SERIAL_CORE 1365 select SERIAL_CORE
1366 help 1366 help
1367 Enble support SPORT emulate UART on Blackfin series. 1367 Enble support SPORT emulate UART on Blackfin series.
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index c065a704a93a..42be8b01a40f 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1318,7 +1318,7 @@ static void __init atmel_console_get_options(struct uart_port *port, int *baud,
1318 * If the baud rate generator isn't running, the port wasn't 1318 * If the baud rate generator isn't running, the port wasn't
1319 * initialized by the boot loader. 1319 * initialized by the boot loader.
1320 */ 1320 */
1321 quot = UART_GET_BRGR(port); 1321 quot = UART_GET_BRGR(port) & ATMEL_US_CD;
1322 if (!quot) 1322 if (!quot)
1323 return; 1323 return;
1324 1324
diff --git a/drivers/serial/bfin_5xx.c b/drivers/serial/bfin_5xx.c
index d6b4ead693b7..fd9bb777df28 100644
--- a/drivers/serial/bfin_5xx.c
+++ b/drivers/serial/bfin_5xx.c
@@ -49,6 +49,7 @@
49#define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT) 49#define DMA_RX_YCOUNT (PAGE_SIZE / DMA_RX_XCOUNT)
50 50
51#define DMA_RX_FLUSH_JIFFIES (HZ / 50) 51#define DMA_RX_FLUSH_JIFFIES (HZ / 50)
52#define CTS_CHECK_JIFFIES (HZ / 50)
52 53
53#ifdef CONFIG_SERIAL_BFIN_DMA 54#ifdef CONFIG_SERIAL_BFIN_DMA
54static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart); 55static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart);
@@ -290,11 +291,6 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
290{ 291{
291 struct circ_buf *xmit = &uart->port.info->xmit; 292 struct circ_buf *xmit = &uart->port.info->xmit;
292 293
293 if (uart->port.x_char) {
294 UART_PUT_CHAR(uart, uart->port.x_char);
295 uart->port.icount.tx++;
296 uart->port.x_char = 0;
297 }
298 /* 294 /*
299 * Check the modem control lines before 295 * Check the modem control lines before
300 * transmitting anything. 296 * transmitting anything.
@@ -306,6 +302,12 @@ static void bfin_serial_tx_chars(struct bfin_serial_port *uart)
306 return; 302 return;
307 } 303 }
308 304
305 if (uart->port.x_char) {
306 UART_PUT_CHAR(uart, uart->port.x_char);
307 uart->port.icount.tx++;
308 uart->port.x_char = 0;
309 }
310
309 while ((UART_GET_LSR(uart) & THRE) && xmit->tail != xmit->head) { 311 while ((UART_GET_LSR(uart) & THRE) && xmit->tail != xmit->head) {
310 UART_PUT_CHAR(uart, xmit->buf[xmit->tail]); 312 UART_PUT_CHAR(uart, xmit->buf[xmit->tail]);
311 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1); 313 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
@@ -345,15 +347,6 @@ static irqreturn_t bfin_serial_tx_int(int irq, void *dev_id)
345} 347}
346#endif 348#endif
347 349
348#ifdef CONFIG_SERIAL_BFIN_CTSRTS
349static void bfin_serial_do_work(struct work_struct *work)
350{
351 struct bfin_serial_port *uart = container_of(work, struct bfin_serial_port, cts_workqueue);
352
353 bfin_serial_mctrl_check(uart);
354}
355#endif
356
357#ifdef CONFIG_SERIAL_BFIN_DMA 350#ifdef CONFIG_SERIAL_BFIN_DMA
358static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart) 351static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
359{ 352{
@@ -361,6 +354,12 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
361 354
362 uart->tx_done = 0; 355 uart->tx_done = 0;
363 356
357 /*
358 * Check the modem control lines before
359 * transmitting anything.
360 */
361 bfin_serial_mctrl_check(uart);
362
364 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) { 363 if (uart_circ_empty(xmit) || uart_tx_stopped(&uart->port)) {
365 uart->tx_count = 0; 364 uart->tx_count = 0;
366 uart->tx_done = 1; 365 uart->tx_done = 1;
@@ -373,12 +372,6 @@ static void bfin_serial_dma_tx_chars(struct bfin_serial_port *uart)
373 uart->port.x_char = 0; 372 uart->port.x_char = 0;
374 } 373 }
375 374
376 /*
377 * Check the modem control lines before
378 * transmitting anything.
379 */
380 bfin_serial_mctrl_check(uart);
381
382 uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE); 375 uart->tx_count = CIRC_CNT(xmit->head, xmit->tail, UART_XMIT_SIZE);
383 if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail)) 376 if (uart->tx_count > (UART_XMIT_SIZE - xmit->tail))
384 uart->tx_count = UART_XMIT_SIZE - xmit->tail; 377 uart->tx_count = UART_XMIT_SIZE - xmit->tail;
@@ -530,11 +523,7 @@ static unsigned int bfin_serial_get_mctrl(struct uart_port *port)
530 if (uart->cts_pin < 0) 523 if (uart->cts_pin < 0)
531 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR; 524 return TIOCM_CTS | TIOCM_DSR | TIOCM_CAR;
532 525
533# ifdef BF54x 526 if (UART_GET_CTS(uart))
534 if (UART_GET_MSR(uart) & CTS)
535# else
536 if (gpio_get_value(uart->cts_pin))
537# endif
538 return TIOCM_DSR | TIOCM_CAR; 527 return TIOCM_DSR | TIOCM_CAR;
539 else 528 else
540#endif 529#endif
@@ -549,17 +538,9 @@ static void bfin_serial_set_mctrl(struct uart_port *port, unsigned int mctrl)
549 return; 538 return;
550 539
551 if (mctrl & TIOCM_RTS) 540 if (mctrl & TIOCM_RTS)
552# ifdef BF54x 541 UART_CLEAR_RTS(uart);
553 UART_PUT_MCR(uart, UART_GET_MCR(uart) & ~MRTS);
554# else
555 gpio_set_value(uart->rts_pin, 0);
556# endif
557 else 542 else
558# ifdef BF54x 543 UART_SET_RTS(uart);
559 UART_PUT_MCR(uart, UART_GET_MCR(uart) | MRTS);
560# else
561 gpio_set_value(uart->rts_pin, 1);
562# endif
563#endif 544#endif
564} 545}
565 546
@@ -577,7 +558,10 @@ static void bfin_serial_mctrl_check(struct bfin_serial_port *uart)
577 uart_handle_cts_change(&uart->port, status & TIOCM_CTS); 558 uart_handle_cts_change(&uart->port, status & TIOCM_CTS);
578 if (!(status & TIOCM_CTS)) { 559 if (!(status & TIOCM_CTS)) {
579 tty->hw_stopped = 1; 560 tty->hw_stopped = 1;
580 schedule_work(&uart->cts_workqueue); 561 uart->cts_timer.data = (unsigned long)(uart);
562 uart->cts_timer.function = (void *)bfin_serial_mctrl_check;
563 uart->cts_timer.expires = jiffies + CTS_CHECK_JIFFIES;
564 add_timer(&(uart->cts_timer));
581 } else { 565 } else {
582 tty->hw_stopped = 0; 566 tty->hw_stopped = 0;
583 } 567 }
@@ -752,11 +736,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
752 736
753 /* Disable UART */ 737 /* Disable UART */
754 ier = UART_GET_IER(uart); 738 ier = UART_GET_IER(uart);
755#ifdef CONFIG_BF54x 739 UART_DISABLE_INTS(uart);
756 UART_CLEAR_IER(uart, 0xF);
757#else
758 UART_PUT_IER(uart, 0);
759#endif
760 740
761 /* Set DLAB in LCR to Access DLL and DLH */ 741 /* Set DLAB in LCR to Access DLL and DLH */
762 UART_SET_DLAB(uart); 742 UART_SET_DLAB(uart);
@@ -771,11 +751,7 @@ bfin_serial_set_termios(struct uart_port *port, struct ktermios *termios,
771 UART_PUT_LCR(uart, lcr); 751 UART_PUT_LCR(uart, lcr);
772 752
773 /* Enable UART */ 753 /* Enable UART */
774#ifdef CONFIG_BF54x 754 UART_ENABLE_INTS(uart, ier);
775 UART_SET_IER(uart, ier);
776#else
777 UART_PUT_IER(uart, ier);
778#endif
779 755
780 val = UART_GET_GCTL(uart); 756 val = UART_GET_GCTL(uart);
781 val |= UCEN; 757 val |= UCEN;
@@ -833,15 +809,15 @@ bfin_serial_verify_port(struct uart_port *port, struct serial_struct *ser)
833 * Enable the IrDA function if tty->ldisc.num is N_IRDA. 809 * Enable the IrDA function if tty->ldisc.num is N_IRDA.
834 * In other cases, disable IrDA function. 810 * In other cases, disable IrDA function.
835 */ 811 */
836static void bfin_set_ldisc(struct tty_struct *tty) 812static void bfin_serial_set_ldisc(struct uart_port *port)
837{ 813{
838 int line = tty->index; 814 int line = port->line;
839 unsigned short val; 815 unsigned short val;
840 816
841 if (line >= tty->driver->num) 817 if (line >= port->info->tty->driver->num)
842 return; 818 return;
843 819
844 switch (tty->ldisc.num) { 820 switch (port->info->tty->ldisc.num) {
845 case N_IRDA: 821 case N_IRDA:
846 val = UART_GET_GCTL(&bfin_serial_ports[line]); 822 val = UART_GET_GCTL(&bfin_serial_ports[line]);
847 val |= (IREN | RPOLC); 823 val |= (IREN | RPOLC);
@@ -866,6 +842,7 @@ static struct uart_ops bfin_serial_pops = {
866 .startup = bfin_serial_startup, 842 .startup = bfin_serial_startup,
867 .shutdown = bfin_serial_shutdown, 843 .shutdown = bfin_serial_shutdown,
868 .set_termios = bfin_serial_set_termios, 844 .set_termios = bfin_serial_set_termios,
845 .set_ldisc = bfin_serial_set_ldisc,
869 .type = bfin_serial_type, 846 .type = bfin_serial_type,
870 .release_port = bfin_serial_release_port, 847 .release_port = bfin_serial_release_port,
871 .request_port = bfin_serial_request_port, 848 .request_port = bfin_serial_request_port,
@@ -904,7 +881,7 @@ static void __init bfin_serial_init_ports(void)
904 init_timer(&(bfin_serial_ports[i].rx_dma_timer)); 881 init_timer(&(bfin_serial_ports[i].rx_dma_timer));
905#endif 882#endif
906#ifdef CONFIG_SERIAL_BFIN_CTSRTS 883#ifdef CONFIG_SERIAL_BFIN_CTSRTS
907 INIT_WORK(&bfin_serial_ports[i].cts_workqueue, bfin_serial_do_work); 884 init_timer(&(bfin_serial_ports[i].cts_timer));
908 bfin_serial_ports[i].cts_pin = 885 bfin_serial_ports[i].cts_pin =
909 bfin_serial_resource[i].uart_cts_pin; 886 bfin_serial_resource[i].uart_cts_pin;
910 bfin_serial_ports[i].rts_pin = 887 bfin_serial_ports[i].rts_pin =
@@ -1206,7 +1183,6 @@ static int __init bfin_serial_init(void)
1206 1183
1207 ret = uart_register_driver(&bfin_serial_reg); 1184 ret = uart_register_driver(&bfin_serial_reg);
1208 if (ret == 0) { 1185 if (ret == 0) {
1209 bfin_serial_reg.tty_driver->set_ldisc = bfin_set_ldisc;
1210 ret = platform_driver_register(&bfin_serial_driver); 1186 ret = platform_driver_register(&bfin_serial_driver);
1211 if (ret) { 1187 if (ret) {
1212 pr_debug("uart register failed\n"); 1188 pr_debug("uart register failed\n");
diff --git a/drivers/serial/sb1250-duart.c b/drivers/serial/sb1250-duart.c
index 2d6c08b3dbcf..f8e1447a022a 100644
--- a/drivers/serial/sb1250-duart.c
+++ b/drivers/serial/sb1250-duart.c
@@ -924,7 +924,7 @@ console_initcall(sbd_serial_console_init);
924 924
925static struct uart_driver sbd_reg = { 925static struct uart_driver sbd_reg = {
926 .owner = THIS_MODULE, 926 .owner = THIS_MODULE,
927 .driver_name = "serial", 927 .driver_name = "sb1250_duart",
928 .dev_name = "duart", 928 .dev_name = "duart",
929 .major = TTY_MAJOR, 929 .major = TTY_MAJOR,
930 .minor = SB1250_DUART_MINOR_BASE, 930 .minor = SB1250_DUART_MINOR_BASE,
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c
index eab032733790..42d2e108b679 100644
--- a/drivers/serial/serial_core.c
+++ b/drivers/serial/serial_core.c
@@ -1165,6 +1165,15 @@ out:
1165 return ret; 1165 return ret;
1166} 1166}
1167 1167
1168static void uart_set_ldisc(struct tty_struct *tty)
1169{
1170 struct uart_state *state = tty->driver_data;
1171 struct uart_port *port = state->port;
1172
1173 if (port->ops->set_ldisc)
1174 port->ops->set_ldisc(port);
1175}
1176
1168static void uart_set_termios(struct tty_struct *tty, 1177static void uart_set_termios(struct tty_struct *tty,
1169 struct ktermios *old_termios) 1178 struct ktermios *old_termios)
1170{ 1179{
@@ -1982,7 +1991,9 @@ struct uart_match {
1982static int serial_match_port(struct device *dev, void *data) 1991static int serial_match_port(struct device *dev, void *data)
1983{ 1992{
1984 struct uart_match *match = data; 1993 struct uart_match *match = data;
1985 dev_t devt = MKDEV(match->driver->major, match->driver->minor) + match->port->line; 1994 struct tty_driver *tty_drv = match->driver->tty_driver;
1995 dev_t devt = MKDEV(tty_drv->major, tty_drv->minor_start) +
1996 match->port->line;
1986 1997
1987 return dev->devt == devt; /* Actually, only one tty per port */ 1998 return dev->devt == devt; /* Actually, only one tty per port */
1988} 1999}
@@ -2054,6 +2065,8 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *port)
2054int uart_resume_port(struct uart_driver *drv, struct uart_port *port) 2065int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2055{ 2066{
2056 struct uart_state *state = drv->state + port->line; 2067 struct uart_state *state = drv->state + port->line;
2068 struct device *tty_dev;
2069 struct uart_match match = {port, drv};
2057 2070
2058 mutex_lock(&state->mutex); 2071 mutex_lock(&state->mutex);
2059 2072
@@ -2063,7 +2076,8 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *port)
2063 return 0; 2076 return 0;
2064 } 2077 }
2065 2078
2066 if (!port->suspended) { 2079 tty_dev = device_find_child(port->dev, &match, serial_match_port);
2080 if (!port->suspended && device_may_wakeup(tty_dev)) {
2067 disable_irq_wake(port->irq); 2081 disable_irq_wake(port->irq);
2068 mutex_unlock(&state->mutex); 2082 mutex_unlock(&state->mutex);
2069 return 0; 2083 return 0;
@@ -2285,6 +2299,7 @@ static const struct tty_operations uart_ops = {
2285 .unthrottle = uart_unthrottle, 2299 .unthrottle = uart_unthrottle,
2286 .send_xchar = uart_send_xchar, 2300 .send_xchar = uart_send_xchar,
2287 .set_termios = uart_set_termios, 2301 .set_termios = uart_set_termios,
2302 .set_ldisc = uart_set_ldisc,
2288 .stop = uart_stop, 2303 .stop = uart_stop,
2289 .start = uart_start, 2304 .start = uart_start,
2290 .hangup = uart_hangup, 2305 .hangup = uart_hangup,
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 8fdafc27fce8..ce6ee92b3a1b 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -184,15 +184,15 @@ static void put_string(struct sci_port *sci_port, const char *buffer, int count)
184 int h, l; 184 int h, l;
185 185
186 c = *p++; 186 c = *p++;
187 h = highhex(c); 187 h = hex_asc_hi(c);
188 l = lowhex(c); 188 l = hex_asc_lo(c);
189 put_char(port, h); 189 put_char(port, h);
190 put_char(port, l); 190 put_char(port, l);
191 checksum += h + l; 191 checksum += h + l;
192 } 192 }
193 put_char(port, '#'); 193 put_char(port, '#');
194 put_char(port, highhex(checksum)); 194 put_char(port, hex_asc_hi(checksum));
195 put_char(port, lowhex(checksum)); 195 put_char(port, hex_asc_lo(checksum));
196 } while (get_char(port) != '+'); 196 } while (get_char(port) != '+');
197 } else 197 } else
198#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */ 198#endif /* CONFIG_SH_STANDARD_BIOS || CONFIG_SH_KGDB */
diff --git a/drivers/serial/sunhv.c b/drivers/serial/sunhv.c
index 145c0281495d..2847336742d7 100644
--- a/drivers/serial/sunhv.c
+++ b/drivers/serial/sunhv.c
@@ -499,7 +499,6 @@ static void sunhv_console_write_bychar(struct console *con, const char *s, unsig
499 } else 499 } else
500 spin_lock(&port->lock); 500 spin_lock(&port->lock);
501 501
502 spin_lock_irqsave(&port->lock, flags);
503 for (i = 0; i < n; i++) { 502 for (i = 0; i < n; i++) {
504 if (*s == '\n') 503 if (*s == '\n')
505 sunhv_console_putchar(port, '\r'); 504 sunhv_console_putchar(port, '\r');
diff --git a/drivers/serial/ucc_uart.c b/drivers/serial/ucc_uart.c
index 01917c433f17..566a8b42e05a 100644
--- a/drivers/serial/ucc_uart.c
+++ b/drivers/serial/ucc_uart.c
@@ -195,7 +195,7 @@ struct uart_qe_port {
195 195
196static struct uart_driver ucc_uart_driver = { 196static struct uart_driver ucc_uart_driver = {
197 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
198 .driver_name = "serial", 198 .driver_name = "ucc_uart",
199 .dev_name = "ttyQE", 199 .dev_name = "ttyQE",
200 .major = SERIAL_QE_MAJOR, 200 .major = SERIAL_QE_MAJOR,
201 .minor = SERIAL_QE_MINOR, 201 .minor = SERIAL_QE_MINOR,