diff options
author | Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com> | 2011-09-19 15:06:50 +0530 |
---|---|---|
committer | Preetham-rao K <preetham.rao@stericsson.com> | 2011-09-28 12:41:32 +0200 |
commit | 68e87447f4361f612d6cde754cf54fcc772a6180 (patch) | |
tree | 7f7ae942287ecb49f13b76b73f737c5787c9f6f3 | |
parent | 07656d7d1653f4ce0bde41cc20084603acd5f42d (diff) |
u5500:Flush noise when UART cable is not connect
Avoid noise when console UART cable is not connected
and service mode is off by flushing the RX fifo.
ST-Ericsson ID: 363780
ST-Ericsson Linux next: NA
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Icbf4c80f16af601bd8718da42626e81ce9e07952
Signed-off-by: Naveen Kumar Gaddipati <naveen.gaddipati@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/31955
Reviewed-by: QATOOLS
Reviewed-by: Preetham-rao K <preetham.rao@stericsson.com>
-rw-r--r-- | drivers/serial/serial_pl01x.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index d541dd834..efc6a1f87 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -49,6 +49,10 @@ static void pl01x_putc (int portnum, char c); static int pl01x_getc (int portnum); static int pl01x_tstc (int portnum); +#ifdef CONFIG_U5500 +static int flush_fifo; +#endif + #ifdef CONFIG_PL010_SERIAL int serial_init (void) @@ -230,6 +234,24 @@ static int pl01x_getc (int portnum) static int pl01x_tstc (int portnum) { +#ifdef CONFIG_U5500 + /* + * Fix me for U5500 + * UART has to flush the RX fifo to avoid the noise + * when the UART is not connected and service mode is off + */ + if (!flush_fifo) { + /* Empty RX fifo if necessary */ + if (IO_READ(port[CONSOLE_PORT] + UART_PL011_CR) & + UART_PL011_CR_UARTEN) { + while (!(IO_READ(port[CONSOLE_PORT] + UART_PL01x_FR) & + UART_PL01x_FR_RXFE)) + IO_READ(port[CONSOLE_PORT] + UART_PL01x_DR); + } + flush_fifo = 1; + } +#endif + WATCHDOG_RESET(); return !(IO_READ (port[portnum] + UART_PL01x_FR) & UART_PL01x_FR_RXFE); |