All of lore.kernel.org
 help / color / mirror / Atom feed
* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2019-01-03  8:46 Johan Hovold
  0 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2019-01-03  8:46 UTC (permalink / raw)
  To: Charles Yeh
  Cc: Rong Chen, kbuild test robot, kbuild-all, gregkh, Johan Hovold,
	linux-usb

On Wed, Jan 02, 2019 at 10:52:46AM +0800, Charles Yeh wrote:
> Hi Rong Chen,
>        Thank you for your expained.
> 
> Hi Johan & Greg,
>       Is this patch already OK?

I haven't had time to review your v2 yet due to holidays and merge
window. Will let you know.

Johan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2019-01-02  2:52 Charles Yeh
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Yeh @ 2019-01-02  2:52 UTC (permalink / raw)
  To: Rong Chen; +Cc: kbuild test robot, kbuild-all, gregkh, Johan Hovold, linux-usb

Hi Rong Chen,
       Thank you for your expained.

Hi Johan & Greg,
      Is this patch already OK?

Charles.

Rong Chen <rong.a.chen@intel.com> 於 2019年1月2日 週三 上午9:45寫道:
>
>
>
> On 01/02/2019 09:04 AM, Charles Yeh wrote:
> > Hi lkp,
> >        Do you have try  new patch file for bellowing issue?
> > "&gt;&gt; drivers/usb/serial/pl2303.c:352:36: warning: restricted
> > __le16 degrades to integer"
> >
> Hi Charles,
>
> I didn't see the new patch. I think robot could test it automatically if
> there's a v2 patch in mail list,
> and robot could send the report to you if found any warning or error.
>
> Best Regards,
> Rong Chen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2019-01-02  1:45 kernel test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2019-01-02  1:45 UTC (permalink / raw)
  To: Charles Yeh, kbuild test robot
  Cc: kbuild-all, gregkh, Johan Hovold, linux-usb

On 01/02/2019 09:04 AM, Charles Yeh wrote:
> Hi lkp,
>        Do you have try  new patch file for bellowing issue?
> "&gt;&gt; drivers/usb/serial/pl2303.c:352:36: warning: restricted
> __le16 degrades to integer"
>
Hi Charles,

I didn't see the new patch. I think robot could test it automatically if 
there's a v2 patch in mail list,
and robot could send the report to you if found any warning or error.

Best Regards,
Rong Chen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2019-01-02  1:04 Charles Yeh
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Yeh @ 2019-01-02  1:04 UTC (permalink / raw)
  To: kbuild test robot; +Cc: kbuild-all, gregkh, Johan Hovold, linux-usb

Hi lkp,
      Do you have try  new patch file for bellowing issue?
"&gt;&gt; drivers/usb/serial/pl2303.c:352:36: warning: restricted
__le16 degrades to integer"

Charles

