From patchwork Tue Oct 30 02:04:50 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot,v2,02/22] serial/ns16550: wait for TEMT before initializing From: Scott Wood X-Patchwork-Id: 195230 Message-Id: <1351562710-6237-3-git-send-email-scottwood@freescale.com> To: Cc: Scott Wood Date: Mon, 29 Oct 2012 21:04:50 -0500 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 --- drivers/serial/ns16550.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 9027781..bbd91ca 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)