summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2015-05-06 12:31:58 -0700
committerSascha Hauer <s.hauer@pengutronix.de>2015-05-07 09:49:38 +0200
commit7aca256facf543162e2718091d69e1a61b62bc61 (patch)
treef0c30c917f8d5e67bffbfaaef8d9e71fdff5f29c /drivers
parent18a5a9b969cf9af5d3668bd6e5918554369439d3 (diff)
downloadbarebox-7aca256facf543162e2718091d69e1a61b62bc61.tar.gz
barebox-7aca256facf543162e2718091d69e1a61b62bc61.tar.xz
i.MX: serial: Add baud rate calculation convenience functions
Add two functions to calculate values for UBMR and UBIR registers. This way both early serial initalization code and serial_imx.c can use them and not duplicate the code. Singed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/serial/serial_imx.c4
1 files changed, 2 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);