summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-23 15:05:41 +0100
committerRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-23 15:05:41 +0100
commit55d3b282b90620e02e825304a9433732a84c58a5 (patch)
treeba48375ac5262a8587eb6237134ed0aa57e7174a
parent4ba5e35daa90871fcb9b01f5ad1e5723343cc0a9 (diff)
downloadtalos-obmc-linux-55d3b282b90620e02e825304a9433732a84c58a5.tar.gz
talos-obmc-linux-55d3b282b90620e02e825304a9433732a84c58a5.zip
[PATCH] Serial: Mobility's 16550A ports need a helping hand
The Mobility 16550A serial ports don't behave the same as standard 16550A ports, and need a helping hand to get them going once the transmitter has drained and been disabled. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/serial/8250.c31
-rw-r--r--drivers/serial/8250.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 27cc288e91d0..341c644591ae 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -1027,6 +1027,8 @@ static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
}
}
+static void transmit_chars(struct uart_8250_port *up);
+
static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
{
struct uart_8250_port *up = (struct uart_8250_port *)port;
@@ -1034,6 +1036,14 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
if (!(up->ier & UART_IER_THRI)) {
up->ier |= UART_IER_THRI;
serial_out(up, UART_IER, up->ier);
+
+ if (up->capabilities & UART_BUG_TXEN) {
+ unsigned char lsr, iir;
+ lsr = serial_in(up, UART_LSR);
+ iir = serial_in(up, UART_IIR);
+ if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT)
+ transmit_chars(up);
+ }
}
/*
* We only do this from uart_start
@@ -1439,6 +1449,7 @@ static int serial8250_startup(struct uart_port *port)
{
struct uart_8250_port *up = (struct uart_8250_port *)port;
unsigned long flags;
+ unsigned char lsr, iir;
int retval;
up->capabilities = uart_config[up->port.type].flags;
@@ -1542,6 +1553,26 @@ static int serial8250_startup(struct uart_port *port)
up->port.mctrl |= TIOCM_OUT2;
serial8250_set_mctrl(&up->port, up->port.mctrl);
+
+ /*
+ * Do a quick test to see if we receive an
+ * interrupt when we enable the TX irq.
+ */
+ serial_outp(up, UART_IER, UART_IER_THRI);
+ lsr = serial_in(up, UART_LSR);
+ iir = serial_in(up, UART_IIR);
+ serial_outp(up, UART_IER, 0);
+
+ if (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT) {
+ if (!(up->capabilities & UART_BUG_TXEN)) {
+ up->capabilities |= UART_BUG_TXEN;
+ pr_debug("ttyS%d - enabling bad tx status workarounds\n",
+ port->line);
+ }
+ } else {
+ up->capabilities &= ~UART_BUG_TXEN;
+ }
+
spin_unlock_irqrestore(&up->port.lock, flags);
/*
diff --git a/drivers/serial/8250.h b/drivers/serial/8250.h
index cd5c3dd2d910..9225c82faeb8 100644
--- a/drivers/serial/8250.h
+++ b/drivers/serial/8250.h
@@ -52,6 +52,7 @@ struct serial8250_config {
#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */
#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */
+#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */
#if defined(__i386__) && (defined(CONFIG_M386) || defined(CONFIG_M486))
#define _INLINE_ inline
OpenPOWER on IntegriCloud