From f828f552d7cc4a24111b2cb360e673c03b2367ad Mon Sep 17 00:00:00 2001 From: Feng Tang Date: Thu, 14 Oct 2010 17:47:35 +0800 Subject: [PATCH] --- yaml --- r: 213523 b: refs/heads/master c: e5586eccc9aaf485985480e4d3049acffaa3fa90 h: refs/heads/master i: 213521: 56ff851c92e3e6d0c1a06de4b52226dd227e92bb 213519: 43d88c34812843f90838cd47cde21f9f1210ef79 v: v3 --- [refs] | 2 +- trunk/drivers/serial/mfd.c | 41 +++++++++++++++++++++++++------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 712a67bcdec1..4d5d7b136243 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: abf4f6a51477a68fe144b0c62f10c410b0c41378 +refs/heads/master: e5586eccc9aaf485985480e4d3049acffaa3fa90 diff --git a/trunk/drivers/serial/mfd.c b/trunk/drivers/serial/mfd.c index ad35130cd8a0..735799e30aa9 100644 --- a/trunk/drivers/serial/mfd.c +++ b/trunk/drivers/serial/mfd.c @@ -929,39 +929,52 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, cval |= UART_LCR_EPAR; /* + * The base clk is 50Mhz, and the baud rate come from: + * baud = 50M * MUL / (DIV * PS * DLAB) + * * For those basic low baud rate we can get the direct - * scalar from 2746800, like 115200 = 2746800/24, for those - * higher baud rate, we have to handle them case by case, - * but DIV reg is never touched as its default value 0x3d09 + * scalar from 2746800, like 115200 = 2746800/24. For those + * higher baud rate, we handle them case by case, mainly by + * adjusting the MUL/PS registers, and DIV register is kept + * as default value 0x3d09 to make things simple */ baud = uart_get_baud_rate(port, termios, old, 0, 4000000); - quot = uart_get_divisor(port, baud); + quot = 1; switch (baud) { case 3500000: mul = 0x3345; ps = 0xC; - quot = 1; + break; + case 3000000: + mul = 0x2EE0; break; case 2500000: mul = 0x2710; - ps = 0x10; - quot = 1; break; - case 18432000: + case 2000000: + mul = 0x1F40; + break; + case 1843200: mul = 0x2400; - ps = 0x10; - quot = 1; break; case 1500000: - mul = 0x1D4C; - ps = 0xc; - quot = 1; + mul = 0x1770; + break; + case 1000000: + mul = 0xFA0; + break; + case 500000: + mul = 0x7D0; break; default: - ; + /* Use uart_get_divisor to get quot for other baud rates */ + quot = 0; } + if (!quot) + quot = uart_get_divisor(port, baud); + if ((up->port.uartclk / quot) < (2400 * 16)) fcr = UART_FCR_ENABLE_FIFO | UART_FCR_HSU_64_1B; else if ((up->port.uartclk / quot) < (230400 * 16))