aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-06-29 13:41:51 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-06-29 13:41:51 -0400
commite763b90c41563a0f8258d379fe71a9a1f1fa5445 (patch)
tree0f20763191d255c5291f31f62ad80f41410f6222
parent0dd7a1aed7c34a39917c4faf75b4230c169e809b (diff)
[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: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/serial/8250.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index b53b53bb1475..429994d5bc8b 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -993,21 +993,24 @@ static void autoconfig_irq(struct uart_8250_port *up)
993 up->port.irq = (irq > 0) ? irq : 0; 993 up->port.irq = (irq > 0) ? irq : 0;
994} 994}
995 995
996static inline void __stop_tx(struct uart_8250_port *p)
997{
998 if (p->ier & UART_IER_THRI) {
999 p->ier &= ~UART_IER_THRI;
1000 serial_out(p, UART_IER, p->ier);
1001 }
1002}
1003
996static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop) 1004static void serial8250_stop_tx(struct uart_port *port, unsigned int tty_stop)
997{ 1005{
998 struct uart_8250_port *up = (struct uart_8250_port *)port; 1006 struct uart_8250_port *up = (struct uart_8250_port *)port;
999 1007
1000 if (up->ier & UART_IER_THRI) { 1008 __stop_tx(up);
1001 up->ier &= ~UART_IER_THRI;
1002 serial_out(up, UART_IER, up->ier);
1003 }
1004 1009
1005 /* 1010 /*
1006 * We only do this from uart_stop - if we run out of 1011 * We really want to stop the transmitter from sending.
1007 * characters to send, we don't want to prevent the
1008 * FIFO from emptying.
1009 */ 1012 */
1010 if (up->port.type == PORT_16C950 && tty_stop) { 1013 if (up->port.type == PORT_16C950) {
1011 up->acr |= UART_ACR_TXDIS; 1014 up->acr |= UART_ACR_TXDIS;
1012 serial_icr_write(up, UART_ACR, up->acr); 1015 serial_icr_write(up, UART_ACR, up->acr);
1013 } 1016 }
@@ -1031,10 +1034,11 @@ static void serial8250_start_tx(struct uart_port *port, unsigned int tty_start)
1031 transmit_chars(up); 1034 transmit_chars(up);
1032 } 1035 }
1033 } 1036 }
1037
1034 /* 1038 /*
1035 * We only do this from uart_start 1039 * Re-enable the transmitter if we disabled it.
1036 */ 1040 */
1037 if (tty_start && up->port.type == PORT_16C950) { 1041 if (up->port.type == PORT_16C950 && up->acr & UART_ACR_TXDIS) {
1038 up->acr &= ~UART_ACR_TXDIS; 1042 up->acr &= ~UART_ACR_TXDIS;
1039 serial_icr_write(up, UART_ACR, up->acr); 1043 serial_icr_write(up, UART_ACR, up->acr);
1040 } 1044 }
@@ -1155,7 +1159,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
1155 return; 1159 return;
1156 } 1160 }
1157 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { 1161 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) {
1158 serial8250_stop_tx(&up->port, 0); 1162 __stop_tx(up);
1159 return; 1163 return;
1160 } 1164 }
1161 1165
@@ -1174,7 +1178,7 @@ static _INLINE_ void transmit_chars(struct uart_8250_port *up)
1174 DEBUG_INTR("THRE..."); 1178 DEBUG_INTR("THRE...");
1175 1179
1176 if (uart_circ_empty(xmit)) 1180 if (uart_circ_empty(xmit))
1177 serial8250_stop_tx(&up->port, 0); 1181 __stop_tx(up);
1178} 1182}
1179 1183
1180static _INLINE_ void check_modem_status(struct uart_8250_port *up) 1184static _INLINE_ void check_modem_status(struct uart_8250_port *up)