aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/8250.c64
-rw-r--r--drivers/serial/8250.h3
-rw-r--r--drivers/serial/au1x00_uart.c10
-rw-r--r--drivers/serial/m32r_sio.c10
-rw-r--r--drivers/serial/pxa.c10
-rw-r--r--drivers/serial/s3c2410.c4
-rw-r--r--drivers/serial/sn_console.c1
7 files changed, 70 insertions, 32 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 30e8beb71430..d8b9d2b8c200 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -132,9 +132,9 @@ struct uart_8250_port {
132 struct uart_port port; 132 struct uart_port port;
133 struct timer_list timer; /* "no irq" timer */ 133 struct timer_list timer; /* "no irq" timer */
134 struct list_head list; /* ports on this IRQ */ 134 struct list_head list; /* ports on this IRQ */
135 unsigned int capabilities; /* port capabilities */ 135 unsigned short capabilities; /* port capabilities */
136 unsigned short bugs; /* port bugs */
136 unsigned int tx_loadsz; /* transmit fifo load size */ 137 unsigned int tx_loadsz; /* transmit fifo load size */
137 unsigned short rev;
138 unsigned char acr; 138 unsigned char acr;
139 unsigned char ier; 139 unsigned char ier;
140 unsigned char lcr; 140 unsigned char lcr;
@@ -560,7 +560,14 @@ static void autoconfig_has_efr(struct uart_8250_port *up)
560 if (id1 == 0x16 && id2 == 0xC9 && 560 if (id1 == 0x16 && id2 == 0xC9 &&
561 (id3 == 0x50 || id3 == 0x52 || id3 == 0x54)) { 561 (id3 == 0x50 || id3 == 0x52 || id3 == 0x54)) {
562 up->port.type = PORT_16C950; 562 up->port.type = PORT_16C950;
563 up->rev = rev | (id3 << 8); 563
564 /*
565 * Enable work around for the Oxford Semiconductor 952 rev B
566 * chip which causes it to seriously miscalculate baud rates
567 * when DLL is 0.
568 */
569 if (id3 == 0x52 && rev == 0x01)
570 up->bugs |= UART_BUG_QUOT;
564 return; 571 return;
565 } 572 }
566 573
@@ -577,8 +584,6 @@ static void autoconfig_has_efr(struct uart_8250_port *up)
577 584
578 id2 = id1 >> 8; 585 id2 = id1 >> 8;
579 if (id2 == 0x10 || id2 == 0x12 || id2 == 0x14) { 586 if (id2 == 0x10 || id2 == 0x12 || id2 == 0x14) {
580 if (id2 == 0x10)
581 up->rev = id1 & 255;
582 up->port.type = PORT_16850; 587 up->port.type = PORT_16850;
583 return; 588 return;
584 } 589 }
@@ -809,6 +814,7 @@ static void autoconfig(struct uart_8250_port *up, unsigned int probeflags)
809// save_flags(flags); cli(); 814// save_flags(flags); cli();
810 815
811 up->capabilities = 0; 816 up->capabilities = 0;
817 up->bugs = 0;
812 818
813 if (!(up->port.flags & UPF_BUGGY_UART)) { 819 if (!(up->port.flags & UPF_BUGGY_UART)) {
814 /* 820 /*
@@ -1021,6 +1027,8 @@ static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
1021 } 1027 }
1022} 1028}
1023 1029
1030static void transmit_chars(struct uart_8250_port *up);
1031
1024static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) 1032static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
1025{ 1033{
1026 struct uart_8250_port *up = (struct uart_8250_port *)port; 1034 struct uart_8250_port *up = (struct uart_8250_port *)port;
@@ -1028,6 +1036,14 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
1028 if (!(up->ier & UART_IER_THRI)) { 1036 if (!(up->ier & UART_IER_THRI)) {
1029 up->ier |= UART_IER_THRI; 1037 up->ier |= UART_IER_THRI;
1030 serial_out(up, UART_IER, up->ier); 1038 serial_out(up, UART_IER, up->ier);
1039
1040 if (up->bugs & UART_BUG_TXEN) {
1041 unsigned char lsr, iir;
1042 lsr = serial_in(up, UART_LSR);
1043 iir = serial_in(up, UART_IIR);
1044 if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT)
1045 transmit_chars(up);
1046 }
1031 } 1047 }
1032 /* 1048 /*
1033 * We only do this from uart_start 1049 * We only do this from uart_start
@@ -1433,6 +1449,7 @@ static int serial8250_startup(struct uart_port *port)
1433{ 1449{
1434 struct uart_8250_port *up = (struct uart_8250_port *)port; 1450 struct uart_8250_port *up = (struct uart_8250_port *)port;
1435 unsigned long flags; 1451 unsigned long flags;
1452 unsigned char lsr, iir;
1436 int retval; 1453 int retval;
1437 1454
1438 up->capabilities = uart_config[up->port.type].flags; 1455 up->capabilities = uart_config[up->port.type].flags;
@@ -1536,6 +1553,26 @@ static int serial8250_startup(struct uart_port *port)
1536 up->port.mctrl |= TIOCM_OUT2; 1553 up->port.mctrl |= TIOCM_OUT2;
1537 1554
1538 serial8250_set_mctrl(&up->port, up->port.mctrl); 1555 serial8250_set_mctrl(&up->port, up->port.mctrl);
1556
1557 /*
1558 * Do a quick test to see if we receive an
1559 * interrupt when we enable the TX irq.
1560 */
1561 serial_outp(up, UART_IER, UART_IER_THRI);
1562 lsr = serial_in(up, UART_LSR);
1563 iir = serial_in(up, UART_IIR);
1564 serial_outp(up, UART_IER, 0);
1565
1566 if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
1567 if (!(up->bugs & UART_BUG_TXEN)) {
1568 up->bugs |= UART_BUG_TXEN;
1569 pr_debug("ttyS%d - enabling bad tx status workarounds\n",
1570 port->line);
1571 }
1572 } else {
1573 up->bugs &= ~UART_BUG_TXEN;
1574 }
1575
1539 spin_unlock_irqrestore(&up->port.lock, flags); 1576 spin_unlock_irqrestore(&up->port.lock, flags);
1540 1577
1541 /* 1578 /*
@@ -1645,22 +1682,22 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
1645 1682
1646 switch (termios->c_cflag & CSIZE) { 1683 switch (termios->c_cflag & CSIZE) {
1647 case CS5: 1684 case CS5:
1648 cval = 0x00; 1685 cval = UART_LCR_WLEN5;
1649 break; 1686 break;
1650 case CS6: 1687 case CS6:
1651 cval = 0x01; 1688 cval = UART_LCR_WLEN6;
1652 break; 1689 break;
1653 case CS7: 1690 case CS7:
1654 cval = 0x02; 1691 cval = UART_LCR_WLEN7;
1655 break; 1692 break;
1656 default: 1693 default:
1657 case CS8: 1694 case CS8:
1658 cval = 0x03; 1695 cval = UART_LCR_WLEN8;
1659 break; 1696 break;
1660 } 1697 }
1661 1698
1662 if (termios->c_cflag & CSTOPB) 1699 if (termios->c_cflag & CSTOPB)
1663 cval |= 0x04; 1700 cval |= UART_LCR_STOP;
1664 if (termios->c_cflag & PARENB) 1701 if (termios->c_cflag & PARENB)
1665 cval |= UART_LCR_PARITY; 1702 cval |= UART_LCR_PARITY;
1666 if (!(termios->c_cflag & PARODD)) 1703 if (!(termios->c_cflag & PARODD))
@@ -1677,12 +1714,9 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
1677 quot = serial8250_get_divisor(port, baud); 1714 quot = serial8250_get_divisor(port, baud);
1678 1715
1679 /* 1716 /*
1680 * Work around a bug in the Oxford Semiconductor 952 rev B 1717 * Oxford Semi 952 rev B workaround
1681 * chip which causes it to seriously miscalculate baud rates
1682 * when DLL is 0.
1683 */ 1718 */
1684 if ((quot & 0xff) == 0 && up->port.type == PORT_16C950 && 1719 if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0)
1685 up->rev == 0x5201)
1686 quot ++; 1720 quot ++;
1687 1721
1688 if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) { 1722 if (up->capabilities & UART_CAP_FIFO && up->port.fifosize > 1) {
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index 4f3d62f222f4..9225c82faeb8 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -51,6 +51,9 @@ struct serial8250_config {
51#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */ 51#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */
52#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */ 52#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
53 53
54#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
55#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
56
54#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486)) 57#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
55#define _INLINE_ inline 58#define _INLINE_ inline
56#else 59#else
diff --git a/drivers/serial/au1x00_uart.c b/drivers/serial/au1x00_uart.c
index b6d3d5034940..5400dc2c087e 100644
--- a/drivers/serial/au1x00_uart.c
+++ b/drivers/serial/au1x00_uart.c
@@ -773,22 +773,22 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
773 773
774 switch (termios->c_cflag & CSIZE) { 774 switch (termios->c_cflag & CSIZE) {
775 case CS5: 775 case CS5:
776 cval = 0x00; 776 cval = UART_LCR_WLEN5;
777 break; 777 break;
778 case CS6: 778 case CS6:
779 cval = 0x01; 779 cval = UART_LCR_WLEN6;
780 break; 780 break;
781 case CS7: 781 case CS7:
782 cval = 0x02; 782 cval = UART_LCR_WLEN7;
783 break; 783 break;
784 default: 784 default:
785 case CS8: 785 case CS8:
786 cval = 0x03; 786 cval = UART_LCR_WLEN8;
787 break; 787 break;
788 } 788 }
789 789
790 if (termios->c_cflag & CSTOPB) 790 if (termios->c_cflag & CSTOPB)
791 cval |= 0x04; 791 cval |= UART_LCR_STOP;
792 if (termios->c_cflag & PARENB) 792 if (termios->c_cflag & PARENB)
793 cval |= UART_LCR_PARITY; 793 cval |= UART_LCR_PARITY;
794 if (!(termios->c_cflag & PARODD)) 794 if (!(termios->c_cflag & PARODD))
diff --git a/drivers/serial/m32r_sio.c b/drivers/serial/m32r_sio.c
index 08d61f13edc6..0301feacbde4 100644
--- a/drivers/serial/m32r_sio.c
+++ b/drivers/serial/m32r_sio.c
@@ -724,22 +724,22 @@ static void m32r_sio_set_termios(struct uart_port *port,
724 724
725 switch (termios->c_cflag & CSIZE) { 725 switch (termios->c_cflag & CSIZE) {
726 case CS5: 726 case CS5:
727 cval = 0x00; 727 cval = UART_LCR_WLEN5;
728 break; 728 break;
729 case CS6: 729 case CS6:
730 cval = 0x01; 730 cval = UART_LCR_WLEN6;
731 break; 731 break;
732 case CS7: 732 case CS7:
733 cval = 0x02; 733 cval = UART_LCR_WLEN7;
734 break; 734 break;
735 default: 735 default:
736 case CS8: 736 case CS8:
737 cval = 0x03; 737 cval = UART_LCR_WLEN8;
738 break; 738 break;
739 } 739 }
740 740
741 if (termios->c_cflag & CSTOPB) 741 if (termios->c_cflag & CSTOPB)
742 cval |= 0x04; 742 cval |= UART_LCR_STOP;
743 if (termios->c_cflag & PARENB) 743 if (termios->c_cflag & PARENB)
744 cval |= UART_LCR_PARITY; 744 cval |= UART_LCR_PARITY;
745 if (!(termios->c_cflag & PARODD)) 745 if (!(termios->c_cflag & PARODD))
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c
index 9dc151d8fa61..08b08d6ae904 100644
--- a/drivers/serial/pxa.c
+++ b/drivers/serial/pxa.c
@@ -455,22 +455,22 @@ serial_pxa_set_termios(struct uart_port *port, struct termios *termios,
455 455
456 switch (termios->c_cflag & CSIZE) { 456 switch (termios->c_cflag & CSIZE) {
457 case CS5: 457 case CS5:
458 cval = 0x00; 458 cval = UART_LCR_WLEN5;
459 break; 459 break;
460 case CS6: 460 case CS6:
461 cval = 0x01; 461 cval = UART_LCR_WLEN6;
462 break; 462 break;
463 case CS7: 463 case CS7:
464 cval = 0x02; 464 cval = UART_LCR_WLEN7;
465 break; 465 break;
466 default: 466 default:
467 case CS8: 467 case CS8:
468 cval = 0x03; 468 cval = UART_LCR_WLEN8;
469 break; 469 break;
470 } 470 }
471 471
472 if (termios->c_cflag & CSTOPB) 472 if (termios->c_cflag & CSTOPB)
473 cval |= 0x04; 473 cval |= UART_LCR_STOP;
474 if (termios->c_cflag & PARENB) 474 if (termios->c_cflag & PARENB)
475 cval |= UART_LCR_PARITY; 475 cval |= UART_LCR_PARITY;
476 if (!(termios->c_cflag & PARODD)) 476 if (!(termios->c_cflag & PARODD))
diff --git a/drivers/serial/s3c2410.c b/drivers/serial/s3c2410.c
index 2a9f7ade2c9d..5c4678478b1d 100644
--- a/drivers/serial/s3c2410.c
+++ b/drivers/serial/s3c2410.c
@@ -198,7 +198,7 @@ static inline struct s3c24xx_uart_port *to_ourport(struct uart_port *port)
198 198
199/* translate a port to the device name */ 199/* translate a port to the device name */
200 200
201static inline char *s3c24xx_serial_portname(struct uart_port *port) 201static inline const char *s3c24xx_serial_portname(struct uart_port *port)
202{ 202{
203 return to_platform_device(port->dev)->name; 203 return to_platform_device(port->dev)->name;
204} 204}
@@ -903,7 +903,7 @@ static void s3c24xx_serial_release_port(struct uart_port *port)
903 903
904static int s3c24xx_serial_request_port(struct uart_port *port) 904static int s3c24xx_serial_request_port(struct uart_port *port)
905{ 905{
906 char *name = s3c24xx_serial_portname(port); 906 const char *name = s3c24xx_serial_portname(port);
907 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY; 907 return request_mem_region(port->mapbase, MAP_SIZE, name) ? 0 : -EBUSY;
908} 908}
909 909
diff --git a/drivers/serial/sn_console.c b/drivers/serial/sn_console.c
index fee6418e84c4..840815fde49b 100644
--- a/drivers/serial/sn_console.c
+++ b/drivers/serial/sn_console.c
@@ -572,6 +572,7 @@ static void sn_transmit_chars(struct sn_cons_port *port, int raw)
572 572
573 if (uart_circ_empty(xmit) || uart_tx_stopped(&port->sc_port)) { 573 if (uart_circ_empty(xmit) || uart_tx_stopped(&port->sc_port)) {
574 /* Nothing to do. */ 574 /* Nothing to do. */
575 ia64_sn_console_intr_disable(SAL_CONSOLE_INTR_XMIT);
575 return; 576 return;
576 } 577 }
577 578