Skip to content

Commit

Permalink
sh: drain and wait for early printk
Browse files Browse the repository at this point in the history
Drain by waiting for all characters to be sent, and make sure to
wait a little bit after setting up the baud rate.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Magnus Damm authored and Paul Mundt committed May 8, 2008
1 parent 0fba321 commit 4a65e38
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/sh/kernel/early_printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ static void scif_sercon_init(char *s)
{
struct uart_port *port = &scif_port;
unsigned baud = DEFAULT_BAUD;
unsigned int status;
char *e;

if (*s == ',')
Expand All @@ -161,12 +162,17 @@ static void scif_sercon_init(char *s)
baud = DEFAULT_BAUD;
}

do {
status = sci_in(port, SCxSR);
} while (!(status & SCxSR_TEND(port)));

sci_out(port, SCSCR, 0); /* TE=0, RE=0 */
sci_out(port, SCSMR, 0);

/* Set baud rate */
sci_out(port, SCBRR, (CONFIG_SH_PCLK_FREQ + 16 * baud) /
(32 * baud) - 1);
udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */

sci_out(port, SCFCR, 12);
sci_out(port, SCFCR, 8);
Expand Down

0 comments on commit 4a65e38

Please sign in to comment.