diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 19:58:55 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-06-23 19:58:55 -0400 |
commit | f46f6b20cb01508f5020142ff91021f8fb39550b (patch) | |
tree | 30b8aa2014b03840a5f18d9196639cc80617c8c5 | |
parent | a8ad86f2dc46356f87be1327dabc18bdbda32f50 (diff) | |
parent | 67f7654ea1f11fac1cf4a33bf9a5d9079d122e70 (diff) |
Merge master.kernel.org:/home/rmk/linux-2.6-serial
-rw-r--r-- | drivers/serial/8250.c | 54 | ||||
-rw-r--r-- | drivers/serial/8250.h | 3 |
2 files changed, 47 insertions, 10 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c index 30e8beb71430..79f67fd863ec 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 | ||
1030 | static void transmit_chars(struct uart_8250_port *up); | ||
1031 | |||
1024 | static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) | 1032 | static 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 | /* |
@@ -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 |