aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/st-asc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c
index 4e9f4f29f3ce..8b2d7356611d 100644
--- a/drivers/tty/serial/st-asc.c
+++ b/drivers/tty/serial/st-asc.c
@@ -527,12 +527,12 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios,
527 * ASCBaudRate = ------------------------ 527 * ASCBaudRate = ------------------------
528 * inputclock 528 * inputclock
529 * 529 *
530 * However to keep the maths inside 32bits we divide top and 530 * To keep maths inside 64bits, we divide inputclock by 16.
531 * bottom by 64. The +1 is to avoid a divide by zero if the
532 * input clock rate is something unexpected.
533 */ 531 */
534 u32 counter = (baud * 16384) / ((port->uartclk / 64) + 1); 532 u64 dividend = (u64)baud * (1 << 16);
535 asc_out(port, ASC_BAUDRATE, counter); 533
534 do_div(dividend, port->uartclk / 16);
535 asc_out(port, ASC_BAUDRATE, dividend);
536 ctrl_val |= ASC_CTL_BAUDMODE; 536 ctrl_val |= ASC_CTL_BAUDMODE;
537 } 537 }
538 538