serial: sh-sci: console drainage

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, March 26, 2009 - 12:21 pm

Gitweb:     http://git.kernel.org/linus/973e5d525d39be6f9f6c38d37aacf03efda02e60
Commit:     973e5d525d39be6f9f6c38d37aacf03efda02e60
Parent:     a73090ffaf0f6853880d9ac3fff7e5d88215131a
Author:     Magnus Damm <damm@igel.co.jp>
AuthorDate: Tue Feb 24 15:57:12 2009 +0900
Committer:  Paul Mundt <lethal@linux-sh.org>
CommitDate: Fri Feb 27 16:50:00 2009 +0900

    serial: sh-sci: console drainage
    
    Modify the serial console code to wait for the transmit FIFO,
    make sure all bits have been put on the wire before returning.
    
    Signed-off-by: Magnus Damm <damm@igel.co.jp>
    Signed-off-by: Paul Mundt <lethal@linux-sh.org>
---
 drivers/serial/sh-sci.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c
index 557b54a..d3ccce0 100644
--- a/drivers/serial/sh-sci.c
+++ b/drivers/serial/sh-sci.c
@@ -139,7 +139,7 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
 	} while (!(status & SCxSR_TDxE(port)));
 
 	sci_in(port, SCxSR);            /* Dummy read */
-	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port));
+	sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port) & ~SCxSR_TEND(port));
 	sci_out(port, SCxTDR, c);
 }
 #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
@@ -1095,6 +1095,7 @@ static void serial_console_write(struct console *co, const char *s,
 				 unsigned count)
 {
 	struct uart_port *port = &serial_console_port->port;
+	unsigned short bits;
 	int i;
 
 	for (i = 0; i < count; i++) {
@@ -1103,6 +1104,11 @@ static void serial_console_write(struct console *co, const char *s,
 
 		sci_poll_put_char(port, *s++);
 	}
+
+	/* wait until fifo is empty and last bit has been transmitted */
+	bits = SCxSR_TDxE(port) | SCxSR_TEND(port);
+	while ((sci_in(port, SCxSR) & bits) != bits)
+		cpu_relax();
 }
 
 static int __init serial_console_setup(struct console *co, char *options)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
serial: sh-sci: console drainage, Linux Kernel Mailing ..., (Thu Mar 26, 12:21 pm)