From 584044d78bb9de8b18cfd9633e8b706d99593c8d Mon Sep 17 00:00:00 2001 From: Huibin Hong Date: Mon, 14 Jan 2019 16:02:21 +0800 Subject: [PATCH] serial: 8250_dw: new baud rate and clk solution baud rate <=1500000, except 1152000, use 24MHz baud rate > 1500000, and 1152000 use pll Change-Id: I9f52fcafdf8cc3d32be78f8408ab75873ffff680 Signed-off-by: Huibin Hong --- drivers/tty/serial/8250/8250_dw.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c index ac15231bb0d2..4d624c1a9ed0 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -313,7 +313,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, struct dw8250_data *d = p->private_data; long rate; #ifdef CONFIG_ARCH_ROCKCHIP - unsigned int div, rate_temp, diff; + unsigned int rate_temp, diff; #endif int ret; @@ -322,15 +322,14 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, clk_disable_unprepare(d->clk); #ifdef CONFIG_ARCH_ROCKCHIP - if ((baud * 16) <= 4000000) { - /* - * Make sure uart sclk is high enough - */ - div = 4000000 / baud / 16; - rate = baud * 16 * div; - } else { + if (baud <= 115200) + rate = 24000000; + else if (baud == 230400) + rate = baud * 16 * 2; + else if (baud == 1152000) + rate = baud * 16 * 2; + else rate = baud * 16; - } ret = clk_set_rate(d->clk, rate); rate_temp = clk_get_rate(d->clk);