diff options
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 cce80a8559..552952ef46 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; } |