Skip to content

Commit

Permalink
serial: 8250: Move UART_BUG_QUOT workaround
Browse files Browse the repository at this point in the history
The UART_BUG_QUOT workaround adjusts the divisor computed from the
baud rate by serial8250_get_divisor(). Move the workaround into
serial8250_get_divisor(), so that divisor-from-baud computation
is encapsulated.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Feb 2, 2015
1 parent 01ba8d6 commit d1f2f21
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/tty/serial/8250/8250_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2413,8 +2413,9 @@ static void serial8250_shutdown(struct uart_port *port)
serial8250_do_shutdown(port);
}

static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud)
static unsigned int serial8250_get_divisor(struct uart_8250_port *up, unsigned int baud)
{
struct uart_port *port = &up->port;
unsigned int quot;

/*
Expand All @@ -2430,6 +2431,12 @@ static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int
else
quot = uart_get_divisor(port, baud);

/*
* Oxford Semi 952 rev B workaround
*/
if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0)
quot++;

return quot;
}

Expand Down Expand Up @@ -2478,13 +2485,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff,
port->uartclk / 16);
quot = serial8250_get_divisor(port, baud);

/*
* Oxford Semi 952 rev B workaround
*/
if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0)
quot++;
quot = serial8250_get_divisor(up, baud);

if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) {
/* NOTE: If fifo_bug is not set, a user can set RX_trigger. */
Expand Down

0 comments on commit d1f2f21

Please sign in to comment.