diff options
Diffstat (limited to 'drivers/tty/serial/st-asc.c')
-rw-r--r-- | drivers/tty/serial/st-asc.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/tty/serial/st-asc.c b/drivers/tty/serial/st-asc.c index f48b1cc07ee..8b2d7356611 100644 --- a/drivers/tty/serial/st-asc.c +++ b/drivers/tty/serial/st-asc.c @@ -411,12 +411,6 @@ static void asc_stop_rx(struct uart_port *port) asc_disable_rx_interrupts(port); } -/* Force modem status interrupts on */ -static void asc_enable_ms(struct uart_port *port) -{ - /* Nothing here yet .. */ -} - /* Handle breaks - ignored by us */ static void asc_break_ctl(struct uart_port *port, int break_state) { @@ -533,12 +527,12 @@ static void asc_set_termios(struct uart_port *port, struct ktermios *termios, * ASCBaudRate = ------------------------ * inputclock * - * However to keep the maths inside 32bits we divide top and - * bottom by 64. The +1 is to avoid a divide by zero if the - * input clock rate is something unexpected. + * To keep maths inside 64bits, we divide inputclock by 16. */ - u32 counter = (baud * 16384) / ((port->uartclk / 64) + 1); - asc_out(port, ASC_BAUDRATE, counter); + u64 dividend = (u64)baud * (1 << 16); + + do_div(dividend, port->uartclk / 16); + asc_out(port, ASC_BAUDRATE, dividend); ctrl_val |= ASC_CTL_BAUDMODE; } @@ -644,7 +638,6 @@ static struct uart_ops asc_uart_ops = { .start_tx = asc_start_tx, .stop_tx = asc_stop_tx, .stop_rx = asc_stop_rx, - .enable_ms = asc_enable_ms, .break_ctl = asc_break_ctl, .startup = asc_startup, .shutdown = asc_shutdown, @@ -849,7 +842,8 @@ static int asc_console_setup(struct console *co, char *options) * this to be called during the uart port registration when the * driver gets probed and the port should be mapped at that point. */ - BUG_ON(ascport->port.mapbase == 0 || ascport->port.membase == NULL); + if (ascport->port.mapbase == 0 || ascport->port.membase == NULL) + return -ENXIO; if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); |