]> git.sur5r.net Git - u-boot/blobdiff - drivers/serial/serial_pl01x.c
serial: arm: Implement CONFIG_SERIAL_MULTI into atmel serial driver
[u-boot] / drivers / serial / serial_pl01x.c
index 7a064ffb24dfa169095e68c209bbbd286290989f..d4c5137092f48648ce3e75aecd8bf2cb9ef04186 100644 (file)
@@ -156,6 +156,8 @@ int serial_init (void)
                        writel(lcr, &regs->fr);
 
                writel(lcr, &regs->pl011_rlcr);
+               /* lcrh needs to be set again for change to be effective */
+               writel(lcr, &regs->pl011_lcrh);
        }
 #endif
        /* Finally, enable the UART */
@@ -194,7 +196,17 @@ int serial_tstc (void)
 
 void serial_setbrg (void)
 {
+       struct pl01x_regs *regs = pl01x_get_regs(CONSOLE_PORT);
+
        baudrate = gd->baudrate;
+       /*
+        * Flush FIFO and wait for non-busy before changing baudrate to avoid
+        * crap in console
+        */
+       while (!(readl(&regs->fr) & UART_PL01x_FR_TXFE))
+               WATCHDOG_RESET();
+       while (readl(&regs->fr) & UART_PL01x_FR_BUSY)
+               WATCHDOG_RESET();
        serial_init();
 }