summaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2018-07-18 14:25:01 +0200
committerJohan Hovold <johan@kernel.org>2018-07-18 21:54:56 +0200
commit5edb65a33710bbf10f38b42e0d497b35ec1ed908 (patch)
tree16374d701da3be28fd451c32a26755f3e7dc5a3d /drivers/usb/serial
parentUSB: serial: cp210x: generalise CP2102N line-speed handling (diff)
downloadlinux-5edb65a33710bbf10f38b42e0d497b35ec1ed908.tar.xz
linux-5edb65a33710bbf10f38b42e0d497b35ec1ed908.zip
USB: serial: cp210x: improve line-speed handling for CP2104 and CP2105
CP2104 and the ECI interface of CP2105 support further baud rates than the ones specified in AN205 table 1, and we can use the same equations as for CP2102N to determine and report back the actual baud rates used. Note that this could eventually be generalised also to CP2108, which uses a different base clock. There appears to be an error in the CP2108 equations which needs to be confirmed on actual hardware first however (specifically, the subtraction of one from the divisor appears to be incorrect as it introduces larger errors). Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r--drivers/usb/serial/cp210x.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 957406aac9bd..4a118eb13590 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -1537,14 +1537,19 @@ static void cp210x_init_max_speed(struct usb_serial *serial)
max = 1000000;
break;
case CP210X_PARTNUM_CP2104:
+ use_actual_rate = true;
+ max = 2000000;
+ break;
case CP210X_PARTNUM_CP2108:
max = 2000000;
break;
case CP210X_PARTNUM_CP2105:
- if (cp210x_interface_num(serial) == 0)
+ if (cp210x_interface_num(serial) == 0) {
+ use_actual_rate = true;
max = 2000000; /* ECI */
- else
+ } else {
max = 921600; /* SCI */
+ }
break;
case CP210X_PARTNUM_CP2102N_QFN28:
case CP210X_PARTNUM_CP2102N_QFN24: