diff mbox series

USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN)

Message ID 20220617133514.357-1-charlesyeh522@gmail.com
State New
Headers show
Series USB: serial: pl2303: Modify the detection method of PL2303HXN (TYPE_HXN) | expand

Commit Message

Charles Yeh June 17, 2022, 1:35 p.m. UTC
The setting value of bcdUSB & bcdDevice of PL2303TA is the same as the
setting value of bcdUSB & bcdDevice of a certain chip of PL2303HXN

The setting value of bcdUSB & bcdDevice of PL2303TB is the same as the
setting value of bcdUSB & bcdDevice of a certain chip of PL2303HXN

The PL2303HXN series currently has several chips on sale, and several chips
are about to be sold.
The PL2303HXN cannot use bcdDevice to determine the type one by one.

Signed-off-by: Charles Yeh <charlesyeh522@gmail.com>
---
 drivers/usb/serial/pl2303.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

Comments

Charles Yeh June 21, 2022, 4:41 a.m. UTC | #1
> Ok, but the above could be handled with two entries or if needed we can
> just check the major number (i.e. the MSB, 0x03)?

No , MSB:0x03 represents the HXN_GT (PL2303GT) version,
but the current HXN version has multiple IC types,
for example, the bcdDevice_MSB of HXN_GS uses 0x60.

HXN_GS: PL2303GS_R4 : idProduct : 0x23F3, bcdDevice: 0x0600
HXN_GS: PL2303GS_R5 : idProduct : 0x23F3, bcdDevice: 0x0605
HXN_GS: PL2303GS_R5+ : idProduct : 0x23A3, bcdDevice: 0x0605

The difference between R4 and R5 is that bcdDevice is a different set value.
The difference between R5 and R5+ is that idProduct is a different set value.
But PL2303GS_R4 / PL2303GS_R5 / PL2303GS_R5+ all represent HXN_GS chip.


> So far I've gathered that
>
>         0x100   GC
>         0x105   GC
>         0x300   GT / TA
>         0x305   GT
>         0x405   GL
>         0x500   GE / TB
>         0x605   GS
>
> So it look like we could use the major version number.
>
> Anything more we need to add to the above list?

Currently there are HXN ICs on the market:
PL2303GC : 0x0100 / 0x0105
PL2303GT : 0x0300 / 0x0305
PL2303GL : 0x0400 / 0x0405
PL2303GE : 0x0500 / 0x0505
PL2303GS : 0x0600 / 0x0605
PL2303GR : 0x0700 / 0x0705

I think it is not very good to add the above bcdDevice to the list.

Because the company's PM/Sales are still planning some HXN ICs
(these ICs will be sold according to market behavior in the future,
and there will be different bcdDevices: 0x0800 / 0x0805/ 0x0900 / 0x0905.....).
so in the future Time, it will become to add different bcdDevice values
from time to time, which will become the patch file is always updated.


In the current newest Linux driver program design,
using bcdUSB (0x0100 / 0x0200) as a judgment.
I hope that when bcdUSB==0x0200 is encountered,
I only need to judge whether it is PL2303TA/PL2303TB chip,
and the rest is to use HX_Status to judge whether it is HXN_TYPE chip.

There is no need to use bcdDevice one by one to determine which HXN_TYPE
(PL2303GC, PL2303GT....)

At present, if our customers need special functions or
chip version control in HXN_TYPE IC ,
we will provide special customized files or patch files

General customers only need to identify as HXN_TYPE on Linux OS.

Charles.
Charles Yeh June 21, 2022, 8:17 a.m. UTC | #2
> I'll prepare a patch that adds support for the missing HXN types.

OK. Thanks for your kindly help.

Charles.
diff mbox series

Patch

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 3506c47e1eef..95e5fdf3b80a 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -436,22 +436,23 @@  static int pl2303_detect_type(struct usb_serial *serial)
 		break;
 	case 0x200:
 		switch (bcdDevice) {
-		case 0x100:
-		case 0x105:
-		case 0x305:
-		case 0x405:
-		case 0x605:
+		case 0x300:
+			if (!pl2303_supports_hx_status(serial))
+				return TYPE_HXN;
+			else
+				return TYPE_TA;
+		case 0x500:
+			if (!pl2303_supports_hx_status(serial))
+				return TYPE_HXN;
+			else
+				return TYPE_TB;
+		default:
 			/*
 			 * Assume it's an HXN-type if the device doesn't
 			 * support the old read request value.
 			 */
 			if (!pl2303_supports_hx_status(serial))
 				return TYPE_HXN;
-			break;
-		case 0x300:
-			return TYPE_TA;
-		case 0x500:
-			return TYPE_TB;
 		}
 		break;
 	}