diff options
author | Feng Tang <feng.tang@intel.com> | 2010-11-18 22:01:48 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-11-30 20:32:32 -0500 |
commit | a5880a9e5bb40fbae55de60051d69a29091053c3 (patch) | |
tree | e61272cc5ae771f435ce4e20ed9e2c7f933cd633 /drivers/serial/mfd.c | |
parent | acfa747baf73922021a047f2d87a2d866f5dbab5 (diff) |
serial: mfd: adjust the baud rate setting
Previous baud rate setting code only has been tested with 3.5M/9600/
115200/230400/460800 bps, and recently we got a 3M bps device to test,
which needs to modify current MUL register setting, and with this
patch 2.5M/2M/1.5M/1M/0.5M should also work as they just use a MUL
value scale down from 3M's.
Also got some reference register setting from silicon guys for
different baud rates, which tries to keep the pre-scalar register value
to 16.
Signed-off-by: Feng Tang <feng.tang@intel.com>
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial/mfd.c')
-rw-r--r-- | drivers/serial/mfd.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index 5fc699e929dc..d40010a22ecd 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -900,8 +900,7 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
900 | unsigned char cval, fcr = 0; | 900 | unsigned char cval, fcr = 0; |
901 | unsigned long flags; | 901 | unsigned long flags; |
902 | unsigned int baud, quot; | 902 | unsigned int baud, quot; |
903 | u32 mul = 0x3600; | 903 | u32 ps, mul; |
904 | u32 ps = 0x10; | ||
905 | 904 | ||
906 | switch (termios->c_cflag & CSIZE) { | 905 | switch (termios->c_cflag & CSIZE) { |
907 | case CS5: | 906 | case CS5: |
@@ -943,31 +942,24 @@ serial_hsu_set_termios(struct uart_port *port, struct ktermios *termios, | |||
943 | baud = uart_get_baud_rate(port, termios, old, 0, 4000000); | 942 | baud = uart_get_baud_rate(port, termios, old, 0, 4000000); |
944 | 943 | ||
945 | quot = 1; | 944 | quot = 1; |
945 | ps = 0x10; | ||
946 | mul = 0x3600; | ||
946 | switch (baud) { | 947 | switch (baud) { |
947 | case 3500000: | 948 | case 3500000: |
948 | mul = 0x3345; | 949 | mul = 0x3345; |
949 | ps = 0xC; | 950 | ps = 0xC; |
950 | break; | 951 | break; |
951 | case 3000000: | ||
952 | mul = 0x2EE0; | ||
953 | break; | ||
954 | case 2500000: | ||
955 | mul = 0x2710; | ||
956 | break; | ||
957 | case 2000000: | ||
958 | mul = 0x1F40; | ||
959 | break; | ||
960 | case 1843200: | 952 | case 1843200: |
961 | mul = 0x2400; | 953 | mul = 0x2400; |
962 | break; | 954 | break; |
955 | case 3000000: | ||
956 | case 2500000: | ||
957 | case 2000000: | ||
963 | case 1500000: | 958 | case 1500000: |
964 | mul = 0x1770; | ||
965 | break; | ||
966 | case 1000000: | 959 | case 1000000: |
967 | mul = 0xFA0; | ||
968 | break; | ||
969 | case 500000: | 960 | case 500000: |
970 | mul = 0x7D0; | 961 | /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */ |
962 | mul = baud / 500000 * 0x9C4; | ||
971 | break; | 963 | break; |
972 | default: | 964 | default: |
973 | /* Use uart_get_divisor to get quot for other baud rates */ | 965 | /* Use uart_get_divisor to get quot for other baud rates */ |