From 1963f0ca19da4096cf3ccf08dbe993f1702122be 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 a2bc2e5ce0f8..667152efc5d5 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -248,7 +248,7 @@ static void dw8250_set_termios(struct uart_port *p, struct ktermios *termios, struct dw8250_data *d = p->private_data; unsigned int rate; #ifdef CONFIG_ARCH_ROCKCHIP - unsigned int div, rate_temp, diff; + unsigned int rate_temp, diff; #endif int ret; @@ -257,15 +257,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);