aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/cp210x.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/cp210x.c')
-rw-r--r--drivers/usb/serial/cp210x.c63
1 files changed, 16 insertions, 47 deletions
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index ec9b0449ccf6..8b8c7976b4c0 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -34,7 +34,6 @@
34 * Function Prototypes 34 * Function Prototypes
35 */ 35 */
36static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *); 36static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *);
37static void cp210x_cleanup(struct usb_serial_port *);
38static void cp210x_close(struct usb_serial_port *); 37static void cp210x_close(struct usb_serial_port *);
39static void cp210x_get_termios(struct tty_struct *, 38static void cp210x_get_termios(struct tty_struct *,
40 struct usb_serial_port *port); 39 struct usb_serial_port *port);
@@ -49,7 +48,6 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port, struct file *,
49 unsigned int, unsigned int); 48 unsigned int, unsigned int);
50static void cp210x_break_ctl(struct tty_struct *, int); 49static void cp210x_break_ctl(struct tty_struct *, int);
51static int cp210x_startup(struct usb_serial *); 50static int cp210x_startup(struct usb_serial *);
52static void cp210x_disconnect(struct usb_serial *);
53static void cp210x_dtr_rts(struct usb_serial_port *p, int on); 51static void cp210x_dtr_rts(struct usb_serial_port *p, int on);
54static int cp210x_carrier_raised(struct usb_serial_port *p); 52static int cp210x_carrier_raised(struct usb_serial_port *p);
55 53
@@ -61,6 +59,8 @@ static const struct usb_device_id id_table[] = {
61 { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */ 59 { USB_DEVICE(0x0745, 0x1000) }, /* CipherLab USB CCD Barcode Scanner 1000 */
62 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */ 60 { USB_DEVICE(0x08e6, 0x5501) }, /* Gemalto Prox-PU/CU contactless smartcard reader */
63 { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */ 61 { USB_DEVICE(0x08FD, 0x000A) }, /* Digianswer A/S , ZigBee/802.15.4 MAC Device */
62 { USB_DEVICE(0x0BED, 0x1100) }, /* MEI (TM) Cashflow-SC Bill/Voucher Acceptor */
63 { USB_DEVICE(0x0BED, 0x1101) }, /* MEI series 2000 Combo Acceptor */
64 { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */ 64 { USB_DEVICE(0x0FCF, 0x1003) }, /* Dynastream ANT development board */
65 { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ 65 { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */
66 { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ 66 { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */
@@ -72,9 +72,12 @@ static const struct usb_device_id id_table[] = {
72 { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */ 72 { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */
73 { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ 73 { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */
74 { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ 74 { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */
75 { USB_DEVICE(0x10C4, 0x8044) }, /* Cygnal Debug Adapter */
76 { USB_DEVICE(0x10C4, 0x804E) }, /* Software Bisque Paramount ME build-in converter */
75 { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ 77 { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */
76 { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */ 78 { USB_DEVICE(0x10C4, 0x8054) }, /* Enfora GSM2228 */
77 { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */ 79 { USB_DEVICE(0x10C4, 0x8066) }, /* Argussoft In-System Programmer */
80 { USB_DEVICE(0x10C4, 0x806F) }, /* IMS USB to RS422 Converter Cable */
78 { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */ 81 { USB_DEVICE(0x10C4, 0x807A) }, /* Crumb128 board */
79 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */ 82 { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
80 { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */ 83 { USB_DEVICE(0x10C4, 0x80DD) }, /* Tracient RFID */
@@ -82,12 +85,15 @@ static const struct usb_device_id id_table[] = {
82 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */ 85 { USB_DEVICE(0x10C4, 0x8115) }, /* Arygon NFC/Mifare Reader */
83 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */ 86 { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
84 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */ 87 { USB_DEVICE(0x10C4, 0x813F) }, /* Tams Master Easy Control */
88 { USB_DEVICE(0x10C4, 0x8149) }, /* West Mountain Radio Computerized Battery Analyzer */
85 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */ 89 { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
86 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */ 90 { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
87 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */ 91 { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
92 { USB_DEVICE(0x10C4, 0x818B) }, /* AVIT Research USB to TTL */
88 { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */ 93 { USB_DEVICE(0x10C4, 0x819F) }, /* MJS USB Toslink Switcher */
89 { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */ 94 { USB_DEVICE(0x10C4, 0x81A6) }, /* ThinkOptics WavIt */
90 { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */ 95 { USB_DEVICE(0x10C4, 0x81AC) }, /* MSD Dash Hawk */
96 { USB_DEVICE(0x10C4, 0x81AD) }, /* INSYS USB Modem */
91 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */ 97 { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
92 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */ 98 { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
93 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */ 99 { USB_DEVICE(0x10C4, 0x81E7) }, /* Aerocomm Radio */
@@ -105,6 +111,7 @@ static const struct usb_device_id id_table[] = {
105 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */ 111 { USB_DEVICE(0x10C4, 0x846E) }, /* BEI USB Sensor Interface (VCP) */
106 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 112 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
107 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 113 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
114 { USB_DEVICE(0x10C4, 0xEA71) }, /* Infinity GPS-MIC-1 Radio Monophone */
108 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */ 115 { USB_DEVICE(0x10C4, 0xF001) }, /* Elan Digital Systems USBscope50 */
109 { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */ 116 { USB_DEVICE(0x10C4, 0xF002) }, /* Elan Digital Systems USBwave12 */
110 { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */ 117 { USB_DEVICE(0x10C4, 0xF003) }, /* Elan Digital Systems USBpulse100 */
@@ -115,6 +122,8 @@ static const struct usb_device_id id_table[] = {
115 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */ 122 { USB_DEVICE(0x1555, 0x0004) }, /* Owen AC4 USB-RS485 Converter */
116 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */ 123 { USB_DEVICE(0x166A, 0x0303) }, /* Clipsal 5500PCU C-Bus USB interface */
117 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */ 124 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
125 { USB_DEVICE(0x17F4, 0xAAAA) }, /* Wavesense Jazz blood glucose meter */
126 { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */
118 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ 127 { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
119 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ 128 { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */
120 { } /* Terminating Entry */ 129 { } /* Terminating Entry */
@@ -138,6 +147,8 @@ static struct usb_serial_driver cp210x_device = {
138 .usb_driver = &cp210x_driver, 147 .usb_driver = &cp210x_driver,
139 .id_table = id_table, 148 .id_table = id_table,
140 .num_ports = 1, 149 .num_ports = 1,
150 .bulk_in_size = 256,
151 .bulk_out_size = 256,
141 .open = cp210x_open, 152 .open = cp210x_open,
142 .close = cp210x_close, 153 .close = cp210x_close,
143 .break_ctl = cp210x_break_ctl, 154 .break_ctl = cp210x_break_ctl,
@@ -145,7 +156,6 @@ static struct usb_serial_driver cp210x_device = {
145 .tiocmget = cp210x_tiocmget, 156 .tiocmget = cp210x_tiocmget,
146 .tiocmset = cp210x_tiocmset, 157 .tiocmset = cp210x_tiocmset,
147 .attach = cp210x_startup, 158 .attach = cp210x_startup,
148 .disconnect = cp210x_disconnect,
149 .dtr_rts = cp210x_dtr_rts, 159 .dtr_rts = cp210x_dtr_rts,
150 .carrier_raised = cp210x_carrier_raised 160 .carrier_raised = cp210x_carrier_raised
151}; 161};
@@ -370,7 +380,6 @@ static unsigned int cp210x_quantise_baudrate(unsigned int baud) {
370 380
371static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port) 381static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
372{ 382{
373 struct usb_serial *serial = port->serial;
374 int result; 383 int result;
375 384
376 dbg("%s - port %d", __func__, port->number); 385 dbg("%s - port %d", __func__, port->number);
@@ -381,49 +390,20 @@ static int cp210x_open(struct tty_struct *tty, struct usb_serial_port *port)
381 return -EPROTO; 390 return -EPROTO;
382 } 391 }
383 392
384 /* Start reading from the device */ 393 result = usb_serial_generic_open(tty, port);
385 usb_fill_bulk_urb(port->read_urb, serial->dev, 394 if (result)
386 usb_rcvbulkpipe(serial->dev,
387 port->bulk_in_endpointAddress),
388 port->read_urb->transfer_buffer,
389 port->read_urb->transfer_buffer_length,
390 serial->type->read_bulk_callback,
391 port);
392 result = usb_submit_urb(port->read_urb, GFP_KERNEL);
393 if (result) {
394 dev_err(&port->dev, "%s - failed resubmitting read urb, "
395 "error %d\n", __func__, result);
396 return result; 395 return result;
397 }
398 396
399 /* Configure the termios structure */ 397 /* Configure the termios structure */
400 cp210x_get_termios(tty, port); 398 cp210x_get_termios(tty, port);
401 return 0; 399 return 0;
402} 400}
403 401
404static void cp210x_cleanup(struct usb_serial_port *port)
405{
406 struct usb_serial *serial = port->serial;
407
408 dbg("%s - port %d", __func__, port->number);
409
410 if (serial->dev) {
411 /* shutdown any bulk reads that might be going on */
412 if (serial->num_bulk_out)
413 usb_kill_urb(port->write_urb);
414 if (serial->num_bulk_in)
415 usb_kill_urb(port->read_urb);
416 }
417}
418
419static void cp210x_close(struct usb_serial_port *port) 402static void cp210x_close(struct usb_serial_port *port)
420{ 403{
421 dbg("%s - port %d", __func__, port->number); 404 dbg("%s - port %d", __func__, port->number);
422 405
423 /* shutdown our urbs */ 406 usb_serial_generic_close(port);
424 dbg("%s - shutting down urbs", __func__);
425 usb_kill_urb(port->write_urb);
426 usb_kill_urb(port->read_urb);
427 407
428 mutex_lock(&port->serial->disc_mutex); 408 mutex_lock(&port->serial->disc_mutex);
429 if (!port->serial->disconnected) 409 if (!port->serial->disconnected)
@@ -807,17 +787,6 @@ static int cp210x_startup(struct usb_serial *serial)
807 return 0; 787 return 0;
808} 788}
809 789
810static void cp210x_disconnect(struct usb_serial *serial)
811{
812 int i;
813
814 dbg("%s", __func__);
815
816 /* Stop reads and writes on all ports */
817 for (i = 0; i < serial->num_ports; ++i)
818 cp210x_cleanup(serial->port[i]);
819}
820
821static int __init cp210x_init(void) 790static int __init cp210x_init(void)
822{ 791{
823 int retval; 792 int retval;