[U-Boot] [PATCH] omap3_beagle: Enable CONFIG_SYS_NS16550_BROKEN_TEMT

Manfred Huber
2013-03-21T19:03:59Z

From: Manfred Huber

Beagleboard UART (ns16550) doesn't set the Transmitter Empty (TEMT) Bit
in SPL. Only Transmitter Hold Register Empty (THRE) Bit is set. This
makes SPL to hang while waiting for TEMT. Adding the
CONFIG_SYS_NS16550_BROKEN_TEMT config option and waiting for THRE avoid
this issue.

Signed-off-by: Manfred Huber <man.huber@arcor.de>
---
drivers/serial/ns16550.c | 5 ++++-
include/configs/omap3_beagle.h | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index b2da8b3..6379bcc 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -36,7 +36,10 @@

void NS16550_init(NS16550_t com_port, int baud_divisor)
{
-#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT))
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SYS_NS16550_BROKEN_TEMT)
+ while (!(serial_in(&com_port->lsr) & UART_LSR_THRE))
+ ;
+#else
while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT))
;
#endif
diff --git a/include/configs/omap3_beagle.h b/include/configs/omap3_beagle.h
index 48ce4c0..6ab46d5 100644
--- a/include/configs/omap3_beagle.h
+++ b/include/configs/omap3_beagle.h
@@ -82,6 +82,9 @@
#define CONFIG_SYS_NS16550_REG_SIZE (-4)
#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK

+/* define to avoid U-Boot to hang while waiting for TEMT */
+#define CONFIG_SYS_NS16550_BROKEN_TEMT
+
/*
* select serial console configuration
*/