Signed-off-by: Alexander Shiyan <shc_w...@mail.ru>
---
 drivers/serial/serial_clps711x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/serial/serial_clps711x.c b/drivers/serial/serial_clps711x.c
index c21ca6510..863ba7dd3 100644
--- a/drivers/serial/serial_clps711x.c
+++ b/drivers/serial/serial_clps711x.c
@@ -46,7 +46,7 @@ static int clps711x_setbaudrate(struct console_device *cdev, 
int baudrate)
        int divisor;
        u32 tmp;
 
-       divisor = (clk_get_rate(s->uart_clk) / 16) / baudrate;
+       divisor = DIV_ROUND_CLOSEST(clk_get_rate(s->uart_clk), baudrate * 16);
 
        tmp = readl(s->base + UBRLCR) & ~UBRLCR_BAUD_MASK;
        tmp |= divisor - 1;
-- 
2.13.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to