* [PATCH] serial: 8250_mtk: support big baud rate.
@ 2016-08-12 2:41 Long Cheng
2016-08-25 3:15 ` Long Cheng
0 siblings, 1 reply; 2+ messages in thread
From: Long Cheng @ 2016-08-12 2:41 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, Matthias Brugger
Cc: Eddie Huang, Peter Hurley, linux-serial, linux-arm-kernel,
linux-mediatek, linux-kernel, srv_heupstream, Long Cheng
From: Eddie Huang <eddie.huang@mediatek.com>
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 <long.cheng@mediatek.com>
---
drivers/tty/serial/8250/8250_mtk.c | 6 +-----
drivers/tty/serial/8250/8250_port.c | 4 +---
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
index 3611ec9..ce0cc47 100644
--- a/drivers/tty/serial/8250/8250_mtk.c
+++ b/drivers/tty/serial/8250/8250_mtk.c
@@ -62,7 +62,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
*/
baud = uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff,
- port->uartclk / 16);
+ port->uartclk);
if (baud <= 115200) {
serial_port_out(port, UART_MTK_HIGHS, 0x0);
@@ -76,10 +76,6 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
quot = DIV_ROUND_UP(port->uartclk, 4 * baud);
} else {
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);
}
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index 7481b95..c45c1e3 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2504,8 +2504,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
struct ktermios *termios,
struct ktermios *old)
{
- unsigned int tolerance = port->uartclk / 100;
-
/*
* Ask the core to calculate the divisor for us.
* 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,
*/
return uart_get_baud_rate(port, termios, old,
port->uartclk / 16 / 0xffff,
- (port->uartclk + tolerance) / 16);
+ port->uartclk);
}
void
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] serial: 8250_mtk: support big baud rate.
2016-08-12 2:41 [PATCH] serial: 8250_mtk: support big baud rate Long Cheng
@ 2016-08-25 3:15 ` Long Cheng
0 siblings, 0 replies; 2+ messages in thread
From: Long Cheng @ 2016-08-25 3:15 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Jiri Slaby, Matthias Brugger, Eddie Huang, Peter Hurley,
linux-serial, linux-arm-kernel, linux-mediatek, linux-kernel,
srv_heupstream
On Fri, 2016-08-12 at 10:41 +0800, Long Cheng wrote:
> From: Eddie Huang <eddie.huang@mediatek.com>
>
> 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 <long.cheng@mediatek.com>
> ---
> drivers/tty/serial/8250/8250_mtk.c | 6 +-----
> drivers/tty/serial/8250/8250_port.c | 4 +---
> 2 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_mtk.c b/drivers/tty/serial/8250/8250_mtk.c
> index 3611ec9..ce0cc47 100644
> --- a/drivers/tty/serial/8250/8250_mtk.c
> +++ b/drivers/tty/serial/8250/8250_mtk.c
> @@ -62,7 +62,7 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
> */
> baud = uart_get_baud_rate(port, termios, old,
> port->uartclk / 16 / 0xffff,
> - port->uartclk / 16);
> + port->uartclk);
>
> if (baud <= 115200) {
> serial_port_out(port, UART_MTK_HIGHS, 0x0);
> @@ -76,10 +76,6 @@ mtk8250_set_termios(struct uart_port *port, struct ktermios *termios,
> quot = DIV_ROUND_UP(port->uartclk, 4 * baud);
> } else {
> 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);
> }
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index 7481b95..c45c1e3 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -2504,8 +2504,6 @@ static unsigned int serial8250_get_baud_rate(struct uart_port *port,
> struct ktermios *termios,
> struct ktermios *old)
> {
> - unsigned int tolerance = port->uartclk / 100;
> -
> /*
> * Ask the core to calculate the divisor for us.
> * 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,
> */
> return uart_get_baud_rate(port, termios, old,
> port->uartclk / 16 / 0xffff,
> - (port->uartclk + tolerance) / 16);
> + port->uartclk);
> }
>
> void
Ping? Any reaction to the above?
Regards, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-08-25 4:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-12 2:41 [PATCH] serial: 8250_mtk: support big baud rate Long Cheng
2016-08-25 3:15 ` Long Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).