Skip to content
Snippets Groups Projects
Commit 94003226 authored by Minkyu Kang's avatar Minkyu Kang Committed by Tom Rix
Browse files

s5pc1xx: serial: fix the error check logic


Because of Frame error, Parity error and Overrun error are occured only receive
operation, need to masking when error checking.

Signed-off-by: default avatarMinkyu Kang <mk7.kang@samsung.com>
parent 9ebfdc20
No related branches found
No related tags found
No related merge requests found
...@@ -98,14 +98,24 @@ int serial_init_dev(const int dev_index) ...@@ -98,14 +98,24 @@ int serial_init_dev(const int dev_index)
return 0; return 0;
} }
static int serial_err_check(const int dev_index) static int serial_err_check(const int dev_index, int op)
{ {
struct s5pc1xx_uart *const uart = s5pc1xx_get_base_uart(dev_index); struct s5pc1xx_uart *const uart = s5pc1xx_get_base_uart(dev_index);
unsigned int mask;
/*
* UERSTAT
* Break Detect [3]
* Frame Err [2] : receive operation
* Parity Err [1] : receive operation
* Overrun Err [0] : receive operation
*/
if (op)
mask = 0x8;
else
mask = 0xf;
if (readl(&uart->uerstat) & 0xf) return readl(&uart->uerstat) & mask;
return 1;
return 0;
} }
/* /*
...@@ -119,7 +129,7 @@ int serial_getc_dev(const int dev_index) ...@@ -119,7 +129,7 @@ int serial_getc_dev(const int dev_index)
/* wait for character to arrive */ /* wait for character to arrive */
while (!(readl(&uart->utrstat) & 0x1)) { while (!(readl(&uart->utrstat) & 0x1)) {
if (serial_err_check(dev_index)) if (serial_err_check(dev_index, 0))
return 0; return 0;
} }
...@@ -135,7 +145,7 @@ void serial_putc_dev(const char c, const int dev_index) ...@@ -135,7 +145,7 @@ void serial_putc_dev(const char c, const int dev_index)
/* wait for room in the tx FIFO */ /* wait for room in the tx FIFO */
while (!(readl(&uart->utrstat) & 0x2)) { while (!(readl(&uart->utrstat) & 0x2)) {
if (serial_err_check(dev_index)) if (serial_err_check(dev_index, 1))
return; return;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment