[linux-yocto] [PATCH 03/26] drivers/tty/serial: Updated Baud Rate Calcualtion
Daniel Dragomir
daniel.dragomir at windriver.com
Wed Nov 16 08:56:39 PST 2016
From: John Jacques <john.jacques at 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.jacques at 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
More information about the linux-yocto
mailing list