From: John Jacques <john.jacq...@intel.com>

The baud rate calculation was truncating instead of rounding. This
caused, in some cases, the initial baud rate to be set incorrectly.

Updated to use DIV_ROUND_CLOSEST().

Signed-off-by: John Jacques <john.jacq...@intel.com>
---
 drivers/tty/serial/amba-pl011.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c
index 3565fff..a8e624f 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1998,7 +1998,8 @@ pl011_console_get_options(struct uart_amba_port *uap, int 
*baud,
                ibrd = readw(uap->port.membase + UART011_IBRD);
                fbrd = readw(uap->port.membase + UART011_FBRD);
 
-               *baud = uap->port.uartclk * 4 / (64 * ibrd + fbrd);
+               *baud = DIV_ROUND_CLOSEST(uap->port.uartclk * 4,
+                                         64 * ibrd + fbrd);
 
                if (uap->vendor->oversampling) {
                        if (readw(uap->port.membase + UART011_CR)
-- 
2.7.4

-- 
_______________________________________________
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto

Reply via email to