kbuild test robot <lkp@intel.com> 於 2018年12月25日 週二 下午11:39寫道:
>
> Hi Charles,
>
> Thank you for the patch! Perhaps something to improve:
>
> [auto build test WARNING on usb-serial/usb-next]
> [also build test WARNING on v4.20 next-20181224]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Charles-Yeh/Add-Prolific-new-chip-PL2303TB-PL2303N-G/20181225-220256
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git usb-next
> config: x86_64-allmodconfig (attached as .config)
> compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64
>
> All warnings (new ones prefixed by >>):
>
>    include/linux/slab.h:332:43: warning: dubious: x & !y
>    include/linux/slab.h:332:43: warning: dubious: x & !y
> >> drivers/usb/serial/pl2303.c:352:36: warning: restricted __le16 degrades to integer
>    include/linux/slab.h:332:43: warning: dubious: x & !y
>    include/linux/slab.h:332:43: warning: dubious: x & !y
>
> vim +352 drivers/usb/serial/pl2303.c
>
>    324
>    325  static int pl2303_startup(struct usb_serial *serial)
>    326  {
>    327          struct pl2303_serial_private *spriv;
>    328          enum pl2303_type type = TYPE_01;
>    329          unsigned char *buf;
>    330          int res;
>    331
>    332          spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
>    333          if (!spriv)
>    334                  return -ENOMEM;
>    335
>    336          buf = kmalloc(1, GFP_KERNEL);
>    337          if (!buf) {
>    338                  kfree(spriv);
>    339                  return -ENOMEM;
>    340          }
>    341
>    342          if (serial->dev->descriptor.bDeviceClass == 0x02)
>    343                  type = TYPE_01;         /* type 0 */
>    344          else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)
>    345                  type = TYPE_HX;
>    346          else if (serial->dev->descriptor.bDeviceClass == 0x00)
>    347                  type = TYPE_01;         /* type 1 */
>    348          else if (serial->dev->descriptor.bDeviceClass == 0xFF)
>    349                  type = TYPE_01;         /* type 1 */
>    350          dev_dbg(&serial->interface->dev, "device type: %d\n", type);
>    351
>  > 352          if (serial->dev->descriptor.bcdUSB == 0x0200) {
>    353                  res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
>    354                          VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE,
>    355                          TYPE_HX_READ_OTP_STATUS_REGISTER, 0, buf, 1, 100);
>    356                  if (res != 1)
>    357                          type = TYPE_HXN;
>    358          }
>    359
>    360          spriv->type = &pl2303_type_data[type];
>    361          spriv->quirks = (unsigned long)usb_get_serial_data(serial);
>    362          spriv->quirks |= spriv->type->quirks;
>    363
>    364          usb_set_serial_data(serial, spriv);
>    365
>    366          if (type != TYPE_HXN) {
>    367                  pl2303_vendor_read(serial, 0x8484, buf);
>    368                  pl2303_vendor_write(serial, 0x0404, 0);
>    369                  pl2303_vendor_read(serial, 0x8484, buf);
>    370                  pl2303_vendor_read(serial, 0x8383, buf);
>    371                  pl2303_vendor_read(serial, 0x8484, buf);
>    372                  pl2303_vendor_write(serial, 0x0404, 1);
>    373                  pl2303_vendor_read(serial, 0x8484, buf);
>    374                  pl2303_vendor_read(serial, 0x8383, buf);
>    375                  pl2303_vendor_write(serial, 0, 1);
>    376                  pl2303_vendor_write(serial, 1, 0);
>    377                  if (spriv->quirks & PL2303_QUIRK_LEGACY)
>    378                          pl2303_vendor_write(serial, 2, 0x24);
>    379                  else
>    380                          pl2303_vendor_write(serial, 2, 0x44);
>    381          }
>    382
>    383          kfree(buf);
>    384
>    385          return 0;
>    386  }
>    387
>
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2018-12-25 15:38 kbuild test robot
  0 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2018-12-25 15:38 UTC (permalink / raw)
  To: Charles Yeh; +Cc: kbuild-all, gregkh, johan, linux-usb

Hi Charles,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on usb-serial/usb-next]
[also build test WARNING on v4.20 next-20181224]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Charles-Yeh/Add-Prolific-new-chip-PL2303TB-PL2303N-G/20181225-220256
base:   https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git usb-next
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y
>> drivers/usb/serial/pl2303.c:352:36: warning: restricted __le16 degrades to integer
   include/linux/slab.h:332:43: warning: dubious: x & !y
   include/linux/slab.h:332:43: warning: dubious: x & !y

vim +352 drivers/usb/serial/pl2303.c

   324	
   325	static int pl2303_startup(struct usb_serial *serial)
   326	{
   327		struct pl2303_serial_private *spriv;
   328		enum pl2303_type type = TYPE_01;
   329		unsigned char *buf;
   330		int res;
   331	
   332		spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
   333		if (!spriv)
   334			return -ENOMEM;
   335	
   336		buf = kmalloc(1, GFP_KERNEL);
   337		if (!buf) {
   338			kfree(spriv);
   339			return -ENOMEM;
   340		}
   341	
   342		if (serial->dev->descriptor.bDeviceClass == 0x02)
   343			type = TYPE_01;		/* type 0 */
   344		else if (serial->dev->descriptor.bMaxPacketSize0 == 0x40)
   345			type = TYPE_HX;
   346		else if (serial->dev->descriptor.bDeviceClass == 0x00)
   347			type = TYPE_01;		/* type 1 */
   348		else if (serial->dev->descriptor.bDeviceClass == 0xFF)
   349			type = TYPE_01;		/* type 1 */
   350		dev_dbg(&serial->interface->dev, "device type: %d\n", type);
   351	
 > 352		if (serial->dev->descriptor.bcdUSB == 0x0200) {
   353			res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
   354				VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE,
   355				TYPE_HX_READ_OTP_STATUS_REGISTER, 0, buf, 1, 100);
   356			if (res != 1)
   357				type = TYPE_HXN;
   358		}
   359	
   360		spriv->type = &pl2303_type_data[type];
   361		spriv->quirks = (unsigned long)usb_get_serial_data(serial);
   362		spriv->quirks |= spriv->type->quirks;
   363	
   364		usb_set_serial_data(serial, spriv);
   365	
   366		if (type != TYPE_HXN) {
   367			pl2303_vendor_read(serial, 0x8484, buf);
   368			pl2303_vendor_write(serial, 0x0404, 0);
   369			pl2303_vendor_read(serial, 0x8484, buf);
   370			pl2303_vendor_read(serial, 0x8383, buf);
   371			pl2303_vendor_read(serial, 0x8484, buf);
   372			pl2303_vendor_write(serial, 0x0404, 1);
   373			pl2303_vendor_read(serial, 0x8484, buf);
   374			pl2303_vendor_read(serial, 0x8383, buf);
   375			pl2303_vendor_write(serial, 0, 1);
   376			pl2303_vendor_write(serial, 1, 0);
   377			if (spriv->quirks & PL2303_QUIRK_LEGACY)
   378				pl2303_vendor_write(serial, 2, 0x24);
   379			else
   380				pl2303_vendor_write(serial, 2, 0x44);
   381		}
   382	
   383		kfree(buf);
   384	
   385		return 0;
   386	}
   387
