aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/sunsu.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-08-31 05:12:14 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-08-31 05:12:14 -0400
commitb129a8ccd53f74c43e4c83c8e0031a4990040830 (patch)
tree4c40afd836be87166d6d014380262f1baa19694f /drivers/serial/sunsu.c
parent6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff)
parent194d0710e1a7fe92dcf860ddd31fded8c3103b7a (diff)
[SERIAL] Clean up and fix tty transmission start/stoping
The start_tx and stop_tx methods were passed a flag to indicate whether the start/stop was from the tty start/stop callbacks, and some drivers used this flag to decide whether to ask the UART to immediately stop transmission (where the UART supports such a feature.) There are other cases when we wish this to occur - when CTS is lowered, or if we change from soft to hard flow control and CTS is inactive. In these cases, this flag was false, and we would allow the transmitter to drain before stopping. There is really only one case where we want to let the transmitter drain before disabling, and that's when we run out of characters to send. Hence, re-jig the start_tx and stop_tx methods to eliminate this flag, and introduce new functions for the special "disable and allow transmitter to drain" case. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/serial/sunsu.c')
-rw-r--r--drivers/serial/sunsu.c32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/serial/sunsu.c b/drivers/serial/sunsu.c
index d57a3553aea3..0cc879eb1c02 100644
--- a/drivers/serial/sunsu.c
+++ b/drivers/serial/sunsu.c
@@ -255,21 +255,27 @@ static void disable_rsa(struct uart_sunsu_port *up)
255} 255}
256#endif /* CONFIG_SERIAL_8250_RSA */ 256#endif /* CONFIG_SERIAL_8250_RSA */
257 257
258static void sunsu_stop_tx(struct uart_port *port, unsigned int tty_stop) 258static inline void __stop_tx(struct uart_sunsu_port *p)
259{
260 if (p->ier & UART_IER_THRI) {
261 p->ier &= ~UART_IER_THRI;
262 serial_out(p, UART_IER, p->ier);
263 }
264}
265
266static void sunsu_stop_tx(struct uart_port *port)
259{ 267{
260 struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; 268 struct uart_sunsu_port *up = (struct uart_sunsu_port *) port;
261 269
262 if (up->ier & UART_IER_THRI) { 270 __stop_tx(up);
263 up->ier &= ~UART_IER_THRI; 271
264 serial_out(up, UART_IER, up->ier); 272 if (up->port.type == PORT_16C950 && tty_stop /*FIXME*/) {
265 }
266 if (up->port.type == PORT_16C950 && tty_stop) {
267 up->acr |= UART_ACR_TXDIS; 273 up->acr |= UART_ACR_TXDIS;
268 serial_icr_write(up, UART_ACR, up->acr); 274 serial_icr_write(up, UART_ACR, up->acr);
269 } 275 }
270} 276}
271 277
272static void sunsu_start_tx(struct uart_port *port, unsigned int tty_start) 278static void sunsu_start_tx(struct uart_port *port)
273{ 279{
274 struct uart_sunsu_port *up = (struct uart_sunsu_port *) port; 280 struct uart_sunsu_port *up = (struct uart_sunsu_port *) port;
275 281
@@ -280,7 +286,7 @@ static void sunsu_start_tx(struct uart_port *port, unsigned int tty_start)
280 /* 286 /*
281 * We only do this from uart_start 287 * We only do this from uart_start
282 */ 288 */
283 if (tty_start && up->port.type == PORT_16C950) { 289 if (tty_start && up->port.type == PORT_16C950 /*FIXME*/) {
284 up->acr &= ~UART_ACR_TXDIS; 290 up->acr &= ~UART_ACR_TXDIS;
285 serial_icr_write(up, UART_ACR, up->acr); 291 serial_icr_write(up, UART_ACR, up->acr);
286 } 292 }
@@ -413,8 +419,12 @@ static _INLINE_ void transmit_chars(struct uart_sunsu_port *up)
413 up->port.x_char = 0; 419 up->port.x_char = 0;
414 return; 420 return;
415 } 421 }
416 if (uart_circ_empty(xmit) || uart_tx_stopped(&up->port)) { 422 if (uart_tx_stopped(&up->port)) {
417 sunsu_stop_tx(&up->port, 0); 423 sunsu_stop_tx(&up->port);
424 return;
425 }
426 if (uart_circ_empty(xmit)) {
427 __stop_tx(up);
418 return; 428 return;
419 } 429 }
420 430
@@ -431,7 +441,7 @@ static _INLINE_ void transmit_chars(struct uart_sunsu_port *up)
431 uart_write_wakeup(&up->port); 441 uart_write_wakeup(&up->port);
432 442
433 if (uart_circ_empty(xmit)) 443 if (uart_circ_empty(xmit))
434 sunsu_stop_tx(&up->port, 0); 444 __stop_tx(up);
435} 445}
436 446
437static _INLINE_ void check_modem_status(struct uart_sunsu_port *up) 447static _INLINE_ void check_modem_status(struct uart_sunsu_port *up)