提交 973e5d52 编写于 作者: M Magnus Damm 提交者: Paul Mundt

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: NMagnus Damm <damm@igel.co.jp>
Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
上级 a73090ff
...@@ -139,7 +139,7 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c) ...@@ -139,7 +139,7 @@ static void sci_poll_put_char(struct uart_port *port, unsigned char c)
} while (!(status & SCxSR_TDxE(port))); } while (!(status & SCxSR_TDxE(port)));
sci_in(port, SCxSR); /* Dummy read */ 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); sci_out(port, SCxTDR, c);
} }
#endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */ #endif /* CONFIG_CONSOLE_POLL || CONFIG_SERIAL_SH_SCI_CONSOLE */
...@@ -1095,6 +1095,7 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -1095,6 +1095,7 @@ static void serial_console_write(struct console *co, const char *s,
unsigned count) unsigned count)
{ {
struct uart_port *port = &serial_console_port->port; struct uart_port *port = &serial_console_port->port;
unsigned short bits;
int i; int i;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
...@@ -1103,6 +1104,11 @@ static void serial_console_write(struct console *co, const char *s, ...@@ -1103,6 +1104,11 @@ static void serial_console_write(struct console *co, const char *s,
sci_poll_put_char(port, *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) static int __init serial_console_setup(struct console *co, char *options)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册