diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2015-01-22 12:24:26 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-02-02 13:11:27 -0500 |
commit | d1f2f219319813070c022e841f48bfd0fe17fd34 (patch) | |
tree | a2f73cb32605312c8a828c2b7151958ddbafdbfd | |
parent | 01ba8d6af4b76aee99a8ae3a76748c8c36db49f3 (diff) |
serial: 8250: Move UART_BUG_QUOT workaround
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>
-rw-r--r-- | drivers/tty/serial/8250/8250_core.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index df8a5aa96bc6..8e3302c6bbff 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c | |||
@@ -2413,8 +2413,9 @@ static void serial8250_shutdown(struct uart_port *port) | |||
2413 | serial8250_do_shutdown(port); | 2413 | serial8250_do_shutdown(port); |
2414 | } | 2414 | } |
2415 | 2415 | ||
2416 | static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int baud) | 2416 | static unsigned int serial8250_get_divisor(struct uart_8250_port *up, unsigned int baud) |
2417 | { | 2417 | { |
2418 | struct uart_port *port = &up->port; | ||
2418 | unsigned int quot; | 2419 | unsigned int quot; |
2419 | 2420 | ||
2420 | /* | 2421 | /* |
@@ -2430,6 +2431,12 @@ static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int | |||
2430 | else | 2431 | else |
2431 | quot = uart_get_divisor(port, baud); | 2432 | quot = uart_get_divisor(port, baud); |
2432 | 2433 | ||
2434 | /* | ||
2435 | * Oxford Semi 952 rev B workaround | ||
2436 | */ | ||
2437 | if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0) | ||
2438 | quot++; | ||
2439 | |||
2433 | return quot; | 2440 | return quot; |
2434 | } | 2441 | } |
2435 | 2442 | ||
@@ -2478,13 +2485,7 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, | |||
2478 | baud = uart_get_baud_rate(port, termios, old, | 2485 | baud = uart_get_baud_rate(port, termios, old, |
2479 | port->uartclk / 16 / 0xffff, | 2486 | port->uartclk / 16 / 0xffff, |
2480 | port->uartclk / 16); | 2487 | port->uartclk / 16); |
2481 | quot = serial8250_get_divisor(port, baud); | 2488 | quot = serial8250_get_divisor(up, baud); |
2482 | |||
2483 | /* | ||
2484 | * Oxford Semi 952 rev B workaround | ||
2485 | */ | ||
2486 | if (up->bugs & UART_BUG_QUOT && (quot & 0xff) == 0) | ||
2487 | quot++; | ||
2488 | 2489 | ||
2489 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { | 2490 | if (up->capabilities & UART_CAP_FIFO && port->fifosize > 1) { |
2490 | /* NOTE: If fifo_bug is not set, a user can set RX_trigger. */ | 2491 | /* NOTE: If fifo_bug is not set, a user can set RX_trigger. */ |