diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-01 12:12:52 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-01 12:12:52 -0400 |
commit | 09169197c9f5e3b42f0c83c6d7071b3e9c94153e (patch) | |
tree | 4beb4f119a8a2d8a99330929197893c7fd2bd912 | |
parent | 959f58544b7f20c92d5eb43d1232c96c15c01bfb (diff) |
Revert "USB: pl2303: distinguish between original and cloned HX chips"
This reverts commit 7d26a78f62ff4fb08bc5ba740a8af4aa7ac67da4.
Revert all of the pl2303 changes that went into 3.12-rc1 and -rc2 as
they cause regressions on some versions of the chip. This will all be
revisited for later kernel versions when we can figure out how to handle
this in a way that does not break working devices.
Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Frank Schäfer <fschaefer.oss@googlemail.com>
Acked-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/serial/pl2303.c | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index bedf8e47713b..e7a84f0f5179 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -139,7 +139,6 @@ enum pl2303_type { | |||
139 | HX_TA, /* HX(A) / X(A) / TA version */ /* TODO: improve */ | 139 | HX_TA, /* HX(A) / X(A) / TA version */ /* TODO: improve */ |
140 | HXD_EA_RA_SA, /* HXD / EA / RA / SA version */ /* TODO: improve */ | 140 | HXD_EA_RA_SA, /* HXD / EA / RA / SA version */ /* TODO: improve */ |
141 | TB, /* TB version */ | 141 | TB, /* TB version */ |
142 | HX_CLONE, /* Cheap and less functional clone of the HX chip */ | ||
143 | }; | 142 | }; |
144 | /* | 143 | /* |
145 | * NOTE: don't know the difference between type 0 and type 1, | 144 | * NOTE: don't know the difference between type 0 and type 1, |
@@ -207,23 +206,8 @@ static int pl2303_startup(struct usb_serial *serial) | |||
207 | * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB | 206 | * the device descriptors of the X/HX, HXD, EA, RA, SA, TA, TB |
208 | */ | 207 | */ |
209 | if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) { | 208 | if (le16_to_cpu(serial->dev->descriptor.bcdDevice) == 0x300) { |
210 | /* Check if the device is a clone */ | 209 | type = HX_TA; |
211 | pl2303_vendor_read(0x9494, 0, serial, buf); | 210 | type_str = "X/HX/TA"; |
212 | /* | ||
213 | * NOTE: Not sure if this read is really needed. | ||
214 | * The HX returns 0x00, the clone 0x02, but the Windows | ||
215 | * driver seems to ignore the value and continues. | ||
216 | */ | ||
217 | pl2303_vendor_write(0x0606, 0xaa, serial); | ||
218 | pl2303_vendor_read(0x8686, 0, serial, buf); | ||
219 | if (buf[0] != 0xaa) { | ||
220 | type = HX_CLONE; | ||
221 | type_str = "X/HX clone (limited functionality)"; | ||
222 | } else { | ||
223 | type = HX_TA; | ||
224 | type_str = "X/HX/TA"; | ||
225 | } | ||
226 | pl2303_vendor_write(0x0606, 0x00, serial); | ||
227 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) | 211 | } else if (le16_to_cpu(serial->dev->descriptor.bcdDevice) |
228 | == 0x400) { | 212 | == 0x400) { |
229 | type = HXD_EA_RA_SA; | 213 | type = HXD_EA_RA_SA; |
@@ -321,9 +305,8 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
321 | { | 305 | { |
322 | /* | 306 | /* |
323 | * NOTE: Only the values defined in baud_sup are supported ! | 307 | * NOTE: Only the values defined in baud_sup are supported ! |
324 | * => if unsupported values are set, the PL2303 uses 9600 baud instead | 308 | * => if unsupported values are set, the PL2303 seems to |
325 | * => HX clones just don't work at unsupported baud rates < 115200 baud, | 309 | * use 9600 baud (at least my PL2303X always does) |
326 | * for baud rates > 115200 they run at 115200 baud | ||
327 | */ | 310 | */ |
328 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, | 311 | const int baud_sup[] = { 75, 150, 300, 600, 1200, 1800, 2400, 3600, |
329 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, | 312 | 4800, 7200, 9600, 14400, 19200, 28800, 38400, |
@@ -333,14 +316,14 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
333 | * NOTE: With the exception of type_0/1 devices, the following | 316 | * NOTE: With the exception of type_0/1 devices, the following |
334 | * additional baud rates are supported (tested with HX rev. 3A only): | 317 | * additional baud rates are supported (tested with HX rev. 3A only): |
335 | * 110*, 56000*, 128000, 134400, 161280, 201600, 256000*, 268800, | 318 | * 110*, 56000*, 128000, 134400, 161280, 201600, 256000*, 268800, |
336 | * 403200, 806400. (*: not HX and HX clones) | 319 | * 403200, 806400. (*: not HX) |
337 | * | 320 | * |
338 | * Maximum values: HXD, TB: 12000000; HX, TA: 6000000; | 321 | * Maximum values: HXD, TB: 12000000; HX, TA: 6000000; |
339 | * type_0+1: 1228800; RA: 921600; HX clones, SA: 115200 | 322 | * type_0+1: 1228800; RA: 921600; SA: 115200 |
340 | * | 323 | * |
341 | * As long as we are not using this encoding method for anything else | 324 | * As long as we are not using this encoding method for anything else |
342 | * than the type_0+1, HX and HX clone chips, there is no point in | 325 | * than the type_0+1 and HX chips, there is no point in complicating |
343 | * complicating the code to support them. | 326 | * the code to support them. |
344 | */ | 327 | */ |
345 | int i; | 328 | int i; |
346 | 329 | ||
@@ -364,8 +347,6 @@ static int pl2303_baudrate_encode_direct(int baud, enum pl2303_type type, | |||
364 | baud = min_t(int, baud, 6000000); | 347 | baud = min_t(int, baud, 6000000); |
365 | else if (type == type_0 || type == type_1) | 348 | else if (type == type_0 || type == type_1) |
366 | baud = min_t(int, baud, 1228800); | 349 | baud = min_t(int, baud, 1228800); |
367 | else if (type == HX_CLONE) | ||
368 | baud = min_t(int, baud, 115200); | ||
369 | /* Direct (standard) baud rate encoding method */ | 350 | /* Direct (standard) baud rate encoding method */ |
370 | put_unaligned_le32(baud, buf); | 351 | put_unaligned_le32(baud, buf); |
371 | 352 | ||
@@ -378,8 +359,7 @@ static int pl2303_baudrate_encode_divisor(int baud, enum pl2303_type type, | |||
378 | /* | 359 | /* |
379 | * Divisor based baud rate encoding method | 360 | * Divisor based baud rate encoding method |
380 | * | 361 | * |
381 | * NOTE: HX clones do NOT support this method. | 362 | * NOTE: it's not clear if the type_0/1 chips support this method |
382 | * It's not clear if the type_0/1 chips support it. | ||
383 | * | 363 | * |
384 | * divisor = 12MHz * 32 / baudrate = 2^A * B | 364 | * divisor = 12MHz * 32 / baudrate = 2^A * B |
385 | * | 365 | * |
@@ -472,7 +452,7 @@ static void pl2303_encode_baudrate(struct tty_struct *tty, | |||
472 | * 1) Direct method: encodes the baud rate value directly | 452 | * 1) Direct method: encodes the baud rate value directly |
473 | * => supported by all chip types | 453 | * => supported by all chip types |
474 | * 2) Divisor based method: encodes a divisor to a base value (12MHz*32) | 454 | * 2) Divisor based method: encodes a divisor to a base value (12MHz*32) |
475 | * => not supported by HX clones (and likely type_0/1 chips) | 455 | * => supported by HX chips (and likely not by type_0/1 chips) |
476 | * | 456 | * |
477 | * NOTE: Although the divisor based baud rate encoding method is much | 457 | * NOTE: Although the divisor based baud rate encoding method is much |
478 | * more flexible, some of the standard baud rate values can not be | 458 | * more flexible, some of the standard baud rate values can not be |
@@ -480,7 +460,7 @@ static void pl2303_encode_baudrate(struct tty_struct *tty, | |||
480 | * the device likely uses the same baud rate generator for both methods | 460 | * the device likely uses the same baud rate generator for both methods |
481 | * so that there is likley no difference. | 461 | * so that there is likley no difference. |
482 | */ | 462 | */ |
483 | if (type == type_0 || type == type_1 || type == HX_CLONE) | 463 | if (type == type_0 || type == type_1) |
484 | baud = pl2303_baudrate_encode_direct(baud, type, buf); | 464 | baud = pl2303_baudrate_encode_direct(baud, type, buf); |
485 | else | 465 | else |
486 | baud = pl2303_baudrate_encode_divisor(baud, type, buf); | 466 | baud = pl2303_baudrate_encode_divisor(baud, type, buf); |
@@ -833,7 +813,6 @@ static void pl2303_break_ctl(struct tty_struct *tty, int break_state) | |||
833 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), | 813 | result = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), |
834 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, | 814 | BREAK_REQUEST, BREAK_REQUEST_TYPE, state, |
835 | 0, NULL, 0, 100); | 815 | 0, NULL, 0, 100); |
836 | /* NOTE: HX clones don't support sending breaks, -EPIPE is returned */ | ||
837 | if (result) | 816 | if (result) |
838 | dev_err(&port->dev, "error sending break = %d\n", result); | 817 | dev_err(&port->dev, "error sending break = %d\n", result); |
839 | } | 818 | } |