diff options
author | Leonid Lobachev <leonidl@google.com> | 2018-07-16 12:30:01 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:36:18 -0700 |
commit | 762db13d5db02c6a72e39a802cb1f83b6bccdcce (patch) | |
tree | 79f4437d2cd7ed9a71bd967f5f3717ad160793a6 | |
parent | ea11732f12d2ba06dbc722dc5e2ef0be367dd149 (diff) |
Fix P0/EVT boards boot without serial cable connection.
Change-Id: I5969217e400ab494f9a74662d1d228fcf2e2d465
(cherry picked from commit 92c762e1b80b3b12852e3f766cdb16a6be3cbbf8)
-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 42abb96a26f..3efab1fa711 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -216,12 +216,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; } |