serial: 8250: Tolerate clock variance for max baud rate
authorJames Hogan <james.hogan@imgtec.com>
Fri, 25 Sep 2015 19:36:10 +0000 (15:36 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Oct 2015 18:12:25 +0000 (19:12 +0100)
commit4f56f3fdca43c9a18339b6e0c3b1aa2f57f6d0b0
tree4cc3ba6f84127d0b79630f48eb24d47f06d4c648
parentd215d80957ce98c318064c249ad0b7800c63a19d
serial: 8250: Tolerate clock variance for max baud rate

When the UART clock is set slightly under 1.8432MHz, the 8250 driver
core doesn't permit the 115200 baud rate since it calculates the maximum
frequency to pass to uart_get_baud_rate by simply dividing the uart
clock by 16 which yields a value slightly under 115200, even though the
frequency is close enough for the UART to operate reliably.

Therefore add some tolerance in the calculation of the maximum baud
rate. 1% tolerance allows for marginally slower uart clk than nominal
without introducing transmission errors.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
[pjh: Forward-port & refactor original patch; change tolerance to 1%]
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_port.c