diff options
author | Leonid Lobachev <leonidl@google.com> | 2018-07-16 12:30:01 -0700 |
---|---|---|
committer | faqiang.zhu <faqiang.zhu@nxp.com> | 2018-11-12 09:18:34 +0800 |
commit | 8be00c435edfbbe75340ff9b3686f712fd51be52 (patch) | |
tree | 0a0e5ec61713454c2aaccda5be7c3a20d0bfad8a /drivers | |
parent | 3e5fa4bcfddfb04822d2332899412943de4dd4f5 (diff) |
Fix P0/EVT boards boot without serial cable connection.
Change-Id: I5969217e400ab494f9a74662d1d228fcf2e2d465
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/serial/serial_mxc.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index cce80a8559e..552952ef46c 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -212,12 +212,27 @@ static void mxc_serial_putc(const char c) WATCHDOG_RESET(); } -/* Test whether a character is in the RX buffer */ +/* + * Test whether a character is in the RX buffer + */ +static int one_time_rx_line_always_low_workaround_needed = 1; static int mxc_serial_tstc(void) { /* If receive fifo is empty, return false */ if (readl(&mxc_base->ts) & UTS_RXEMPTY) return 0; + + /* Empty RX FIFO if receiver is stuck because of RXD line being low */ + if (one_time_rx_line_always_low_workaround_needed) { + one_time_rx_line_always_low_workaround_needed = 0; + if (!(readl(&mxc_base->sr2) & USR2_RDR)) { + while (!(readl(&mxc_base->ts) & UTS_RXEMPTY)) { + (void) readl(&mxc_base->rxd); + } + return 0; + } + } + return 1; } |