summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2012-09-18 18:19:05 -0500
committerScott Wood <scottwood@freescale.com>2012-11-26 15:41:20 -0600
commitcb55b3320014b7f6014416c556fe506efbf0a84b (patch)
treeece89cb1b0454dda903960f615cc2cac1f7bebbb
parent48cbc3a8761fad6624fb63f1d56f09a30322bfd9 (diff)
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 <scottwood@freescale.com> -- v2: fixed typo in subject, and explained what the bit does in the changelog
-rw-r--r--drivers/serial/ns16550.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 9027781445f..bbd91ca247d 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)