* [U-Boot] s5pc1xx: serial: fix the error check logic
@ 2009-11-10 11:40 Minkyu Kang
2009-11-13 7:36 ` Minkyu Kang
0 siblings, 1 reply; 2+ messages in thread
From: Minkyu Kang @ 2009-11-10 11:40 UTC (permalink / raw)
To: u-boot
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>
---
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..e06234d 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;
}
--
1.5.4.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [U-Boot] s5pc1xx: serial: fix the error check logic
2009-11-10 11:40 [U-Boot] s5pc1xx: serial: fix the error check logic Minkyu Kang
@ 2009-11-13 7:36 ` Minkyu Kang
0 siblings, 0 replies; 2+ messages in thread
From: Minkyu Kang @ 2009-11-13 7:36 UTC (permalink / raw)
To: u-boot
2009/11/10 Minkyu Kang <mk7.kang@samsung.com>:
> 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>
> ---
> ?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..e06234d 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;
> ? ? ? ?}
>
> --
> 1.5.4.3
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>
applied to u-boot-samsung
Minkyu Kang
--
from. prom.
www.promsoft.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-11-13 7:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-10 11:40 [U-Boot] s5pc1xx: serial: fix the error check logic Minkyu Kang
2009-11-13 7:36 ` Minkyu Kang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox