summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial/sprd_serial.c
diff options
context:
space:
mode:
authorLanqing Liu <lanqing.liu@unisoc.com>2019-02-19 08:31:11 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-26 12:35:02 +0100
commit5b9cea15a3de5d65000d49f626b71b00d42a0577 (patch)
treea5431021d1836f3bc3d8cb39fc40c232702903fb /drivers/tty/serial/sprd_serial.c
parentdt-bindings: serial: Add Milbeaut serial driver description (diff)
downloadlinux-5b9cea15a3de5d65000d49f626b71b00d42a0577.tar.xz
linux-5b9cea15a3de5d65000d49f626b71b00d42a0577.zip
serial: sprd: Modify the baud rate calculation formula
When the source clock is not divisible by the expected baud rate and the remainder is not less than half of the expected baud rate, the old formular will round up the frequency division coefficient. This will make the actual baud rate less than the expected value and can not meet the external transmission requirements. Thus this patch modifies the baud rate calculation formula to support the serial controller output the maximum baud rate. Signed-off-by: Lanqing Liu <lanqing.liu@unisoc.com> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial/sprd_serial.c')
-rw-r--r--drivers/tty/serial/sprd_serial.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index 4287ca305b6b..1891a45ac05d 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -371,7 +371,7 @@ static void sprd_set_termios(struct uart_port *port,
/* ask the core to calculate the divisor for us */
baud = uart_get_baud_rate(port, termios, old, 0, SPRD_BAUD_IO_LIMIT);
- quot = (unsigned int)((port->uartclk + baud / 2) / baud);
+ quot = port->uartclk / baud;
/* set data length */
switch (termios->c_cflag & CSIZE) {