mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 14:41:31 +00:00
serial: pl01x: drain PL01x FIFO before baudrate change
Not draining the FIFO and waiting for the UART to be non-busy before changing baudrate results in crap characters on the console, so let's wait for the FIFO to drain and the last character to be clocked out before we do that. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
349e83f071
commit
96baa4c376
1 changed files with 10 additions and 0 deletions
|
@ -194,7 +194,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(®s->fr) & UART_PL01x_FR_TXFE))
|
||||
WATCHDOG_RESET();
|
||||
while (readl(®s->fr) & UART_PL01x_FR_BUSY)
|
||||
WATCHDOG_RESET();
|
||||
serial_init();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue