On Tue, Jan 15, 2019 at 11:15:36PM +0800, Charles Yeh wrote:
> 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.

> Signed-off-by: Charles Yeh <charlesyeh...@gmail.com>
> ---
>  drivers/usb/serial/pl2303.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
> index 98e7a5df0f6d..72544e5c928d 100644
> --- a/drivers/usb/serial/pl2303.c
> +++ b/drivers/usb/serial/pl2303.c
> @@ -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);
> +     }

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

> +
>       kfree(buf);
>  }

Thanks,
Johan

Reply via email to