[linux-yocto] [PATCH 1/5] tty: serial: Updated Baud Rate Calcualtion
Daniel Dragomir
daniel.dragomir at windriver.com
Mon Feb 9 09:42:23 PST 2015
From: John Jacques <john.jacques at lsi.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 lsi.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 477ebc5..bfbddec 100644
--- a/drivers/tty/serial/amba-pl011.c
+++ b/drivers/tty/serial/amba-pl011.c
@@ -1990,7 +1990,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)
--
1.8.1.4
More information about the linux-yocto
mailing list