提交 23c6acb9 编写于 作者: J Johan Hovold 提交者: Greg Kroah-Hartman

USB: pl2303: add quirk for legacy devices

Add quirk for legacy devices (type 0 and 1) rather than testing on
device type throughout the driver.
Signed-off-by: NJohan Hovold <jhovold@gmail.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 7f966ac7
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#define PL2303_QUIRK_UART_STATE_IDX0 BIT(0) #define PL2303_QUIRK_UART_STATE_IDX0 BIT(0)
#define PL2303_QUIRK_LEGACY BIT(1)
static const struct usb_device_id id_table[] = { static const struct usb_device_id id_table[] = {
{ USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) }, { USB_DEVICE(PL2303_VENDOR_ID, PL2303_PRODUCT_ID) },
...@@ -224,6 +225,8 @@ static int pl2303_startup(struct usb_serial *serial) ...@@ -224,6 +225,8 @@ static int pl2303_startup(struct usb_serial *serial)
spriv->type = type; spriv->type = type;
spriv->quirks = (unsigned long)usb_get_serial_data(serial); spriv->quirks = (unsigned long)usb_get_serial_data(serial);
if (type == TYPE_01)
spriv->quirks |= PL2303_QUIRK_LEGACY;
usb_set_serial_data(serial, spriv); usb_set_serial_data(serial, spriv);
...@@ -237,7 +240,7 @@ static int pl2303_startup(struct usb_serial *serial) ...@@ -237,7 +240,7 @@ static int pl2303_startup(struct usb_serial *serial)
pl2303_vendor_read(serial, 0x8383, buf); pl2303_vendor_read(serial, 0x8383, buf);
pl2303_vendor_write(serial, 0, 1); pl2303_vendor_write(serial, 0, 1);
pl2303_vendor_write(serial, 1, 0); pl2303_vendor_write(serial, 1, 0);
if (type == TYPE_01) if (spriv->quirks & PL2303_QUIRK_LEGACY)
pl2303_vendor_write(serial, 2, 0x24); pl2303_vendor_write(serial, 2, 0x24);
else else
pl2303_vendor_write(serial, 2, 0x44); pl2303_vendor_write(serial, 2, 0x44);
...@@ -531,7 +534,7 @@ static void pl2303_set_termios(struct tty_struct *tty, ...@@ -531,7 +534,7 @@ static void pl2303_set_termios(struct tty_struct *tty,
} }
if (C_CRTSCTS(tty)) { if (C_CRTSCTS(tty)) {
if (spriv->type == TYPE_01) if (spriv->quirks & PL2303_QUIRK_LEGACY)
pl2303_vendor_write(serial, 0x0, 0x41); pl2303_vendor_write(serial, 0x0, 0x41);
else else
pl2303_vendor_write(serial, 0x0, 0x61); pl2303_vendor_write(serial, 0x0, 0x61);
...@@ -571,7 +574,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -571,7 +574,7 @@ static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
struct pl2303_serial_private *spriv = usb_get_serial_data(serial); struct pl2303_serial_private *spriv = usb_get_serial_data(serial);
int result; int result;
if (spriv->type == TYPE_01) { if (spriv->quirks & PL2303_QUIRK_LEGACY) {
usb_clear_halt(serial->dev, port->write_urb->pipe); usb_clear_halt(serial->dev, port->write_urb->pipe);
usb_clear_halt(serial->dev, port->read_urb->pipe); usb_clear_halt(serial->dev, port->read_urb->pipe);
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册