---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Add Prolific new chip: PL2303TB & PL2303N(G)
@ 2018-12-25 14:00 Charles Yeh
  0 siblings, 0 replies; 6+ messages in thread
From: Charles Yeh @ 2018-12-25 14:00 UTC (permalink / raw)
  To: gregkh; +Cc: johan, linux-usb, Charles Yeh

Add new PID to support PL2303TB (TYPE_HX)
Add new PID to support PL2303(N)GC/GB/GS/GT/GL/GE (TYPE_HXN)
Add new flow control to support PL2303(N)GC/GB/GS/GT/GL/GE (TYPE_HXN)
Add new Down/Up Stream reset to support PL2303(N)GC/GB/GS/GT/GL/GE (TYPE_HXN)
Add new Pull-Up Mode to support PL2303HXD (TYPE_HX)

Signed-off-by: Charles Yeh <charlesyeh522@gmail.com>
---
 drivers/usb/serial/pl2303.c | 116 +++++++++++++++++++++++++++++-------
 drivers/usb/serial/pl2303.h |  11 ++++
 2 files changed, 106 insertions(+), 21 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index a4e0d13fc121..dde112f06601 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -46,6 +46,13 @@ static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_HCR331) },
 	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_MOTOROLA) },
 	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_ZTEK) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID_TB) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GC) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GB) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GT) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GL) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GE) },
