aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorMagnus Damm <magnus.damm@gmail.com>2008-04-23 08:05:11 -0400
committerPaul Mundt <lethal@linux-sh.org>2008-05-08 06:51:53 -0400
commit4a65e3827bcff072e5f4a96b3f73f9f17eb7d6d8 (patch)
treebdfc0eb486e76e31024cf7279c7f55c32516e827 /arch/sh
parent0fba32136579648a5782a41e93d4a79547456a89 (diff)
sh: drain and wait for early printk
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>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/kernel/early_printk.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index 18ca249e8409..11b4c85999b7 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -143,6 +143,7 @@ static void scif_sercon_init(char *s)
143{ 143{
144 struct uart_port *port = &scif_port; 144 struct uart_port *port = &scif_port;
145 unsigned baud = DEFAULT_BAUD; 145 unsigned baud = DEFAULT_BAUD;
146 unsigned int status;
146 char *e; 147 char *e;
147 148
148 if (*s == ',') 149 if (*s == ',')
@@ -161,12 +162,17 @@ static void scif_sercon_init(char *s)
161 baud = DEFAULT_BAUD; 162 baud = DEFAULT_BAUD;
162 } 163 }
163 164
165 do {
166 status = sci_in(port, SCxSR);
167 } while (!(status & SCxSR_TEND(port)));
168
164 sci_out(port, SCSCR, 0); /* TE=0, RE=0 */ 169 sci_out(port, SCSCR, 0); /* TE=0, RE=0 */
165 sci_out(port, SCSMR, 0); 170 sci_out(port, SCSMR, 0);
166 171
167 /* Set baud rate */ 172 /* Set baud rate */
168 sci_out(port, SCBRR, (CONFIG_SH_PCLK_FREQ + 16 * baud) / 173 sci_out(port, SCBRR, (CONFIG_SH_PCLK_FREQ + 16 * baud) /
169 (32 * baud) - 1); 174 (32 * baud) - 1);
175 udelay((1000000+(baud-1)) / baud); /* Wait one bit interval */
170 176
171 sci_out(port, SCFCR, 12); 177 sci_out(port, SCFCR, 12);
172 sci_out(port, SCFCR, 8); 178 sci_out(port, SCFCR, 8);