Commit da924e49 authored by Will Newton's avatar Will Newton Committed by Greg Kroah-Hartman

8250: improve workaround for UARTs that don't re-assert THRE correctly

commit 363f66fe upstream

Recent changes to tighten the check for UARTs that don't correctly
re-assert THRE (01c194d9: "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: default avatarWill Newton <will.newton@gmail.com>
Acked-by: default avatarAlex Williamson <alex.williamson@hp.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cd9295c8
...@@ -1895,13 +1895,21 @@ static int serial8250_startup(struct uart_port *port) ...@@ -1895,13 +1895,21 @@ static int serial8250_startup(struct uart_port *port)
* kick the UART on a regular basis. * kick the UART on a regular basis.
*/ */
if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) { if (!(iir1 & UART_IIR_NO_INT) && (iir & UART_IIR_NO_INT)) {
up->bugs |= UART_BUG_THRE;
pr_debug("ttyS%d - using backup timer\n", port->line); pr_debug("ttyS%d - using backup timer\n", port->line);
}
}
/*
* The above check will only give an accurate result the first time
* the port is opened so this value needs to be preserved.
*/
if (up->bugs & UART_BUG_THRE) {
up->timer.function = serial8250_backup_timeout; up->timer.function = serial8250_backup_timeout;
up->timer.data = (unsigned long)up; up->timer.data = (unsigned long)up;
mod_timer(&up->timer, jiffies + mod_timer(&up->timer, jiffies +
poll_timeout(up->port.timeout) + HZ / 5); poll_timeout(up->port.timeout) + HZ / 5);
} }
}
/* /*
* If the "interrupt" for this port doesn't correspond with any * If the "interrupt" for this port doesn't correspond with any
......
...@@ -49,6 +49,7 @@ struct serial8250_config { ...@@ -49,6 +49,7 @@ struct serial8250_config {
#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */ #define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */
#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */
#define PROBE_RSA (1 << 0) #define PROBE_RSA (1 << 0)
#define PROBE_ANY (~0) #define PROBE_ANY (~0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment