1 diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
2 index 2209620..659c1bb 100644
3 --- a/drivers/tty/serial/8250.c
4 +++ b/drivers/tty/serial/8250.c
7 * Copyright (C) 2001 Russell King.
9 + * 2005/09/16: Enabled higher baud rates for 16C95x.
10 + * (Mathias Adam <a2@adamis.de>)
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 @@ -2227,6 +2230,14 @@ static unsigned int serial8250_get_divisor(struct uart_port *port, unsigned int
16 else if ((port->flags & UPF_MAGIC_MULTIPLIER) &&
17 baud == (port->uartclk/8))
20 + * For 16C950s UART_TCR is used in combination with divisor==1
21 + * to achieve baud rates up to baud_base*4.
23 + else if ((port->type == PORT_16C950) &&
24 + baud > (port->uartclk/16))
28 quot = uart_get_divisor(port, baud);
30 @@ -2240,7 +2251,7 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
31 struct uart_8250_port *up = (struct uart_8250_port *)port;
32 unsigned char cval, fcr = 0;
34 - unsigned int baud, quot;
35 + unsigned int baud, quot, max_baud;
37 switch (termios->c_cflag & CSIZE) {
39 @@ -2272,9 +2283,10 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
41 * Ask the core to calculate the divisor for us.
43 + max_baud = (up->port.type == PORT_16C950 ? port->uartclk/4 : port->uartclk/16);
44 baud = uart_get_baud_rate(port, termios, old,
45 port->uartclk / 16 / 0xffff,
46 - port->uartclk / 16);
48 quot = serial8250_get_divisor(port, baud);
51 @@ -2311,6 +2323,19 @@ serial8250_set_termios(struct uart_port *port, struct ktermios *termios,
52 spin_lock_irqsave(&up->port.lock, flags);
55 + * 16C950 supports additional prescaler ratios between 1:16 and 1:4
56 + * thus increasing max baud rate to uartclk/4.
58 + if (up->port.type == PORT_16C950) {
59 + if (baud == port->uartclk/4)
60 + serial_icr_write(up, UART_TCR, 0x4);
61 + else if (baud == port->uartclk/8)
62 + serial_icr_write(up, UART_TCR, 0x8);
64 + serial_icr_write(up, UART_TCR, 0);
68 * Update the per-port timeout.
70 uart_update_timeout(port, termios->c_cflag, baud);