Skip to content

Commit b5c16c6

Browse files
Frank Schäfergregkh
authored andcommitted
usb: pl2303: increase the allowed baud rate range for the divisor based encoding method
Reinhard Max has done some tests with a PL2303HX (rev A) and a logic analyzer and it seems, that although the PL2303HX is specified for baud rates from 75 to 6M baud, the full divisor range can be used with the divisor based baud rate encoding method. This corresponds to baud rates from 46 to 24M baud. Baud rates down to 46 baud (max. divisor) have been confirmed to work even under heavy/permanent load, so remove the lower limit. Baud rates up to 24M baud should really be tested carefully in "real life" scenarios before removing the upper limit completely. Anyway, the Windows driver allows maximum baud rates of 110% of the specified limit, so for now, increase the upper limit to this value. Signed-off-by: Frank Schäfer <[email protected]> Signed-off-by: Reinhard Max <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e917ba0 commit b5c16c6

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

drivers/usb/serial/pl2303.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,20 @@ static int pl2303_baudrate_encode_divisor(int baud, enum pl2303_type type,
324324
*/
325325
unsigned int A, B;
326326

327-
/* Respect the specified baud rate limits */
328-
baud = max_t(int, baud, 75);
327+
/*
328+
* NOTE: The Windows driver allows maximum baud rates of 110% of the
329+
* specified maximium value.
330+
* Quick tests with early (2004) HX (rev. A) chips suggest, that even
331+
* higher baud rates (up to the maximum of 24M baud !) are working fine,
332+
* but that should really be tested carefully in "real life" scenarios
333+
* before removing the upper limit completely.
334+
* Baud rates smaller than the specified 75 baud are definitely working
335+
* fine.
336+
*/
329337
if (type == HX)
330-
baud = min_t(int, baud, 6000000);
338+
baud = min_t(int, baud, 6000000 * 1.1);
331339
else
332-
baud = min_t(int, baud, 1228800);
340+
baud = min_t(int, baud, 1228800 * 1.1);
333341
/* Determine factors A and B */
334342
A = 0;
335343
B = 12000000 * 32 / baud; /* 12MHz */

0 commit comments

Comments
 (0)