Skip to contentSkip to conversation

USB:Serial:pl2303:Add new Pull-UP Mode to support PL2303HXD(TYPE_HX)

DISCUSSION Johan Hovold 1 participant 1 message Jan 16, 2019 USB

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

The Pull-UP mode only support PL2303HXD,it needs to use addition schematic design.

I need a better explain of why this is needed here.

Your are also enabling this for all current devices, which seems to just fine without this.

Quoted 21 lines
---
 drivers/usb/serial/pl2303.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/serial/pl2303.c +3 -0
index 98e7a5df0f6d..72544e5c928d 100644
@@ -144,6 +144,9 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define UART_OVERRUN_ERROR		0x40
 #define UART_CTS			0x80
 
+#define TYPE_HX_PULLUP_MODE_DATA	0x08
+#define TYPE_HX_PULLUP_MODE_REG		0x09
+
 static void pl2303_set_break(struct usb_serial_port *port, bool enable);
 
 enum pl2303_type {
@@ -687,6 +690,15 @@ static void pl2303_set_termios(struct tty_struct *tty,
 		pl2303_vendor_write(serial, 0x0, 0x0);

drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tty_struct *tty, · line 700

Quoted 10 lines
drivers/usb/serial/pl2303.c +8 -0
 	}
 
+	pl2303_vendor_read(serial, 0x8484, buf);
+	pl2303_vendor_write(serial, 0x0404, TYPE_HX_PULLUP_MODE_REG);
+	pl2303_vendor_read(serial, 0x8484, buf);
+	pl2303_vendor_read(serial, 0x8383, buf);
+	if (*buf == TYPE_HX_PULLUP_MODE_DATA) {
+		pl2303_vendor_write(serial, 0x0, 0x31);
+		pl2303_vendor_write(serial, 0x1, 0x01);
+	}

There are more magic constants in the above, which needs a define.

drivers/usb/serial/pl2303.c static void pl2303_set_termios(struct tty_struct *tty, · line 703

Quoted 3 lines
drivers/usb/serial/pl2303.c +1 -0
+
 	kfree(buf);
 }

Thanks,
Johan