summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/serial/serial_imx.c4
-rw-r--r--include/serial/imx-uart.h9
2 files changed, 11 insertions, 2 deletions
diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c
index 5b9b0d6ca8..ed00a91b80 100644
--- a/drivers/serial/serial_imx.c
+++ b/drivers/serial/serial_imx.c
@@ -178,9 +178,9 @@ static int imx_serial_setbaudrate(struct console_device *cdev, int baudrate)
writel(val, regs + UCR1);
/* Set the numerator value minus one of the BRM ratio */
- writel((baudrate / 100) - 1, regs + UBIR);
+ writel(baudrate_to_ubir(baudrate), regs + UBIR);
/* Set the denominator value minus one of the BRM ratio */
- writel((imx_serial_reffreq(priv) / 1600) - 1, regs + UBMR);
+ writel(refclock_to_ubmr(imx_serial_reffreq(priv)), regs + UBMR);
writel(ucr1, regs + UCR1);
diff --git a/include/serial/imx-uart.h b/include/serial/imx-uart.h
index 0a0178882a..7275e6ac38 100644
--- a/include/serial/imx-uart.h
+++ b/include/serial/imx-uart.h
@@ -115,5 +115,14 @@
#define UTS_RXFULL (1<<3) /* RxFIFO full */
#define UTS_SOFTRST (1<<0) /* Software reset */
+static inline int baudrate_to_ubir(int baudrate)
+{
+ return baudrate / 100 - 1;
+}
+
+static inline int refclock_to_ubmr(int clock_hz)
+{
+ return clock_hz / 1600 - 1;
+}
#endif /* __IMX_UART_H__ */