Skip to content

Commit 81bb549

Browse files
EddieHuangMTKgregkh
authored andcommitted
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: Long Cheng <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 490d5ce commit 81bb549

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

drivers/tty/serial/8250/8250_mtk.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
6262
*/
6363
baud = uart_get_baud_rate(port, termios, old,
6464
port->uartclk / 16 / 0xffff,
65-
port->uartclk / 16);
65+
port->uartclk);
6666

6767
if (baud <= 115200) {
6868
serial_port_out(port, UART_MTK_HIGHS, 0x0);
@@ -76,10 +76,6 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
7676
quot = DIV_ROUND_UP(port->uartclk, 4 * baud);
7777
} else {
7878
serial_port_out(port, UART_MTK_HIGHS, 0x3);
79-
80-
/* Set to highest baudrate supported */
81-
if (baud >= 1152000)
82-
baud = 921600;
8379
quot = DIV_ROUND_UP(port->uartclk, 256 * baud);
8480
}
8581

drivers/tty/serial/8250/8250_port.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2504,8 +2504,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
25042504
struct ktermios *termios,
25052505
struct ktermios *old)
25062506
{
2507-
unsigned int tolerance = port->uartclk / 100;
2508-
25092507
/*
25102508
* Ask the core to calculate the divisor for us.
25112509
* 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,
25142512
*/
25152513
return uart_get_baud_rate(port, termios, old,
25162514
port->uartclk / 16 / 0xffff,
2517-
(port->uartclk + tolerance) / 16);
2515+
port->uartclk);
25182516
}
25192517

25202518
void

0 commit comments

Comments
 (0)