aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ti_usb_3410_5052.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/ti_usb_3410_5052.c')
-rw-r--r--drivers/usb/serial/ti_usb_3410_5052.c65
1 files changed, 12 insertions, 53 deletions
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index ab74123d658e..a4404f5ad68e 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -165,7 +165,7 @@ static unsigned int product_5052_count;
165/* the array dimension is the number of default entries plus */ 165/* the array dimension is the number of default entries plus */
166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ 166/* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
167/* null entry */ 167/* null entry */
168static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = { 168static struct usb_device_id ti_id_table_3410[15+TI_EXTRA_VID_PID_COUNT+1] = {
169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 169 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 170 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 171 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -180,6 +180,7 @@ static struct usb_device_id ti_id_table_3410[14+TI_EXTRA_VID_PID_COUNT+1] = {
180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 180 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 181 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
182 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, 182 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
183 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
183}; 184};
184 185
185static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { 186static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
@@ -189,7 +190,7 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
189 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, 190 { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
190}; 191};
191 192
192static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1] = { 193static struct usb_device_id ti_id_table_combined[19+2*TI_EXTRA_VID_PID_COUNT+1] = {
193 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, 194 { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
194 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, 195 { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
195 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, 196 { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -208,16 +209,10 @@ static struct usb_device_id ti_id_table_combined[18+2*TI_EXTRA_VID_PID_COUNT+1]
208 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) }, 209 { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
209 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) }, 210 { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
210 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) }, 211 { USB_DEVICE(ABBOTT_VENDOR_ID, ABBOTT_PRODUCT_ID) },
212 { USB_DEVICE(TI_VENDOR_ID, FRI2_PRODUCT_ID) },
211 { } 213 { }
212}; 214};
213 215
214static struct usb_driver ti_usb_driver = {
215 .name = "ti_usb_3410_5052",
216 .probe = usb_serial_probe,
217 .disconnect = usb_serial_disconnect,
218 .id_table = ti_id_table_combined,
219};
220
221static struct usb_serial_driver ti_1port_device = { 216static struct usb_serial_driver ti_1port_device = {
222 .driver = { 217 .driver = {
223 .owner = THIS_MODULE, 218 .owner = THIS_MODULE,
@@ -344,20 +339,18 @@ static int __init ti_init(void)
344 ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE; 339 ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE;
345 } 340 }
346 341
347 ret = usb_serial_register_drivers(&ti_usb_driver, serial_drivers); 342 ret = usb_serial_register_drivers(serial_drivers, KBUILD_MODNAME, ti_id_table_combined);
348 if (ret == 0) 343 if (ret == 0)
349 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":" 344 printk(KERN_INFO KBUILD_MODNAME ": " TI_DRIVER_VERSION ":"
350 TI_DRIVER_DESC "\n"); 345 TI_DRIVER_DESC "\n");
351 return ret; 346 return ret;
352} 347}
353 348
354
355static void __exit ti_exit(void) 349static void __exit ti_exit(void)
356{ 350{
357 usb_serial_deregister_drivers(&ti_usb_driver, serial_drivers); 351 usb_serial_deregister_drivers(serial_drivers);
358} 352}
359 353
360
361module_init(ti_init); 354module_init(ti_init);
362module_exit(ti_exit); 355module_exit(ti_exit);
363 356
@@ -394,7 +387,9 @@ static int ti_startup(struct usb_serial *serial)
394 387
395 /* if we have only 1 configuration, download firmware */ 388 /* if we have only 1 configuration, download firmware */
396 if (dev->descriptor.bNumConfigurations == 1) { 389 if (dev->descriptor.bNumConfigurations == 1) {
397 if ((status = ti_download_firmware(tdev)) != 0) 390 status = ti_download_firmware(tdev);
391
392 if (status != 0)
398 goto free_tdev; 393 goto free_tdev;
399 394
400 /* 3410 must be reset, 5052 resets itself */ 395 /* 3410 must be reset, 5052 resets itself */
@@ -463,8 +458,6 @@ static void ti_release(struct usb_serial *serial)
463 struct ti_device *tdev = usb_get_serial_data(serial); 458 struct ti_device *tdev = usb_get_serial_data(serial);
464 struct ti_port *tport; 459 struct ti_port *tport;
465 460
466 dbg("%s", __func__);
467
468 for (i = 0; i < serial->num_ports; ++i) { 461 for (i = 0; i < serial->num_ports; ++i) {
469 tport = usb_get_serial_port_data(serial->port[i]); 462 tport = usb_get_serial_port_data(serial->port[i]);
470 if (tport) { 463 if (tport) {
@@ -489,8 +482,6 @@ static int ti_open(struct tty_struct *tty, struct usb_serial_port *port)
489 TI_PIPE_TIMEOUT_ENABLE | 482 TI_PIPE_TIMEOUT_ENABLE |
490 (TI_TRANSFER_TIMEOUT << 2)); 483 (TI_TRANSFER_TIMEOUT << 2));
491 484
492 dbg("%s - port %d", __func__, port->number);
493
494 if (tport == NULL) 485 if (tport == NULL)
495 return -ENODEV; 486 return -ENODEV;
496 487
@@ -631,8 +622,6 @@ static void ti_close(struct usb_serial_port *port)
631 int status; 622 int status;
632 int do_unlock; 623 int do_unlock;
633 624
634 dbg("%s - port %d", __func__, port->number);
635
636 tdev = usb_get_serial_data(port->serial); 625 tdev = usb_get_serial_data(port->serial);
637 tport = usb_get_serial_port_data(port); 626 tport = usb_get_serial_port_data(port);
638 if (tdev == NULL || tport == NULL) 627 if (tdev == NULL || tport == NULL)
@@ -666,8 +655,6 @@ static void ti_close(struct usb_serial_port *port)
666 } 655 }
667 if (do_unlock) 656 if (do_unlock)
668 mutex_unlock(&tdev->td_open_close_lock); 657 mutex_unlock(&tdev->td_open_close_lock);
669
670 dbg("%s - exit", __func__);
671} 658}
672 659
673 660
@@ -676,8 +663,6 @@ static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
676{ 663{
677 struct ti_port *tport = usb_get_serial_port_data(port); 664 struct ti_port *tport = usb_get_serial_port_data(port);
678 665
679 dbg("%s - port %d", __func__, port->number);
680
681 if (count == 0) { 666 if (count == 0) {
682 dbg("%s - write request of 0 bytes", __func__); 667 dbg("%s - write request of 0 bytes", __func__);
683 return 0; 668 return 0;
@@ -701,8 +686,6 @@ static int ti_write_room(struct tty_struct *tty)
701 int room = 0; 686 int room = 0;
702 unsigned long flags; 687 unsigned long flags;
703 688
704 dbg("%s - port %d", __func__, port->number);
705
706 if (tport == NULL) 689 if (tport == NULL)
707 return 0; 690 return 0;
708 691
@@ -722,8 +705,6 @@ static int ti_chars_in_buffer(struct tty_struct *tty)
722 int chars = 0; 705 int chars = 0;
723 unsigned long flags; 706 unsigned long flags;
724 707
725 dbg("%s - port %d", __func__, port->number);
726
727 if (tport == NULL) 708 if (tport == NULL)
728 return 0; 709 return 0;
729 710
@@ -741,8 +722,6 @@ static void ti_throttle(struct tty_struct *tty)
741 struct usb_serial_port *port = tty->driver_data; 722 struct usb_serial_port *port = tty->driver_data;
742 struct ti_port *tport = usb_get_serial_port_data(port); 723 struct ti_port *tport = usb_get_serial_port_data(port);
743 724
744 dbg("%s - port %d", __func__, port->number);
745
746 if (tport == NULL) 725 if (tport == NULL)
747 return; 726 return;
748 727
@@ -758,8 +737,6 @@ static void ti_unthrottle(struct tty_struct *tty)
758 struct ti_port *tport = usb_get_serial_port_data(port); 737 struct ti_port *tport = usb_get_serial_port_data(port);
759 int status; 738 int status;
760 739
761 dbg("%s - port %d", __func__, port->number);
762
763 if (tport == NULL) 740 if (tport == NULL)
764 return; 741 return;
765 742
@@ -854,8 +831,6 @@ static void ti_set_termios(struct tty_struct *tty,
854 int port_number = port->number - port->serial->minor; 831 int port_number = port->number - port->serial->minor;
855 unsigned int mcr; 832 unsigned int mcr;
856 833
857 dbg("%s - port %d", __func__, port->number);
858
859 cflag = tty->termios->c_cflag; 834 cflag = tty->termios->c_cflag;
860 iflag = tty->termios->c_iflag; 835 iflag = tty->termios->c_iflag;
861 836
@@ -988,8 +963,6 @@ static int ti_tiocmget(struct tty_struct *tty)
988 unsigned int mcr; 963 unsigned int mcr;
989 unsigned long flags; 964 unsigned long flags;
990 965
991 dbg("%s - port %d", __func__, port->number);
992
993 if (tport == NULL) 966 if (tport == NULL)
994 return -ENODEV; 967 return -ENODEV;
995 968
@@ -1020,8 +993,6 @@ static int ti_tiocmset(struct tty_struct *tty,
1020 unsigned int mcr; 993 unsigned int mcr;
1021 unsigned long flags; 994 unsigned long flags;
1022 995
1023 dbg("%s - port %d", __func__, port->number);
1024
1025 if (tport == NULL) 996 if (tport == NULL)
1026 return -ENODEV; 997 return -ENODEV;
1027 998
@@ -1084,8 +1055,6 @@ static void ti_interrupt_callback(struct urb *urb)
1084 int retval; 1055 int retval;
1085 __u8 msr; 1056 __u8 msr;
1086 1057
1087 dbg("%s", __func__);
1088
1089 switch (status) { 1058 switch (status) {
1090 case 0: 1059 case 0:
1091 break; 1060 break;
@@ -1165,8 +1134,6 @@ static void ti_bulk_in_callback(struct urb *urb)
1165 int retval = 0; 1134 int retval = 0;
1166 struct tty_struct *tty; 1135 struct tty_struct *tty;
1167 1136
1168 dbg("%s", __func__);
1169
1170 switch (status) { 1137 switch (status) {
1171 case 0: 1138 case 0:
1172 break; 1139 break;
@@ -1233,8 +1200,6 @@ static void ti_bulk_out_callback(struct urb *urb)
1233 struct usb_serial_port *port = tport->tp_port; 1200 struct usb_serial_port *port = tport->tp_port;
1234 int status = urb->status; 1201 int status = urb->status;
1235 1202
1236 dbg("%s - port %d", __func__, port->number);
1237
1238 tport->tp_write_urb_in_use = 0; 1203 tport->tp_write_urb_in_use = 0;
1239 1204
1240 switch (status) { 1205 switch (status) {
@@ -1287,9 +1252,6 @@ static void ti_send(struct ti_port *tport)
1287 struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */ 1252 struct tty_struct *tty = tty_port_tty_get(&port->port); /* FIXME */
1288 unsigned long flags; 1253 unsigned long flags;
1289 1254
1290
1291 dbg("%s - port %d", __func__, port->number);
1292
1293 spin_lock_irqsave(&tport->tp_lock, flags); 1255 spin_lock_irqsave(&tport->tp_lock, flags);
1294 1256
1295 if (tport->tp_write_urb_in_use) 1257 if (tport->tp_write_urb_in_use)
@@ -1366,8 +1328,6 @@ static int ti_get_lsr(struct ti_port *tport)
1366 int port_number = port->number - port->serial->minor; 1328 int port_number = port->number - port->serial->minor;
1367 struct ti_port_status *data; 1329 struct ti_port_status *data;
1368 1330
1369 dbg("%s - port %d", __func__, port->number);
1370
1371 size = sizeof(struct ti_port_status); 1331 size = sizeof(struct ti_port_status);
1372 data = kmalloc(size, GFP_KERNEL); 1332 data = kmalloc(size, GFP_KERNEL);
1373 if (!data) { 1333 if (!data) {
@@ -1480,8 +1440,6 @@ static void ti_drain(struct ti_port *tport, unsigned long timeout, int flush)
1480 struct usb_serial_port *port = tport->tp_port; 1440 struct usb_serial_port *port = tport->tp_port;
1481 wait_queue_t wait; 1441 wait_queue_t wait;
1482 1442
1483 dbg("%s - port %d", __func__, port->number);
1484
1485 spin_lock_irq(&tport->tp_lock); 1443 spin_lock_irq(&tport->tp_lock);
1486 1444
1487 /* wait for data to drain from the buffer */ 1445 /* wait for data to drain from the buffer */
@@ -1679,11 +1637,12 @@ static int ti_download_firmware(struct ti_device *tdev)
1679 const struct firmware *fw_p; 1637 const struct firmware *fw_p;
1680 char buf[32]; 1638 char buf[32];
1681 1639
1682 dbg("%s\n", __func__);
1683 /* try ID specific firmware first, then try generic firmware */ 1640 /* try ID specific firmware first, then try generic firmware */
1684 sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, 1641 sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor,
1685 dev->descriptor.idProduct); 1642 dev->descriptor.idProduct);
1686 if ((status = request_firmware(&fw_p, buf, &dev->dev)) != 0) { 1643 status = request_firmware(&fw_p, buf, &dev->dev);
1644
1645 if (status != 0) {
1687 buf[0] = '\0'; 1646 buf[0] = '\0';
1688 if (dev->descriptor.idVendor == MTS_VENDOR_ID) { 1647 if (dev->descriptor.idVendor == MTS_VENDOR_ID) {
1689 switch (dev->descriptor.idProduct) { 1648 switch (dev->descriptor.idProduct) {