diff options
author | Minkyu Kang <mk7.kang@samsung.com> | 2009-11-10 20:23:50 +0900 |
---|---|---|
committer | Minkyu Kang <mk7.kang@samsung.com> | 2009-11-13 15:41:29 +0900 |
commit | 78b06d63e20cbcacd0db35224f1a2a71cd00e910 (patch) | |
tree | cfea98a1882a1db2eddd52e1227d67481d4e2e2b | |
parent | 288822372010272ad8ef5b0cd53cf0cd5ab18680 (diff) | |
download | u-boot-imx-78b06d63e20cbcacd0db35224f1a2a71cd00e910.zip u-boot-imx-78b06d63e20cbcacd0db35224f1a2a71cd00e910.tar.gz u-boot-imx-78b06d63e20cbcacd0db35224f1a2a71cd00e910.tar.bz2 |
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: Minkyu Kang <mk7.kang@samsung.com>
-rw-r--r-- | drivers/serial/serial_s5pc1xx.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/serial/serial_s5pc1xx.c b/drivers/serial/serial_s5pc1xx.c index 68c06a9..73669a9 100644 --- a/drivers/serial/serial_s5pc1xx.c +++ b/drivers/serial/serial_s5pc1xx.c @@ -98,14 +98,24 @@ int serial_init_dev(const int dev_index) 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); + 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 1; - - return 0; + return readl(&uart->uerstat) & mask; } /* @@ -119,7 +129,7 @@ int serial_getc_dev(const int dev_index) /* wait for character to arrive */ while (!(readl(&uart->utrstat) & 0x1)) { - if (serial_err_check(dev_index)) + if (serial_err_check(dev_index, 0)) return 0; } @@ -135,7 +145,7 @@ void serial_putc_dev(const char c, const int dev_index) /* wait for room in the tx FIFO */ while (!(readl(&uart->utrstat) & 0x2)) { - if (serial_err_check(dev_index)) + if (serial_err_check(dev_index, 1)) return; } |