]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/2.6.36.2/serial-mfd-adjust-the-baud-rate-setting.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / releases / 2.6.36.2 / serial-mfd-adjust-the-baud-rate-setting.patch
1 From a5880a9e5bb40fbae55de60051d69a29091053c3 Mon Sep 17 00:00:00 2001
2 From: Feng Tang <feng.tang@intel.com>
3 Date: Fri, 19 Nov 2010 11:01:48 +0800
4 Subject: serial: mfd: adjust the baud rate setting
5
6 From: Feng Tang <feng.tang@intel.com>
7
8 commit a5880a9e5bb40fbae55de60051d69a29091053c3 upstream.
9
10 Previous baud rate setting code only has been tested with 3.5M/9600/
11 115200/230400/460800 bps, and recently we got a 3M bps device to test,
12 which needs to modify current MUL register setting, and with this
13 patch 2.5M/2M/1.5M/1M/0.5M should also work as they just use a MUL
14 value scale down from 3M's.
15
16 Also got some reference register setting from silicon guys for
17 different baud rates, which tries to keep the pre-scalar register value
18 to 16.
19
20 Signed-off-by: Feng Tang <feng.tang@intel.com>
21 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
22
23 ---
24 drivers/serial/mfd.c | 18 ++++++++----------
25 1 file changed, 8 insertions(+), 10 deletions(-)
26
27 --- a/drivers/serial/mfd.c
28 +++ b/drivers/serial/mfd.c
29 @@ -892,8 +892,7 @@ serial_hsu_set_termios(struct uart_port
30 unsigned char cval, fcr = 0;
31 unsigned long flags;
32 unsigned int baud, quot;
33 - u32 mul = 0x3600;
34 - u32 ps = 0x10;
35 + u32 ps, mul;
36
37 switch (termios->c_cflag & CSIZE) {
38 case CS5:
39 @@ -937,20 +936,19 @@ serial_hsu_set_termios(struct uart_port
40 ps = 0xC;
41 quot = 1;
42 break;
43 - case 2500000:
44 - mul = 0x2710;
45 - ps = 0x10;
46 - quot = 1;
47 - break;
48 case 18432000:
49 mul = 0x2400;
50 ps = 0x10;
51 quot = 1;
52 break;
53 + case 3000000:
54 + case 2500000:
55 + case 2000000:
56 case 1500000:
57 - mul = 0x1D4C;
58 - ps = 0xc;
59 - quot = 1;
60 + case 1000000:
61 + case 500000:
62 + /* mul/ps/quot = 0x9C4/0x10/0x1 will make a 500000 bps */
63 + mul = baud / 500000 * 0x9C4;
64 break;
65 default:
66 ;