summaryrefslogtreecommitdiff
path: root/drivers/serial/serial_lpuart.c
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2016-01-13 19:39:01 -0800
committerSimon Glass <sjg@chromium.org>2016-01-20 19:10:14 -0700
commit47f1bfca404ab6d61c7d384183d82a5f9c14d09b (patch)
tree6a4f58d0fdb1cb2643c5e9c391f3f010f592372f /drivers/serial/serial_lpuart.c
parent5ed07cf53ccd47be65b5bcfef7432a75bfbfa65e (diff)
serial: lpuart: Fix several cosmetic issues
Clean up the driver codes a little bit, by: - Use tab instead of space in the macro defines - Use single line comment whenever possible - Fix insertion of blank lines Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/serial/serial_lpuart.c')
-rw-r--r--drivers/serial/serial_lpuart.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 63fc388b26..ae471837fa 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -12,15 +12,15 @@
#include <asm/arch/imx-regs.h>
#include <asm/arch/clock.h>
-#define US1_TDRE (1 << 7)
-#define US1_RDRF (1 << 5)
-#define US1_OR (1 << 3)
-#define UC2_TE (1 << 3)
-#define UC2_RE (1 << 2)
-#define CFIFO_TXFLUSH (1 << 7)
-#define CFIFO_RXFLUSH (1 << 6)
-#define SFIFO_RXOF (1 << 2)
-#define SFIFO_RXUF (1 << 0)
+#define US1_TDRE (1 << 7)
+#define US1_RDRF (1 << 5)
+#define US1_OR (1 << 3)
+#define UC2_TE (1 << 3)
+#define UC2_RE (1 << 2)
+#define CFIFO_TXFLUSH (1 << 7)
+#define CFIFO_RXFLUSH (1 << 6)
+#define SFIFO_RXOF (1 << 2)
+#define SFIFO_RXUF (1 << 0)
#define STAT_LBKDIF (1 << 31)
#define STAT_RXEDGIF (1 << 30)
@@ -34,7 +34,7 @@
#define STAT_MA1F (1 << 15)
#define STAT_MA2F (1 << 14)
#define STAT_FLAGS (STAT_LBKDIF | STAT_RXEDGIF | STAT_IDLE | STAT_OR | \
- STAT_NF | STAT_FE | STAT_PF | STAT_MA1F | STAT_MA2F)
+ STAT_NF | STAT_FE | STAT_PF | STAT_MA1F | STAT_MA2F)
#define CTRL_TE (1 << 19)
#define CTRL_RE (1 << 18)
@@ -59,8 +59,8 @@ static void lpuart_serial_setbrg(void)
gd->baudrate = CONFIG_BAUDRATE;
sbr = (u16)(clk / (16 * gd->baudrate));
- /* place adjustment later - n/32 BRFA */
+ /* place adjustment later - n/32 BRFA */
__raw_writeb(sbr >> 8, &base->ubdh);
__raw_writeb(sbr & 0xff, &base->ubdl);
}
@@ -86,9 +86,7 @@ static void lpuart_serial_putc(const char c)
__raw_writeb(c, &base->ud);
}
-/*
- * Test whether a character is in the RX buffer
- */
+/* Test whether a character is in the RX buffer */
static int lpuart_serial_tstc(void)
{
if (__raw_readb(&base->urcfifo) == 0)
@@ -120,7 +118,6 @@ static int lpuart_serial_init(void)
__raw_writeb(CFIFO_TXFLUSH | CFIFO_RXFLUSH, &base->ucfifo);
/* provide data bits, parity, stop bit, etc */
-
serial_setbrg();
__raw_writeb(UC2_RE | UC2_TE, &base->uc2);
@@ -148,8 +145,8 @@ static void lpuart32_serial_setbrg(void)
gd->baudrate = CONFIG_BAUDRATE;
sbr = (clk / (16 * gd->baudrate));
- /* place adjustment later - n/32 BRFA */
+ /* place adjustment later - n/32 BRFA */
out_be32(&base->baud, sbr);
}
@@ -176,9 +173,7 @@ static void lpuart32_serial_putc(const char c)
out_be32(&base->data, c);
}
-/*
- * Test whether a character is in the RX buffer
- */
+/* Test whether a character is in the RX buffer */
static int lpuart32_serial_tstc(void)
{
if ((in_be32(&base->water) >> 24) == 0)
@@ -204,8 +199,8 @@ static int lpuart32_serial_init(void)
out_be32(&base->fifo, ~(FIFO_TXFE | FIFO_RXFE));
out_be32(&base->match, 0);
- /* provide data bits, parity, stop bit, etc */
+ /* provide data bits, parity, stop bit, etc */
serial_setbrg();
out_be32(&base->ctrl, CTRL_RE | CTRL_TE);