Skip to contentSkip to conversation

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

PATCH Charles Yeh 1 participant 1 message Jan 15, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

---
 drivers/usb/serial/pl2303.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/usb/serial/pl2303.c +12 -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);
 	}
 
+	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);
+	}
+
 	kfree(buf);
 }