]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
sh: drain and wait for early printk
authorMagnus Damm <magnus.damm@gmail.com>
Wed, 23 Apr 2008 12:05:11 +0000 (21:05 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Thu, 8 May 2008 10:51:53 +0000 (19:51 +0900)
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>
arch/sh/kernel/early_printk.c

index 18ca249e8409aa7508de4b8fbfa788961f09674c..11b4c85999b73f7746903c50c0fb71b6fa9fbe33 100644 (file)
@@ -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 == ',')
@@ -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);