Commit c5469efd6cda82cacdbb5549da3f8be1f1195032

Authored by Leonid Lobachev
Committed by Ye Li
1 parent a6b2f96257

Fix P0/EVT boards boot without serial cable connection.

Change-Id: I5969217e400ab494f9a74662d1d228fcf2e2d465
(cherry picked from commit 92c762e1b80b3b12852e3f766cdb16a6be3cbbf8)

Showing 1 changed file with 16 additions and 1 deletions Side-by-side Diff

drivers/serial/serial_mxc.c
... ... @@ -216,12 +216,27 @@
216 216 WATCHDOG_RESET();
217 217 }
218 218  
219   -/* Test whether a character is in the RX buffer */
  219 +/*
  220 + * Test whether a character is in the RX buffer
  221 + */
  222 +static int one_time_rx_line_always_low_workaround_needed = 1;
220 223 static int mxc_serial_tstc(void)
221 224 {
222 225 /* If receive fifo is empty, return false */
223 226 if (readl(&mxc_base->ts) & UTS_RXEMPTY)
224 227 return 0;
  228 +
  229 + /* Empty RX FIFO if receiver is stuck because of RXD line being low */
  230 + if (one_time_rx_line_always_low_workaround_needed) {
  231 + one_time_rx_line_always_low_workaround_needed = 0;
  232 + if (!(readl(&mxc_base->sr2) & USR2_RDR)) {
  233 + while (!(readl(&mxc_base->ts) & UTS_RXEMPTY)) {
  234 + (void) readl(&mxc_base->rxd);
  235 + }
  236 + return 0;
  237 + }
  238 + }
  239 +
225 240 return 1;
226 241 }
227 242