aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWill Newton <will.newton@gmail.com>2008-09-02 17:35:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-09-02 22:21:38 -0400
commit363f66fe06c75270b669c88e321e6b354ba0201e (patch)
treea960c88fb37f43dfef77c41a589a8a46721cab92
parentbd7aa4b2dafd8e653df265479d99c80747602a50 (diff)
8250: improve workaround for UARTs that don't re-assert THRE correctly
Recent changes to tighten the check for UARTs that don't correctly re-assert THRE (01c194d9278efc15d4785ff205643e9c0bdcef53: "serial 8250: tighten test for using backup timer") caused problems when such a UART was opened for the second time - the bug could only successfully be detected at first initialization. For users of this version of this particular UART IP it is fatal. This patch stores the information about the bug in the bugs field of the port structure when the port is first started up so subsequent opens can check this bit even if the test for the bug fails. David Brownell: "My own exposure to this is that the UART on DaVinci hardware, which TI allegedly derived from its original 16550 logic, has periodically gone from working to unusable with the mainline 8250.c ... and back and forth a bunch. Currently it's "unusable", a regression from some previous versions. With this patch from Will, it's usable." Signed-off-by: Will Newton <will.newton@gmail.com> Acked-by: Alex Williamson <alex.williamson@hp.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: David Brownell <david-b@pacbell.net> Cc: <stable@kernel.org> [2.6.26.x] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/serial/8250.c16
-rw-r--r--drivers/serial/8250.h1
2 files changed, 13 insertions, 4 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 342e12fb1c25..9ccc563d8730 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1908,15 +1908,23 @@ static int serial8250_startup(struct uart_port *port)
1908 * kick the UART on a regular basis. 1908 * kick the UART on a regular basis.
1909 */ 1909 */
1910 if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { 1910 if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
1911 up->bugs |= UART_BUG_THRE;
1911 pr_debug("ttyS%d - using backup timer\n", port->line); 1912 pr_debug("ttyS%d - using backup timer\n", port->line);
1912 up->timer.function = serial8250_backup_timeout;
1913 up->timer.data = (unsigned long)up;
1914 mod_timer(&up->timer, jiffies +
1915 poll_timeout(up->port.timeout) + HZ / 5);
1916 } 1913 }
1917 } 1914 }
1918 1915
1919 /* 1916 /*
1917 * The above check will only give an accurate result the first time
1918 * the port is opened so this value needs to be preserved.
1919 */
1920 if (up->bugs & UART_BUG_THRE) {
1921 up->timer.function = serial8250_backup_timeout;
1922 up->timer.data = (unsigned long)up;
1923 mod_timer(&up->timer, jiffies +
1924 poll_timeout(up->port.timeout) + HZ / 5);
1925 }
1926
1927 /*
1920 * If the "interrupt" for this port doesn't correspond with any 1928 * If the "interrupt" for this port doesn't correspond with any
1921 * hardware interrupt, we use a timer-based system. The original 1929 * hardware interrupt, we use a timer-based system. The original
1922 * driver used to do this with IRQ0. 1930 * driver used to do this with IRQ0.
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index 78c00162b04e..520260326f3d 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -47,6 +47,7 @@ struct serial8250_config {
47#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ 47#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
48#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ 48#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
49#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ 49#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
50#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */
50 51
51#define PROBE_RSA (1 << 0) 52#define PROBE_RSA (1 << 0)
52#define PROBE_ANY (~0) 53#define PROBE_ANY (~0)