Commit 81bb549f authored by Eddie Huang's avatar Eddie Huang Committed by Greg Kroah-Hartman

serial: 8250_mtk: support big baud rate.

mediatek can support baud rate up to 4M.
the 'uart_get_baud_rate' function will limit the max baud rate.
Modify max baud to remove the limit.
Signed-off-by: default avatarLong Cheng <long.cheng@mediatek.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 490d5ce2
...@@ -62,7 +62,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -62,7 +62,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
*/ */
baud = uart_get_baud_rate(port, termios, old, baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff, port->uartclk / 16 / 0xffff,
port->uartclk / 16); port->uartclk);
if (baud <= 115200) { if (baud <= 115200) {
serial_port_out(port, UART_MTK_HIGHS, 0x0); serial_port_out(port, UART_MTK_HIGHS, 0x0);
...@@ -76,10 +76,6 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios, ...@@ -76,10 +76,6 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
quot = DIV_ROUND_UP(port->uartclk, 4 * baud); quot = DIV_ROUND_UP(port->uartclk, 4 * baud);
} else { } else {
serial_port_out(port, UART_MTK_HIGHS, 0x3); serial_port_out(port, UART_MTK_HIGHS, 0x3);
/* Set to highest baudrate supported */
if (baud >= 1152000)
baud = 921600;
quot = DIV_ROUND_UP(port->uartclk, 256 * baud); quot = DIV_ROUND_UP(port->uartclk, 256 * baud);
} }
......
...@@ -2504,8 +2504,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, ...@@ -2504,8 +2504,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
struct ktermios *termios, struct ktermios *termios,
struct ktermios *old) struct ktermios *old)
{ {
unsigned int tolerance = port->uartclk / 100;
/* /*
* Ask the core to calculate the divisor for us. * Ask the core to calculate the divisor for us.
* Allow 1% tolerance at the upper limit so uart clks marginally * Allow 1% tolerance at the upper limit so uart clks marginally
...@@ -2514,7 +2512,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port, ...@@ -2514,7 +2512,7 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
*/ */
return uart_get_baud_rate(port, termios, old, return uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff, port->uartclk / 16 / 0xffff,
(port->uartclk + tolerance) / 16); port->uartclk);
} }
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment