diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/hub.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 2 | ||||
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.c | 73 | ||||
-rw-r--r-- | drivers/usb/serial/ti_usb_3410_5052.h | 8 | ||||
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 3 |
5 files changed, 68 insertions, 20 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index d5d0e40b1e2d..94d5ee263c20 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -1554,7 +1554,7 @@ static int usb_configure_device_otg(struct usb_device *udev) | |||
1554 | * (Includes HNP test device.) | 1554 | * (Includes HNP test device.) |
1555 | */ | 1555 | */ |
1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { | 1556 | if (udev->bus->b_hnp_enable || udev->bus->is_b_host) { |
1557 | err = usb_port_suspend(udev); | 1557 | err = usb_port_suspend(udev, PMSG_SUSPEND); |
1558 | if (err < 0) | 1558 | if (err < 0) |
1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); | 1559 | dev_dbg(&udev->dev, "HNP fail, %d\n", err); |
1560 | } | 1560 | } |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index ef6cfa5a447f..c70a8f667d85 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -2030,7 +2030,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2030 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2031 | dbg("%s - deferring remainder until unthrottled", | 2031 | dbg("%s - deferring remainder until unthrottled", |
2032 | __func__); | 2032 | __func__); |
2033 | return; | 2033 | goto out; |
2034 | } | 2034 | } |
2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); | 2035 | spin_unlock_irqrestore(&priv->rx_lock, flags); |
2036 | /* if the port is closed stop trying to read */ | 2036 | /* if the port is closed stop trying to read */ |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 01d0c70d60e9..3cf41df302d7 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -145,7 +145,7 @@ static int ti_command_in_sync(struct ti_device *tdev, __u8 command, | |||
145 | static int ti_write_byte(struct ti_device *tdev, unsigned long addr, | 145 | static int ti_write_byte(struct ti_device *tdev, unsigned long addr, |
146 | __u8 mask, __u8 byte); | 146 | __u8 mask, __u8 byte); |
147 | 147 | ||
148 | static int ti_download_firmware(struct ti_device *tdev, int type); | 148 | static int ti_download_firmware(struct ti_device *tdev); |
149 | 149 | ||
150 | /* circular buffer */ | 150 | /* circular buffer */ |
151 | static struct circ_buf *ti_buf_alloc(void); | 151 | static struct circ_buf *ti_buf_alloc(void); |
@@ -176,9 +176,14 @@ static unsigned int product_5052_count; | |||
176 | /* the array dimension is the number of default entries plus */ | 176 | /* the array dimension is the number of default entries plus */ |
177 | /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ | 177 | /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */ |
178 | /* null entry */ | 178 | /* null entry */ |
179 | static struct usb_device_id ti_id_table_3410[1+TI_EXTRA_VID_PID_COUNT+1] = { | 179 | static struct usb_device_id ti_id_table_3410[7+TI_EXTRA_VID_PID_COUNT+1] = { |
180 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, | 180 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, |
181 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, | 181 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, |
182 | { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, | ||
183 | { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_NO_FW_PRODUCT_ID) }, | ||
184 | { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) }, | ||
185 | { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) }, | ||
186 | { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) }, | ||
182 | }; | 187 | }; |
183 | 188 | ||
184 | static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = { | 189 | static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = { |
@@ -188,9 +193,14 @@ static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = { | |||
188 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, | 193 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, |
189 | }; | 194 | }; |
190 | 195 | ||
191 | static struct usb_device_id ti_id_table_combined[] = { | 196 | static struct usb_device_id ti_id_table_combined[6+2*TI_EXTRA_VID_PID_COUNT+1] = { |
192 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, | 197 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) }, |
193 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, | 198 | { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) }, |
199 | { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) }, | ||
200 | { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_NO_FW_PRODUCT_ID) }, | ||
201 | { USB_DEVICE(MTS_VENDOR_ID, MTS_CDMA_PRODUCT_ID) }, | ||
202 | { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) }, | ||
203 | { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) }, | ||
194 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) }, | 204 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) }, |
195 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, | 205 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, |
196 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, | 206 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, |
@@ -272,6 +282,9 @@ MODULE_LICENSE("GPL"); | |||
272 | 282 | ||
273 | MODULE_FIRMWARE("ti_3410.fw"); | 283 | MODULE_FIRMWARE("ti_3410.fw"); |
274 | MODULE_FIRMWARE("ti_5052.fw"); | 284 | MODULE_FIRMWARE("ti_5052.fw"); |
285 | MODULE_FIRMWARE("mts_cdma.fw"); | ||
286 | MODULE_FIRMWARE("mts_gsm.fw"); | ||
287 | MODULE_FIRMWARE("mts_edge.fw"); | ||
275 | 288 | ||
276 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 289 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
277 | MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); | 290 | MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); |
@@ -304,21 +317,28 @@ MODULE_DEVICE_TABLE(usb, ti_id_table_combined); | |||
304 | 317 | ||
305 | static int __init ti_init(void) | 318 | static int __init ti_init(void) |
306 | { | 319 | { |
307 | int i, j; | 320 | int i, j, c; |
308 | int ret; | 321 | int ret; |
309 | 322 | ||
310 | /* insert extra vendor and product ids */ | 323 | /* insert extra vendor and product ids */ |
324 | c = ARRAY_SIZE(ti_id_table_combined) - 2 * TI_EXTRA_VID_PID_COUNT - 1; | ||
311 | j = ARRAY_SIZE(ti_id_table_3410) - TI_EXTRA_VID_PID_COUNT - 1; | 325 | j = ARRAY_SIZE(ti_id_table_3410) - TI_EXTRA_VID_PID_COUNT - 1; |
312 | for (i = 0; i < min(vendor_3410_count, product_3410_count); i++, j++) { | 326 | for (i = 0; i < min(vendor_3410_count, product_3410_count); i++, j++, c++) { |
313 | ti_id_table_3410[j].idVendor = vendor_3410[i]; | 327 | ti_id_table_3410[j].idVendor = vendor_3410[i]; |
314 | ti_id_table_3410[j].idProduct = product_3410[i]; | 328 | ti_id_table_3410[j].idProduct = product_3410[i]; |
315 | ti_id_table_3410[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 329 | ti_id_table_3410[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
330 | ti_id_table_combined[c].idVendor = vendor_3410[i]; | ||
331 | ti_id_table_combined[c].idProduct = product_3410[i]; | ||
332 | ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | ||
316 | } | 333 | } |
317 | j = ARRAY_SIZE(ti_id_table_5052) - TI_EXTRA_VID_PID_COUNT - 1; | 334 | j = ARRAY_SIZE(ti_id_table_5052) - TI_EXTRA_VID_PID_COUNT - 1; |
318 | for (i = 0; i < min(vendor_5052_count, product_5052_count); i++, j++) { | 335 | for (i = 0; i < min(vendor_5052_count, product_5052_count); i++, j++, c++) { |
319 | ti_id_table_5052[j].idVendor = vendor_5052[i]; | 336 | ti_id_table_5052[j].idVendor = vendor_5052[i]; |
320 | ti_id_table_5052[j].idProduct = product_5052[i]; | 337 | ti_id_table_5052[j].idProduct = product_5052[i]; |
321 | ti_id_table_5052[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | 338 | ti_id_table_5052[j].match_flags = USB_DEVICE_ID_MATCH_DEVICE; |
339 | ti_id_table_combined[c].idVendor = vendor_5052[i]; | ||
340 | ti_id_table_combined[c].idProduct = product_5052[i]; | ||
341 | ti_id_table_combined[c].match_flags = USB_DEVICE_ID_MATCH_DEVICE; | ||
322 | } | 342 | } |
323 | 343 | ||
324 | ret = usb_serial_register(&ti_1port_device); | 344 | ret = usb_serial_register(&ti_1port_device); |
@@ -390,11 +410,7 @@ static int ti_startup(struct usb_serial *serial) | |||
390 | 410 | ||
391 | /* if we have only 1 configuration, download firmware */ | 411 | /* if we have only 1 configuration, download firmware */ |
392 | if (dev->descriptor.bNumConfigurations == 1) { | 412 | if (dev->descriptor.bNumConfigurations == 1) { |
393 | if (tdev->td_is_3410) | 413 | if ((status = ti_download_firmware(tdev)) != 0) |
394 | status = ti_download_firmware(tdev, 3410); | ||
395 | else | ||
396 | status = ti_download_firmware(tdev, 5052); | ||
397 | if (status) | ||
398 | goto free_tdev; | 414 | goto free_tdev; |
399 | 415 | ||
400 | /* 3410 must be reset, 5052 resets itself */ | 416 | /* 3410 must be reset, 5052 resets itself */ |
@@ -1671,9 +1687,9 @@ static int ti_do_download(struct usb_device *dev, int pipe, | |||
1671 | return status; | 1687 | return status; |
1672 | } | 1688 | } |
1673 | 1689 | ||
1674 | static int ti_download_firmware(struct ti_device *tdev, int type) | 1690 | static int ti_download_firmware(struct ti_device *tdev) |
1675 | { | 1691 | { |
1676 | int status = -ENOMEM; | 1692 | int status; |
1677 | int buffer_size; | 1693 | int buffer_size; |
1678 | __u8 *buffer; | 1694 | __u8 *buffer; |
1679 | struct usb_device *dev = tdev->td_serial->dev; | 1695 | struct usb_device *dev = tdev->td_serial->dev; |
@@ -1681,9 +1697,34 @@ static int ti_download_firmware(struct ti_device *tdev, int type) | |||
1681 | tdev->td_serial->port[0]->bulk_out_endpointAddress); | 1697 | tdev->td_serial->port[0]->bulk_out_endpointAddress); |
1682 | const struct firmware *fw_p; | 1698 | const struct firmware *fw_p; |
1683 | char buf[32]; | 1699 | char buf[32]; |
1684 | sprintf(buf, "ti_usb-%d.bin", type); | ||
1685 | 1700 | ||
1686 | if (request_firmware(&fw_p, buf, &dev->dev)) { | 1701 | /* try ID specific firmware first, then try generic firmware */ |
1702 | sprintf(buf, "ti_usb-v%04x-p%04x.fw", dev->descriptor.idVendor, | ||
1703 | dev->descriptor.idProduct); | ||
1704 | if ((status = request_firmware(&fw_p, buf, &dev->dev)) != 0) { | ||
1705 | buf[0] = '\0'; | ||
1706 | if (dev->descriptor.idVendor == MTS_VENDOR_ID) { | ||
1707 | switch (dev->descriptor.idProduct) { | ||
1708 | case MTS_CDMA_PRODUCT_ID: | ||
1709 | strcpy(buf, "mts_cdma.fw"); | ||
1710 | break; | ||
1711 | case MTS_GSM_PRODUCT_ID: | ||
1712 | strcpy(buf, "mts_gsm.fw"); | ||
1713 | break; | ||
1714 | case MTS_EDGE_PRODUCT_ID: | ||
1715 | strcpy(buf, "mts_edge.fw"); | ||
1716 | break; | ||
1717 | } | ||
1718 | } | ||
1719 | if (buf[0] == '\0') { | ||
1720 | if (tdev->td_is_3410) | ||
1721 | strcpy(buf, "ti_3410.fw"); | ||
1722 | else | ||
1723 | strcpy(buf, "ti_5052.fw"); | ||
1724 | } | ||
1725 | status = request_firmware(&fw_p, buf, &dev->dev); | ||
1726 | } | ||
1727 | if (status) { | ||
1687 | dev_err(&dev->dev, "%s - firmware not found\n", __func__); | 1728 | dev_err(&dev->dev, "%s - firmware not found\n", __func__); |
1688 | return -ENOENT; | 1729 | return -ENOENT; |
1689 | } | 1730 | } |
@@ -1699,6 +1740,8 @@ static int ti_download_firmware(struct ti_device *tdev, int type) | |||
1699 | memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); | 1740 | memset(buffer + fw_p->size, 0xff, buffer_size - fw_p->size); |
1700 | status = ti_do_download(dev, pipe, buffer, fw_p->size); | 1741 | status = ti_do_download(dev, pipe, buffer, fw_p->size); |
1701 | kfree(buffer); | 1742 | kfree(buffer); |
1743 | } else { | ||
1744 | status = -ENOMEM; | ||
1702 | } | 1745 | } |
1703 | release_firmware(fw_p); | 1746 | release_firmware(fw_p); |
1704 | if (status) { | 1747 | if (status) { |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.h b/drivers/usb/serial/ti_usb_3410_5052.h index b5541bf991ba..7e4752fbf232 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.h +++ b/drivers/usb/serial/ti_usb_3410_5052.h | |||
@@ -34,6 +34,14 @@ | |||
34 | #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */ | 34 | #define TI_5052_EEPROM_PRODUCT_ID 0x505A /* EEPROM, no firmware */ |
35 | #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */ | 35 | #define TI_5052_FIRMWARE_PRODUCT_ID 0x505F /* firmware is running */ |
36 | 36 | ||
37 | /* Multi-Tech vendor and product ids */ | ||
38 | #define MTS_VENDOR_ID 0x06E0 | ||
39 | #define MTS_GSM_NO_FW_PRODUCT_ID 0xF108 | ||
40 | #define MTS_CDMA_NO_FW_PRODUCT_ID 0xF109 | ||
41 | #define MTS_CDMA_PRODUCT_ID 0xF110 | ||
42 | #define MTS_GSM_PRODUCT_ID 0xF111 | ||
43 | #define MTS_EDGE_PRODUCT_ID 0xF112 | ||
44 | |||
37 | /* Commands */ | 45 | /* Commands */ |
38 | #define TI_GET_VERSION 0x01 | 46 | #define TI_GET_VERSION 0x01 |
39 | #define TI_GET_PORT_STATUS 0x02 | 47 | #define TI_GET_PORT_STATUS 0x02 |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 080ade223d53..cfcfd5ab06ce 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -511,9 +511,6 @@ static void usb_serial_port_work(struct work_struct *work) | |||
511 | 511 | ||
512 | dbg("%s - port %d", __func__, port->number); | 512 | dbg("%s - port %d", __func__, port->number); |
513 | 513 | ||
514 | if (!port) | ||
515 | return; | ||
516 | |||
517 | tty = tty_port_tty_get(&port->port); | 514 | tty = tty_port_tty_get(&port->port); |
518 | if (!tty) | 515 | if (!tty) |
519 | return; | 516 | return; |