Skip to content

Commit 5edb65a

Browse files
committed
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>
1 parent 7aecd7f commit 5edb65a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/usb/serial/cp210x.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,14 +1537,19 @@ static void cp210x_init_max_speed(struct usb_serial *serial)
15371537
max = 1000000;
15381538
break;
15391539
case CP210X_PARTNUM_CP2104:
1540+
use_actual_rate = true;
1541+
max = 2000000;
1542+
break;
15401543
case CP210X_PARTNUM_CP2108:
15411544
max = 2000000;
15421545
break;
15431546
case CP210X_PARTNUM_CP2105:
1544-
if (cp210x_interface_num(serial) == 0)
1547+
if (cp210x_interface_num(serial) == 0) {
1548+
use_actual_rate = true;
15451549
max = 2000000; /* ECI */
1546-
else
1550+
} else {
15471551
max = 921600; /* SCI */
1552+
}
15481553
break;
15491554
case CP210X_PARTNUM_CP2102N_QFN28:
15501555
case CP210X_PARTNUM_CP2102N_QFN24:

0 commit comments

Comments
 (0)