From b1516803d5274386256bef4972dfbf8c9eed5165 Mon Sep 17 00:00:00 2001 From: Guennadi Liakhovetski Date: Tue, 1 Dec 2009 09:54:46 +0000 Subject: serial: sh-sci: Fix too early port disabling. Currently serial ports on SH CPUs get disabled too early, because the sci_tx_empty() routine claims to not be able to detect whether the transmission has been completed and just always returns TIOCSER_TEMT. This results in corrupt output of last characters if the port is not open for reading at the same time. It is however possible to detect whether transmission has been completed. Use the TEND bit of the status register for this. Signed-off-by: Guennadi Liakhovetski Signed-off-by: Paul Mundt --- drivers/serial/sh-sci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/serial/sh-sci.c') diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 972fca0a3ef..ff38dbdb5c6 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c @@ -799,8 +799,8 @@ static void sci_free_irq(struct sci_port *port) static unsigned int sci_tx_empty(struct uart_port *port) { - /* Can't detect */ - return TIOCSER_TEMT; + unsigned short status = sci_in(port, SCxSR); + return status & SCxSR_TEND(port) ? TIOCSER_TEMT : 0; } static void sci_set_mctrl(struct uart_port *port, unsigned int mctrl) -- cgit v1.2.3-18-g5258