+	{ USB_DEVICE(PL2303_VENDOR_ID, PL2303G_PRODUCT_ID_GS) },
 	{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID) },
 	{ USB_DEVICE(IODATA_VENDOR_ID, IODATA_PRODUCT_ID_RSAQ5) },
 	{ USB_DEVICE(ATEN_VENDOR_ID, ATEN_PRODUCT_ID),
@@ -123,9 +130,11 @@ MODULE_DEVICE_TABLE(usb, id_table);
 
 #define VENDOR_WRITE_REQUEST_TYPE	0x40
 #define VENDOR_WRITE_REQUEST		0x01
+#define VENDOR_WRITE_NREQUEST		0x80
 
 #define VENDOR_READ_REQUEST_TYPE	0xc0
 #define VENDOR_READ_REQUEST		0x01
+#define VENDOR_READ_NREQUEST		0x81
 
 #define UART_STATE_INDEX		8
 #define UART_STATE_MSR_MASK		0x8b
@@ -139,11 +148,21 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define UART_OVERRUN_ERROR		0x40
 #define UART_CTS			0x80
 
+#define TYPE_HX_READ_OTP_STATUS_REGISTER	0x8484
+#define TYPE_HX_EXTERNAL_PULLUP_MODE	0x08
+#define TYPE_HX_PULLUP_MODE_REG		0x09
+#define TYPE_HXN_UART_FLOWCONTROL	0x0A
+#define TYPE_HXN_HARDWAREFLOW		0xFA
+#define TYPE_HXN_SOFTWAREFLOW		0xEE
+#define TYPE_HXN_NOFLOW			0xFF
+#define TYPE_HXN_RESET_DOWN_UPSTREAM	0x07
+
 static void pl2303_set_break(struct usb_serial_port *port, bool enable);
 
 enum pl2303_type {
 	TYPE_01,	/* Type 0 and 1 (difference unknown) */
 	TYPE_HX,	/* HX version of the pl2303 chip */
+	TYPE_HXN,	/* HXN version of the pl2303 chip */
 	TYPE_COUNT
 };
 
@@ -173,16 +192,26 @@ static const struct pl2303_type_data pl2303_type_data[TYPE_COUNT] = {
 	[TYPE_HX] = {
 		.max_baud_rate =	12000000,
 	},
+	[TYPE_HXN] = {
+		.max_baud_rate =	12000000,
+	},
 };
 
 static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
 							unsigned char buf[1])
 {
 	struct device *dev = &serial->interface->dev;
+	struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
 	int res;
+	u8 request;
+
+	if (spriv->type == &pl2303_type_data[TYPE_HXN])
+		request = VENDOR_READ_NREQUEST;
+	else
+		request = VENDOR_READ_REQUEST;
 
 	res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
-			VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE,
+			request, VENDOR_READ_REQUEST_TYPE,
 			value, 0, buf, 1, 100);
 	if (res != 1) {
 		dev_err(dev, "%s - failed to read [%04x]: %d\n", __func__,
@@ -201,12 +230,19 @@ static int pl2303_vendor_read(struct usb_serial *serial, u16 value,
 static int pl2303_vendor_write(struct usb_serial *serial, u16 value, u16 index)
 {
 	struct device *dev = &serial->interface->dev;
+	struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
 	int res;
+	u8 request;
 
 	dev_dbg(dev, "%s - [%04x] = %02x\n", __func__, value, index);
 
+	if (spriv->type == &pl2303_type_data[TYPE_HXN])
+		request = VENDOR_WRITE_NREQUEST;
+	else
+		request = VENDOR_WRITE_REQUEST;
+
 	res = usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
-			VENDOR_WRITE_REQUEST, VENDOR_WRITE_REQUEST_TYPE,
+			request, VENDOR_WRITE_REQUEST_TYPE,
 			value, index, NULL, 0, 100);
 	if (res) {
 		dev_err(dev, "%s - failed to write [%04x]: %d\n", __func__,
@@ -286,6 +322,7 @@ static int pl2303_startup(struct usb_serial *serial)
 	struct pl2303_serial_private *spriv;
 	enum pl2303_type type = TYPE_01;
 	unsigned char *buf;
+	int res;
 
 	spriv = kzalloc(sizeof(*spriv), GFP_KERNEL);
 	if (!spriv)
@@ -307,26 +344,36 @@ static int pl2303_startup(struct usb_serial *serial)
 		type = TYPE_01;		/* type 1 */
 	dev_dbg(&serial->interface->dev, "device type: %d\n", type);
 
+	if (serial->dev->descriptor.bcdUSB == 0x0200) {
+		res = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0),
+			VENDOR_READ_REQUEST, VENDOR_READ_REQUEST_TYPE,
+			TYPE_HX_READ_OTP_STATUS_REGISTER, 0, buf, 1, 100);
+		if (res != 1)
+			type = TYPE_HXN;
+	}
+
 	spriv->type = &pl2303_type_data[type];
 	spriv->quirks = (unsigned long)usb_get_serial_data(serial);
 	spriv->quirks |= spriv->type->quirks;
 
 	usb_set_serial_data(serial, spriv);
 
-	pl2303_vendor_read(serial, 0x8484, buf);
-	pl2303_vendor_write(serial, 0x0404, 0);
-	pl2303_vendor_read(serial, 0x8484, buf);
-	pl2303_vendor_read(serial, 0x8383, buf);
-	pl2303_vendor_read(serial, 0x8484, buf);
-	pl2303_vendor_write(serial, 0x0404, 1);
-	pl2303_vendor_read(serial, 0x8484, buf);
-	pl2303_vendor_read(serial, 0x8383, buf);
-	pl2303_vendor_write(serial, 0, 1);
-	pl2303_vendor_write(serial, 1, 0);
-	if (spriv->quirks & PL2303_QUIRK_LEGACY)
-		pl2303_vendor_write(serial, 2, 0x24);
-	else
-		pl2303_vendor_write(serial, 2, 0x44);
+	if (type != TYPE_HXN) {
+		pl2303_vendor_read(serial, 0x8484, buf);
+		pl2303_vendor_write(serial, 0x0404, 0);
+		pl2303_vendor_read(serial, 0x8484, buf);
+		pl2303_vendor_read(serial, 0x8383, buf);
+		pl2303_vendor_read(serial, 0x8484, buf);
+		pl2303_vendor_write(serial, 0x0404, 1);
+		pl2303_vendor_read(serial, 0x8484, buf);
+		pl2303_vendor_read(serial, 0x8383, buf);
+		pl2303_vendor_write(serial, 0, 1);
+		pl2303_vendor_write(serial, 1, 0);
+		if (spriv->quirks & PL2303_QUIRK_LEGACY)
+			pl2303_vendor_write(serial, 2, 0x24);
+		else
+			pl2303_vendor_write(serial, 2, 0x44);
+	}
 
 	kfree(buf);
 
@@ -671,15 +718,37 @@ static void pl2303_set_termios(struct tty_struct *tty,
 	}
 
 	if (C_CRTSCTS(tty)) {
-		if (spriv->quirks & PL2303_QUIRK_LEGACY)
+		if (spriv->type == &pl2303_type_data[TYPE_01])
 			pl2303_vendor_write(serial, 0x0, 0x41);
+		else if (spriv->type == &pl2303_type_data[TYPE_HXN])
+			pl2303_vendor_write(serial, TYPE_HXN_UART_FLOWCONTROL,
+						 TYPE_HXN_HARDWAREFLOW);
 		else
 			pl2303_vendor_write(serial, 0x0, 0x61);
 	} else if (I_IXON(tty) && !I_IXANY(tty) && START_CHAR(tty) == 0x11 &&
 			STOP_CHAR(tty) == 0x13) {
-		pl2303_vendor_write(serial, 0x0, 0xc0);
+		if (spriv->type == &pl2303_type_data[TYPE_HXN])
+			pl2303_vendor_write(serial, TYPE_HXN_UART_FLOWCONTROL,
+						 TYPE_HXN_SOFTWAREFLOW);
+		else
+			pl2303_vendor_write(serial, 0x0, 0xc0);
 	} else {
-		pl2303_vendor_write(serial, 0x0, 0x0);
+		if (spriv->type == &pl2303_type_data[TYPE_HXN])
+			pl2303_vendor_write(serial, TYPE_HXN_UART_FLOWCONTROL,
+						 TYPE_HXN_NOFLOW);
+		else
+			pl2303_vendor_write(serial, 0x0, 0x0);
+	}
+
+	if (spriv->type == &pl2303_type_data[TYPE_HX]) {
+		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 ((u16)*buf & TYPE_HX_EXTERNAL_PULLUP_MODE) {
+			pl2303_vendor_write(serial, 0x0, 0x31);
+			pl2303_vendor_write(serial, 0x1, 0x01);
+		}
 	}
 
 	kfree(buf);
@@ -720,8 +789,13 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
 		usb_clear_halt(serial->dev, port->read_urb->pipe);
 	} else {
 		/* reset upstream data pipes */
-		pl2303_vendor_write(serial, 8, 0);
-		pl2303_vendor_write(serial, 9, 0);
+		if (spriv->type == &pl2303_type_data[TYPE_HXN])
+			pl2303_vendor_write(serial,
+					TYPE_HXN_RESET_DOWN_UPSTREAM, 0);
+		else {
+			pl2303_vendor_write(serial, 8, 0);
+			pl2303_vendor_write(serial, 9, 0);
+		}
 	}
 
 	/* Setup termios */
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h
index 26965cc23c17..f7c500622f6b 100644
--- a/drivers/usb/serial/pl2303.h
+++ b/drivers/usb/serial/pl2303.h
@@ -20,6 +20,17 @@
 #define PL2303_PRODUCT_ID_MOTOROLA	0x0307
 #define PL2303_PRODUCT_ID_ZTEK		0xe1f1
 
+/* PL2303TB , TYPE_HX */
+#define PL2303_PRODUCT_ID_TB	0x2304
+
+/* PL2303HXN , TYPE_HXN */
+#define PL2303G_PRODUCT_ID_GC	0x23A3
+#define PL2303G_PRODUCT_ID_GB	0x23B3
+#define PL2303G_PRODUCT_ID_GT	0x23C3
+#define PL2303G_PRODUCT_ID_GL	0x23D3
+#define PL2303G_PRODUCT_ID_GE	0x23E3
+#define PL2303G_PRODUCT_ID_GS	0x23F3
+
 #define ATEN_VENDOR_ID		0x0557
 #define ATEN_VENDOR_ID2		0x0547
 #define ATEN_PRODUCT_ID		0x2008

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-03  8:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-03  8:46 Add Prolific new chip: PL2303TB & PL2303N(G) Johan Hovold
  -- strict thread matches above, loose matches on Subject: below --
2019-01-02  2:52 Charles Yeh
2019-01-02  1:45 kernel test robot
2019-01-02  1:04 Charles Yeh
2018-12-25 15:38 kbuild test robot
2018-12-25 14:00 Charles Yeh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.