summaryrefslogtreecommitdiff
path: root/drivers/serial
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-06-19 12:53:59 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2013-06-19 12:53:59 +0200
commit69f14dc2fd64307f012381dd333a06001dec75dc (patch)
tree1c520dfb9afd8406230a5382ebaf57b0b8cd6c5d /drivers/serial
parent847e6693ccb529bf8346db62876f38f0c4e04ade (diff)
parented7bdc03eb516fb698ccc12ec5b4b9f132d05c5f (diff)
downloadu-boot-imx-69f14dc2fd64307f012381dd333a06001dec75dc.zip
u-boot-imx-69f14dc2fd64307f012381dd333a06001dec75dc.tar.gz
u-boot-imx-69f14dc2fd64307f012381dd333a06001dec75dc.tar.bz2
Merge branch 'u-boot-samsung/master' into 'u-boot-arm/master'
Conflicts: spl/Makefile
Diffstat (limited to 'drivers/serial')
-rw-r--r--drivers/serial/serial_s5p.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c
index 3c41242..e65125c 100644
--- a/drivers/serial/serial_s5p.c
+++ b/drivers/serial/serial_s5p.c
@@ -30,6 +30,10 @@
DECLARE_GLOBAL_DATA_PTR;
+#define RX_FIFO_COUNT_MASK 0xff
+#define RX_FIFO_FULL_MASK (1 << 8)
+#define TX_FIFO_FULL_MASK (1 << 24)
+
static inline struct s5p_uart *s5p_get_base_uart(int dev_index)
{
u32 offset = dev_index * sizeof(struct s5p_uart);
@@ -87,8 +91,8 @@ int serial_init_dev(const int dev_index)
{
struct s5p_uart *const uart = s5p_get_base_uart(dev_index);
- /* reset and enable FIFOs, set triggers to the maximum */
- writel(0, &uart->ufcon);
+ /* enable FIFOs */
+ writel(0x1, &uart->ufcon);
writel(0, &uart->umcon);
/* 8N1 */
writel(0x3, &uart->ulcon);
@@ -130,7 +134,8 @@ int serial_getc_dev(const int dev_index)
struct s5p_uart *const uart = s5p_get_base_uart(dev_index);
/* wait for character to arrive */
- while (!(readl(&uart->utrstat) & 0x1)) {
+ while (!(readl(&uart->ufstat) & (RX_FIFO_COUNT_MASK |
+ RX_FIFO_FULL_MASK))) {
if (serial_err_check(dev_index, 0))
return 0;
}
@@ -146,7 +151,7 @@ void serial_putc_dev(const char c, const int dev_index)
struct s5p_uart *const uart = s5p_get_base_uart(dev_index);
/* wait for room in the tx FIFO */
- while (!(readl(&uart->utrstat) & 0x2)) {
+ while ((readl(&uart->ufstat) & TX_FIFO_FULL_MASK)) {
if (serial_err_check(dev_index, 1))
return;
}