From: Magnus Damm <magnus.damm@gmail.com>
To: linux-sh@vger.kernel.org
Subject: [PATCH] sh-sci: console drainage
Date: Tue, 24 Feb 2009 06:57:12 +0000 [thread overview]
Message-ID: <20090224065712.31491.72199.sendpatchset@rx1.opensource.se> (raw)
From: Magnus Damm <damm@igel.co.jp>
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>
---
This is the first step against clock framework integration,
after all bits are sent we can disable the data clock.
Also useful when debugging or shutting down a system.
Tested with SCIF on sh7785lcr, not sure about SCI and SCIFA.
drivers/serial/sh-sci.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
--- 0001/drivers/serial/sh-sci.c
+++ work/drivers/serial/sh-sci.c 2009-02-18 15:59:05.000000000 +0900
@@ -139,7 +139,7 @@ static void sci_poll_put_char(struct uar
} 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
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
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)
next reply other threads:[~2009-02-24 6:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-24 6:57 Magnus Damm [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-03-03 6:18 [PATCH] sh-sci: console drainage Paul Mundt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090224065712.31491.72199.sendpatchset@rx1.opensource.se \
--to=magnus.damm@gmail.com \
--cc=linux-sh@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.