From: Scott Wood Date: Tue, 18 Sep 2012 23:19:05 +0000 (-0500) Subject: serial/ns16550: wait for TEMT before initializing X-Git-Tag: v2013.01-rc2~117^2~27 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cb55b3320014b7f6014416c556fe506efbf0a84b;p=oweals%2Fu-boot.git serial/ns16550: wait for TEMT before initializing TEMT is set when the transmitter is totally empty and all output has finished. This prevents output problems (including a loss of synchronization observed on p2020 that persisted for quite a while) if SPL has output still on its way out. Signed-off-by: Scott Wood -- v2: fixed typo in subject, and explained what the bit does in the changelog --- diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 9027781445..bbd91ca247 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -36,6 +36,9 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) { + while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT)) + ; + serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \ defined(CONFIG_AM33XX)