]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
serial/ns16550: wait for TEMT before initializing
authorScott Wood <scottwood@freescale.com>
Tue, 18 Sep 2012 23:19:05 +0000 (18:19 -0500)
committerScott Wood <scottwood@freescale.com>
Mon, 26 Nov 2012 21:41:20 +0000 (15:41 -0600)
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 <scottwood@freescale.com>
--
v2: fixed typo in subject, and explained what the bit does in the changelog

drivers/serial/ns16550.c

index 9027781445f447efc63483294b2bf564947842df..bbd91ca247df995d2b5d11e865ea7ba391574239 100644 (file)
@@ -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)