Skip to contentSkip to conversation

USB:serial:pl2303:Add new PID to support PL2303HXN (TYPE_HXN)

DISCUSSION Johan Hovold 1 participant 1 message Apr 17, 2019 USB

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines · Charles Yeh

Hello Sir,

Please download the PL2303_Linux_0419.zip from
https://app.box.com/s/uh9kldrdldjnmjffku8gkdvvaq5496tk

Quoted 5 lines
Quoted 4 lines

After the actual test (I have tested the old PL2303H chip on Linux), when I plug in the PL2303H (TYPE_01), the Linux code will execute the code:
if (spriv->quirks & PL2303_QUIRK_LEGACY) itinerary code.
So I confirm This "PL2303_QUIRK_LEGACY" of code refers to PL2303H(TYPE_01)

Quoted 7 lines
Quoted 3 lines

Correct, but my question was about bit 0x20 for TYPE_01 devices; why isn't it being as set as for TYPE_HX?

TYPE_01 / TYPE_HX / TYPE_HXN are different hardware design. Please refer to PL2303_Linux_0419\PL2303_TYPE_01_UART_Flow.jpg & PL2303_TYPE_HX_UART_Flow.jpg

Thanks, that will be very helpful.

Quoted 17 lines
Quoted 9 lines

Well, without documentation it is hard to give advice. But the information you provided above, indicates that you should not be overwriting these registers completely for HXN either when updating the flow-control settings. Only the bits 2..4 (and possibly 0..1) should be written.

Take a look at the patches I merged for doing this on the older devices. You should be able to use the same helper when updating these registers.

Please refer to PL2303_Linux_0419\
PL2303_TYPE_01_UART_Flow.jpg &
PL2303_TYPE_HX_UART_Flow.jpg &
PL2303G_TYPE_HXN_UART_Flow.jpg

Quoted 2 lines

If you have other questions (whether it's my newly written patch code or the code that originally existed), please try to raise it... Thanks!

I will, thanks. I'm looking at how best to abstract this now.

Quoted 5 lines

The code that originally existed; not what I wrote.. But I have rewritten many times to a lot of customers... probably can also guess the usage of the original code.

Quoted 7 lines

I just used
"git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
to get the latest Linux kernel.

The code I see in the pl2303_set_termios function is still pl2303_vendor_write(serial,0x0,0x41), Not pl2303_update_reg(serial,0,PL2303_FLOWCTRL_MASK,0x40);

Yes, you need to base it on my usb-next branch (or linux-next):

git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git

Quoted 5 lines

Can I write a new patch?
"git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git"
But I don't want to rewrite the original code.
For example "pl2303_vendor_write(serial,0x0,0x41)"
Because that's the old code.. Not that I added the patch code this time.

Got it, but please take a look my usb-next branch.

I'll try to clean up the current driver some more based on your feedback. I'll get back to you as soon as have something concrete and we'll get the HXN support in place.

Meanwhile here are few questions:

1. Can bcdUSB be used to detect the HXN devices?

2. Does the old (type 01 and hx) devices require the register address

    to be ORed with 0x80 when reading?

3. And the HXN does not need that ORing with 0x80 it seems?

4. How do you use the chip-reset register (0x7) on HXN; do you write

    0x03 if you only want to reset both data pipes?

And please try to respond inline when replying, no need to keep second copy at the end of your mails.

Thanks,
Johan