aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorJoe Schultz <jschultz@xes-inc.com>2014-02-11 19:30:01 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-02-13 13:02:19 -0500
commit45a7bd635930baa960b6817674c64bdfb8f39570 (patch)
tree56f35c5f9a6b798fea94d06934e736bd18e4c601 /drivers/tty/serial
parente2613be5093d04e6589924d36a1e363eef3c87c7 (diff)
serial: 8250: Support XR17V35x fraction divisor
The Exar XR17V35x family of UARTs have an additional fractional divisor register (DLD) which was not being used. Calculate and set this register for these devices to reduce their baud rate error. Signed-off-by: Joe Schultz <jschultz@xes-inc.com> Signed-off-by: Aaron Sierra <asierra@xes-inc.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 61ecd709a722..69932b7556cf 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -2433,6 +2433,24 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios,
2433 serial_dl_write(up, quot); 2433 serial_dl_write(up, quot);
2434 2434
2435 /* 2435 /*
2436 * XR17V35x UARTs have an extra fractional divisor register (DLD)
2437 *
2438 * We need to recalculate all of the registers, because DLM and DLL
2439 * are already rounded to a whole integer.
2440 *
2441 * When recalculating we use a 32x clock instead of a 16x clock to
2442 * allow 1-bit for rounding in the fractional part.
2443 */
2444 if (up->port.type == PORT_XR17V35X) {
2445 unsigned int baud_x32 = (port->uartclk * 2) / baud;
2446 u16 quot = baud_x32 / 32;
2447 u8 quot_frac = DIV_ROUND_CLOSEST(baud_x32 % 32, 2);
2448
2449 serial_dl_write(up, quot);
2450 serial_port_out(port, 0x2, quot_frac & 0xf);
2451 }
2452
2453 /*
2436 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR 2454 * LCR DLAB must be set to enable 64-byte FIFO mode. If the FCR
2437 * is written without DLAB set, this mode will be disabled. 2455 * is written without DLAB set, this mode will be disabled.
2438 */ 2456 */