Commit e763b90c authored by Russell King's avatar Russell King Committed by Russell King

[PATCH] Serial: Disable OX950 transmitter for flow control

Disable the transmitter whenever we want to prevent characters
being transmitted by flow control.  However, if we run out of
characters to send and want to only disable the TX interrupt,
allow that scenario.
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 0dd7a1ae
...@@ -993,21 +993,24 @@ static void autoconfig_irq(struct uart_8250_port *up) ...@@ -993,21 +993,24 @@ static void autoconfig_irq(struct uart_8250_port *up)
up->port.irq = (irq > 0) ? irq : 0; up->port.irq = (irq > 0) ? irq : 0;
} }
static inline void __stop_tx(struct uart_8250_port *p)
{
if (p->ier & UART_IER_THRI) {
p->ier &= ~UART_IER_THRI;
serial_out(p, UART_IER, p->ier);
}
}
static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
{ {
struct uart_8250_port *up = (struct uart_8250_port *)port; struct uart_8250_port *up = (struct uart_8250_port *)port;
if (up->ier & UART_IER_THRI) { __stop_tx(up);
up->ier &= ~UART_IER_THRI;
serial_out(up, UART_IER, up->ier);
}
/* /*
* We only do this from uart_stop - if we run out of * We really want to stop the transmitter from sending.
* characters to send, we don't want to prevent the
* FIFO from emptying.
*/ */
if (up->port.type == PORT_16C950 && tty_stop) { if (up->port.type == PORT_16C950) {
up->acr |= UART_ACR_TXDIS; up->acr |= UART_ACR_TXDIS;
serial_icr_write(up, UART_ACR, up->acr); serial_icr_write(up, UART_ACR, up->acr);
} }
...@@ -1031,10 +1034,11 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start) ...@@ -1031,10 +1034,11 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
transmit_chars(up); transmit_chars(up);
} }
} }
/* /*
* We only do this from uart_start * Re-enable the transmitter if we disabled it.
*/ */
if (tty_start && up->port.type == PORT_16C950) { if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) {
up->acr &= ~UART_ACR_TXDIS; up->acr &= ~UART_ACR_TXDIS;
serial_icr_write(up, UART_ACR, up->acr); serial_icr_write(up, UART_ACR, up->acr);
} }
...@@ -1155,7 +1159,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up) ...@@ -1155,7 +1159,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
return; return;
} }
if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
serial8250_stop_tx(&up->port, 0); __stop_tx(up);
return; return;
} }
...@@ -1174,7 +1178,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up) ...@@ -1174,7 +1178,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
DEBUG_INTR("THRE..."); DEBUG_INTR("THRE...");
if (uart_circ_empty(xmit)) if (uart_circ_empty(xmit))
serial8250_stop_tx(&up->port, 0); __stop_tx(up);
} }
static _INLINE_ void check_modem_status(struct uart_8250_port *up) static _INLINE_ void check_modem_status(struct uart_8250_port *up)
......
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