aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS10
-rw-r--r--drivers/usb/chipidea/Kconfig9
-rw-r--r--drivers/usb/gadget/u_ether.c6
-rw-r--r--drivers/usb/host/ehci-omap.c167
-rw-r--r--drivers/usb/host/ehci-sead3.c2
-rw-r--r--drivers/usb/host/ehci-tegra.c3
-rw-r--r--drivers/usb/host/isp1362-hcd.c8
-rw-r--r--drivers/usb/host/pci-quirks.c7
-rw-r--r--drivers/usb/host/pci-quirks.h1
-rw-r--r--drivers/usb/host/xhci-pci.c10
-rw-r--r--drivers/usb/host/xhci-ring.c40
-rw-r--r--drivers/usb/host/xhci.c8
-rw-r--r--drivers/usb/host/xhci.h3
-rw-r--r--drivers/usb/musb/Kconfig4
-rw-r--r--drivers/usb/musb/musb_dsps.c19
-rw-r--r--drivers/usb/renesas_usbhs/common.c6
-rw-r--r--drivers/usb/renesas_usbhs/mod_host.c8
-rw-r--r--drivers/usb/serial/bus.c15
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h7
-rw-r--r--drivers/usb/serial/ipw.c3
-rw-r--r--drivers/usb/serial/mos7840.c16
-rw-r--r--drivers/usb/serial/option.c285
-rw-r--r--drivers/usb/serial/qcserial.c47
-rw-r--r--drivers/usb/serial/usb-wwan.h3
-rw-r--r--drivers/usb/serial/usb_wwan.c68
26 files changed, 299 insertions, 457 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 61ad79ea2b08..3aed8325a902 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2217,7 +2217,7 @@ S: Maintained
2217F: drivers/scsi/tmscsim.* 2217F: drivers/scsi/tmscsim.*
2218 2218
2219DC395x SCSI driver 2219DC395x SCSI driver
2220M: Oliver Neukum <oliver@neukum.name> 2220M: Oliver Neukum <oliver@neukum.org>
2221M: Ali Akcaagac <aliakc@web.de> 2221M: Ali Akcaagac <aliakc@web.de>
2222M: Jamie Lenehan <lenehan@twibble.org> 2222M: Jamie Lenehan <lenehan@twibble.org>
2223W: http://twibble.org/dist/dc395x/ 2223W: http://twibble.org/dist/dc395x/
@@ -4537,7 +4537,7 @@ S: Supported
4537F: arch/microblaze/ 4537F: arch/microblaze/
4538 4538
4539MICROTEK X6 SCANNER 4539MICROTEK X6 SCANNER
4540M: Oliver Neukum <oliver@neukum.name> 4540M: Oliver Neukum <oliver@neukum.org>
4541S: Maintained 4541S: Maintained
4542F: drivers/usb/image/microtek.* 4542F: drivers/usb/image/microtek.*
4543 4543
@@ -7076,7 +7076,7 @@ F: include/linux/mtd/ubi.h
7076F: include/mtd/ubi-user.h 7076F: include/mtd/ubi-user.h
7077 7077
7078USB ACM DRIVER 7078USB ACM DRIVER
7079M: Oliver Neukum <oliver@neukum.name> 7079M: Oliver Neukum <oliver@neukum.org>
7080L: linux-usb@vger.kernel.org 7080L: linux-usb@vger.kernel.org
7081S: Maintained 7081S: Maintained
7082F: Documentation/usb/acm.txt 7082F: Documentation/usb/acm.txt
@@ -7097,7 +7097,7 @@ S: Supported
7097F: drivers/block/ub.c 7097F: drivers/block/ub.c
7098 7098
7099USB CDC ETHERNET DRIVER 7099USB CDC ETHERNET DRIVER
7100M: Oliver Neukum <oliver@neukum.name> 7100M: Oliver Neukum <oliver@neukum.org>
7101L: linux-usb@vger.kernel.org 7101L: linux-usb@vger.kernel.org
7102S: Maintained 7102S: Maintained
7103F: drivers/net/usb/cdc_*.c 7103F: drivers/net/usb/cdc_*.c
@@ -7170,7 +7170,7 @@ F: drivers/usb/host/isp116x*
7170F: include/linux/usb/isp116x.h 7170F: include/linux/usb/isp116x.h
7171 7171
7172USB KAWASAKI LSI DRIVER 7172USB KAWASAKI LSI DRIVER
7173M: Oliver Neukum <oliver@neukum.name> 7173M: Oliver Neukum <oliver@neukum.org>
7174L: linux-usb@vger.kernel.org 7174L: linux-usb@vger.kernel.org
7175S: Maintained 7175S: Maintained
7176F: drivers/usb/serial/kl5kusb105.* 7176F: drivers/usb/serial/kl5kusb105.*
diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
index 8337fb5d988d..47e499c9c0b6 100644
--- a/drivers/usb/chipidea/Kconfig
+++ b/drivers/usb/chipidea/Kconfig
@@ -1,9 +1,9 @@
1config USB_CHIPIDEA 1config USB_CHIPIDEA
2 tristate "ChipIdea Highspeed Dual Role Controller" 2 tristate "ChipIdea Highspeed Dual Role Controller"
3 depends on USB 3 depends on USB || USB_GADGET
4 help 4 help
5 Say Y here if your system has a dual role high speed USB 5 Say Y here if your system has a dual role high speed USB
6 controller based on ChipIdea silicon IP. Currently, only the 6 controller based on ChipIdea silicon IP. Currently, only the
7 peripheral mode is supported. 7 peripheral mode is supported.
8 8
9 When compiled dynamically, the module will be called ci-hdrc.ko. 9 When compiled dynamically, the module will be called ci-hdrc.ko.
@@ -12,7 +12,7 @@ if USB_CHIPIDEA
12 12
13config USB_CHIPIDEA_UDC 13config USB_CHIPIDEA_UDC
14 bool "ChipIdea device controller" 14 bool "ChipIdea device controller"
15 depends on USB_GADGET 15 depends on USB_GADGET=y || USB_GADGET=USB_CHIPIDEA
16 select USB_GADGET_DUALSPEED 16 select USB_GADGET_DUALSPEED
17 help 17 help
18 Say Y here to enable device controller functionality of the 18 Say Y here to enable device controller functionality of the
@@ -20,6 +20,7 @@ config USB_CHIPIDEA_UDC
20 20
21config USB_CHIPIDEA_HOST 21config USB_CHIPIDEA_HOST
22 bool "ChipIdea host controller" 22 bool "ChipIdea host controller"
23 depends on USB=y || USB=USB_CHIPIDEA
23 select USB_EHCI_ROOT_HUB_TT 24 select USB_EHCI_ROOT_HUB_TT
24 help 25 help
25 Say Y here to enable host controller functionality of the 26 Say Y here to enable host controller functionality of the
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 90e82e288eb9..0e5230926154 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -669,6 +669,8 @@ static int eth_stop(struct net_device *net)
669 spin_lock_irqsave(&dev->lock, flags); 669 spin_lock_irqsave(&dev->lock, flags);
670 if (dev->port_usb) { 670 if (dev->port_usb) {
671 struct gether *link = dev->port_usb; 671 struct gether *link = dev->port_usb;
672 const struct usb_endpoint_descriptor *in;
673 const struct usb_endpoint_descriptor *out;
672 674
673 if (link->close) 675 if (link->close)
674 link->close(link); 676 link->close(link);
@@ -682,10 +684,14 @@ static int eth_stop(struct net_device *net)
682 * their own pace; the network stack can handle old packets. 684 * their own pace; the network stack can handle old packets.
683 * For the moment we leave this here, since it works. 685 * For the moment we leave this here, since it works.
684 */ 686 */
687 in = link->in_ep->desc;
688 out = link->out_ep->desc;
685 usb_ep_disable(link->in_ep); 689 usb_ep_disable(link->in_ep);
686 usb_ep_disable(link->out_ep); 690 usb_ep_disable(link->out_ep);
687 if (netif_carrier_ok(net)) { 691 if (netif_carrier_ok(net)) {
688 DBG(dev, "host still using in/out endpoints\n"); 692 DBG(dev, "host still using in/out endpoints\n");
693 link->in_ep->desc = in;
694 link->out_ep->desc = out;
689 usb_ep_enable(link->in_ep); 695 usb_ep_enable(link->in_ep);
690 usb_ep_enable(link->out_ep); 696 usb_ep_enable(link->out_ep);
691 } 697 }
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index bb55eb4a7d48..d7fe287d0678 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -56,15 +56,6 @@
56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8 56#define EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT 8
57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 57#define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0
58 58
59/* Errata i693 */
60static struct clk *utmi_p1_fck;
61static struct clk *utmi_p2_fck;
62static struct clk *xclk60mhsp1_ck;
63static struct clk *xclk60mhsp2_ck;
64static struct clk *usbhost_p1_fck;
65static struct clk *usbhost_p2_fck;
66static struct clk *init_60m_fclk;
67
68/*-------------------------------------------------------------------------*/ 59/*-------------------------------------------------------------------------*/
69 60
70static const struct hc_driver ehci_omap_hc_driver; 61static const struct hc_driver ehci_omap_hc_driver;
@@ -80,40 +71,6 @@ static inline u32 ehci_read(void __iomem *base, u32 reg)
80 return __raw_readl(base + reg); 71 return __raw_readl(base + reg);
81} 72}
82 73
83/* Erratum i693 workaround sequence */
84static void omap_ehci_erratum_i693(struct ehci_hcd *ehci)
85{
86 int ret = 0;
87
88 /* Switch to the internal 60 MHz clock */
89 ret = clk_set_parent(utmi_p1_fck, init_60m_fclk);
90 if (ret != 0)
91 ehci_err(ehci, "init_60m_fclk set parent"
92 "failed error:%d\n", ret);
93
94 ret = clk_set_parent(utmi_p2_fck, init_60m_fclk);
95 if (ret != 0)
96 ehci_err(ehci, "init_60m_fclk set parent"
97 "failed error:%d\n", ret);
98
99 clk_enable(usbhost_p1_fck);
100 clk_enable(usbhost_p2_fck);
101
102 /* Wait 1ms and switch back to the external clock */
103 mdelay(1);
104 ret = clk_set_parent(utmi_p1_fck, xclk60mhsp1_ck);
105 if (ret != 0)
106 ehci_err(ehci, "xclk60mhsp1_ck set parent"
107 "failed error:%d\n", ret);
108
109 ret = clk_set_parent(utmi_p2_fck, xclk60mhsp2_ck);
110 if (ret != 0)
111 ehci_err(ehci, "xclk60mhsp2_ck set parent"
112 "failed error:%d\n", ret);
113
114 clk_disable(usbhost_p1_fck);
115 clk_disable(usbhost_p2_fck);
116}
117 74
118static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port) 75static void omap_ehci_soft_phy_reset(struct usb_hcd *hcd, u8 port)
119{ 76{
@@ -195,50 +152,6 @@ static int omap_ehci_init(struct usb_hcd *hcd)
195 return rc; 152 return rc;
196} 153}
197 154
198static int omap_ehci_hub_control(
199 struct usb_hcd *hcd,
200 u16 typeReq,
201 u16 wValue,
202 u16 wIndex,
203 char *buf,
204 u16 wLength
205)
206{
207 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
208 u32 __iomem *status_reg = &ehci->regs->port_status[
209 (wIndex & 0xff) - 1];
210 u32 temp;
211 unsigned long flags;
212 int retval = 0;
213
214 spin_lock_irqsave(&ehci->lock, flags);
215
216 if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
217 temp = ehci_readl(ehci, status_reg);
218 if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
219 retval = -EPIPE;
220 goto done;
221 }
222
223 temp &= ~PORT_WKCONN_E;
224 temp |= PORT_WKDISC_E | PORT_WKOC_E;
225 ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
226
227 omap_ehci_erratum_i693(ehci);
228
229 set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
230 goto done;
231 }
232
233 spin_unlock_irqrestore(&ehci->lock, flags);
234
235 /* Handle the hub control events here */
236 return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
237done:
238 spin_unlock_irqrestore(&ehci->lock, flags);
239 return retval;
240}
241
242static void disable_put_regulator( 155static void disable_put_regulator(
243 struct ehci_hcd_omap_platform_data *pdata) 156 struct ehci_hcd_omap_platform_data *pdata)
244{ 157{
@@ -351,79 +264,9 @@ static int ehci_hcd_omap_probe(struct platform_device *pdev)
351 goto err_pm_runtime; 264 goto err_pm_runtime;
352 } 265 }
353 266
354 /* get clocks */
355 utmi_p1_fck = clk_get(dev, "utmi_p1_gfclk");
356 if (IS_ERR(utmi_p1_fck)) {
357 ret = PTR_ERR(utmi_p1_fck);
358 dev_err(dev, "utmi_p1_gfclk failed error:%d\n", ret);
359 goto err_add_hcd;
360 }
361
362 xclk60mhsp1_ck = clk_get(dev, "xclk60mhsp1_ck");
363 if (IS_ERR(xclk60mhsp1_ck)) {
364 ret = PTR_ERR(xclk60mhsp1_ck);
365 dev_err(dev, "xclk60mhsp1_ck failed error:%d\n", ret);
366 goto err_utmi_p1_fck;
367 }
368
369 utmi_p2_fck = clk_get(dev, "utmi_p2_gfclk");
370 if (IS_ERR(utmi_p2_fck)) {
371 ret = PTR_ERR(utmi_p2_fck);
372 dev_err(dev, "utmi_p2_gfclk failed error:%d\n", ret);
373 goto err_xclk60mhsp1_ck;
374 }
375
376 xclk60mhsp2_ck = clk_get(dev, "xclk60mhsp2_ck");
377 if (IS_ERR(xclk60mhsp2_ck)) {
378 ret = PTR_ERR(xclk60mhsp2_ck);
379 dev_err(dev, "xclk60mhsp2_ck failed error:%d\n", ret);
380 goto err_utmi_p2_fck;
381 }
382
383 usbhost_p1_fck = clk_get(dev, "usb_host_hs_utmi_p1_clk");
384 if (IS_ERR(usbhost_p1_fck)) {
385 ret = PTR_ERR(usbhost_p1_fck);
386 dev_err(dev, "usbhost_p1_fck failed error:%d\n", ret);
387 goto err_xclk60mhsp2_ck;
388 }
389
390 usbhost_p2_fck = clk_get(dev, "usb_host_hs_utmi_p2_clk");
391 if (IS_ERR(usbhost_p2_fck)) {
392 ret = PTR_ERR(usbhost_p2_fck);
393 dev_err(dev, "usbhost_p2_fck failed error:%d\n", ret);
394 goto err_usbhost_p1_fck;
395 }
396
397 init_60m_fclk = clk_get(dev, "init_60m_fclk");
398 if (IS_ERR(init_60m_fclk)) {
399 ret = PTR_ERR(init_60m_fclk);
400 dev_err(dev, "init_60m_fclk failed error:%d\n", ret);
401 goto err_usbhost_p2_fck;
402 }
403 267
404 return 0; 268 return 0;
405 269
406err_usbhost_p2_fck:
407 clk_put(usbhost_p2_fck);
408
409err_usbhost_p1_fck:
410 clk_put(usbhost_p1_fck);
411
412err_xclk60mhsp2_ck:
413 clk_put(xclk60mhsp2_ck);
414
415err_utmi_p2_fck:
416 clk_put(utmi_p2_fck);
417
418err_xclk60mhsp1_ck:
419 clk_put(xclk60mhsp1_ck);
420
421err_utmi_p1_fck:
422 clk_put(utmi_p1_fck);
423
424err_add_hcd:
425 usb_remove_hcd(hcd);
426
427err_pm_runtime: 270err_pm_runtime:
428 disable_put_regulator(pdata); 271 disable_put_regulator(pdata);
429 pm_runtime_put_sync(dev); 272 pm_runtime_put_sync(dev);
@@ -454,14 +297,6 @@ static int ehci_hcd_omap_remove(struct platform_device *pdev)
454 iounmap(hcd->regs); 297 iounmap(hcd->regs);
455 usb_put_hcd(hcd); 298 usb_put_hcd(hcd);
456 299
457 clk_put(utmi_p1_fck);
458 clk_put(utmi_p2_fck);
459 clk_put(xclk60mhsp1_ck);
460 clk_put(xclk60mhsp2_ck);
461 clk_put(usbhost_p1_fck);
462 clk_put(usbhost_p2_fck);
463 clk_put(init_60m_fclk);
464
465 pm_runtime_put_sync(dev); 300 pm_runtime_put_sync(dev);
466 pm_runtime_disable(dev); 301 pm_runtime_disable(dev);
467 302
@@ -532,7 +367,7 @@ static const struct hc_driver ehci_omap_hc_driver = {
532 * root hub support 367 * root hub support
533 */ 368 */
534 .hub_status_data = ehci_hub_status_data, 369 .hub_status_data = ehci_hub_status_data,
535 .hub_control = omap_ehci_hub_control, 370 .hub_control = ehci_hub_control,
536 .bus_suspend = ehci_bus_suspend, 371 .bus_suspend = ehci_bus_suspend,
537 .bus_resume = ehci_bus_resume, 372 .bus_resume = ehci_bus_resume,
538 373
diff --git a/drivers/usb/host/ehci-sead3.c b/drivers/usb/host/ehci-sead3.c
index 58c96bd50d22..0c9e43cfaff5 100644
--- a/drivers/usb/host/ehci-sead3.c
+++ b/drivers/usb/host/ehci-sead3.c
@@ -40,7 +40,7 @@ static int ehci_sead3_setup(struct usb_hcd *hcd)
40 ehci->need_io_watchdog = 0; 40 ehci->need_io_watchdog = 0;
41 41
42 /* Set burst length to 16 words. */ 42 /* Set burst length to 16 words. */
43 ehci_writel(ehci, 0x1010, &ehci->regs->reserved[1]); 43 ehci_writel(ehci, 0x1010, &ehci->regs->reserved1[1]);
44 44
45 return ret; 45 return ret;
46} 46}
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 950e95efa381..26dedb30ad0b 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -799,11 +799,12 @@ static int tegra_ehci_remove(struct platform_device *pdev)
799#endif 799#endif
800 800
801 usb_remove_hcd(hcd); 801 usb_remove_hcd(hcd);
802 usb_put_hcd(hcd);
803 802
804 tegra_usb_phy_close(tegra->phy); 803 tegra_usb_phy_close(tegra->phy);
805 iounmap(hcd->regs); 804 iounmap(hcd->regs);
806 805
806 usb_put_hcd(hcd);
807
807 clk_disable_unprepare(tegra->clk); 808 clk_disable_unprepare(tegra->clk);
808 clk_put(tegra->clk); 809 clk_put(tegra->clk);
809 810
diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c
index 2ed112d3e159..256326322cfd 100644
--- a/drivers/usb/host/isp1362-hcd.c
+++ b/drivers/usb/host/isp1362-hcd.c
@@ -543,12 +543,12 @@ static void postproc_ep(struct isp1362_hcd *isp1362_hcd, struct isp1362_ep *ep)
543 usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid, 543 usb_pipein(urb->pipe) ? "IN" : "OUT", ep->nextpid,
544 short_ok ? "" : "not_", 544 short_ok ? "" : "not_",
545 PTD_GET_COUNT(ptd), ep->maxpacket, len); 545 PTD_GET_COUNT(ptd), ep->maxpacket, len);
546 /* save the data underrun error code for later and
547 * proceed with the status stage
548 */
549 urb->actual_length += PTD_GET_COUNT(ptd);
546 if (usb_pipecontrol(urb->pipe)) { 550 if (usb_pipecontrol(urb->pipe)) {
547 ep->nextpid = USB_PID_ACK; 551 ep->nextpid = USB_PID_ACK;
548 /* save the data underrun error code for later and
549 * proceed with the status stage
550 */
551 urb->actual_length += PTD_GET_COUNT(ptd);
552 BUG_ON(urb->actual_length > urb->transfer_buffer_length); 552 BUG_ON(urb->actual_length > urb->transfer_buffer_length);
553 553
554 if (urb->status == -EINPROGRESS) 554 if (urb->status == -EINPROGRESS)
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index df0828cb2aa3..c5e9e4a76f14 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -800,6 +800,13 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
800} 800}
801EXPORT_SYMBOL_GPL(usb_enable_xhci_ports); 801EXPORT_SYMBOL_GPL(usb_enable_xhci_ports);
802 802
803void usb_disable_xhci_ports(struct pci_dev *xhci_pdev)
804{
805 pci_write_config_dword(xhci_pdev, USB_INTEL_USB3_PSSEN, 0x0);
806 pci_write_config_dword(xhci_pdev, USB_INTEL_XUSB2PR, 0x0);
807}
808EXPORT_SYMBOL_GPL(usb_disable_xhci_ports);
809
803/** 810/**
804 * PCI Quirks for xHCI. 811 * PCI Quirks for xHCI.
805 * 812 *
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index b1002a8ef96f..ef004a5de20f 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -10,6 +10,7 @@ void usb_amd_quirk_pll_disable(void);
10void usb_amd_quirk_pll_enable(void); 10void usb_amd_quirk_pll_enable(void);
11bool usb_is_intel_switchable_xhci(struct pci_dev *pdev); 11bool usb_is_intel_switchable_xhci(struct pci_dev *pdev);
12void usb_enable_xhci_ports(struct pci_dev *xhci_pdev); 12void usb_enable_xhci_ports(struct pci_dev *xhci_pdev);
13void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
13#else 14#else
14static inline void usb_amd_quirk_pll_disable(void) {} 15static inline void usb_amd_quirk_pll_disable(void) {}
15static inline void usb_amd_quirk_pll_enable(void) {} 16static inline void usb_amd_quirk_pll_enable(void) {}
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 18b231b0c5d3..9bfd4ca1153c 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -94,11 +94,21 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
94 xhci->quirks |= XHCI_EP_LIMIT_QUIRK; 94 xhci->quirks |= XHCI_EP_LIMIT_QUIRK;
95 xhci->limit_active_eps = 64; 95 xhci->limit_active_eps = 64;
96 xhci->quirks |= XHCI_SW_BW_CHECKING; 96 xhci->quirks |= XHCI_SW_BW_CHECKING;
97 /*
98 * PPT desktop boards DH77EB and DH77DF will power back on after
99 * a few seconds of being shutdown. The fix for this is to
100 * switch the ports from xHCI to EHCI on shutdown. We can't use
101 * DMI information to find those particular boards (since each
102 * vendor will change the board name), so we have to key off all
103 * PPT chipsets.
104 */
105 xhci->quirks |= XHCI_SPURIOUS_REBOOT;
97 } 106 }
98 if (pdev->vendor == PCI_VENDOR_ID_ETRON && 107 if (pdev->vendor == PCI_VENDOR_ID_ETRON &&
99 pdev->device == PCI_DEVICE_ID_ASROCK_P67) { 108 pdev->device == PCI_DEVICE_ID_ASROCK_P67) {
100 xhci->quirks |= XHCI_RESET_ON_RESUME; 109 xhci->quirks |= XHCI_RESET_ON_RESUME;
101 xhci_dbg(xhci, "QUIRK: Resetting on resume\n"); 110 xhci_dbg(xhci, "QUIRK: Resetting on resume\n");
111 xhci->quirks |= XHCI_TRUST_TX_LENGTH;
102 } 112 }
103 if (pdev->vendor == PCI_VENDOR_ID_VIA) 113 if (pdev->vendor == PCI_VENDOR_ID_VIA)
104 xhci->quirks |= XHCI_RESET_ON_RESUME; 114 xhci->quirks |= XHCI_RESET_ON_RESUME;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 8275645889da..643c2f3f3e73 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -145,29 +145,37 @@ static void next_trb(struct xhci_hcd *xhci,
145 */ 145 */
146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring) 146static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring)
147{ 147{
148 union xhci_trb *next;
149 unsigned long long addr; 148 unsigned long long addr;
150 149
151 ring->deq_updates++; 150 ring->deq_updates++;
152 151
153 /* If this is not event ring, there is one more usable TRB */ 152 /*
153 * If this is not event ring, and the dequeue pointer
154 * is not on a link TRB, there is one more usable TRB
155 */
154 if (ring->type != TYPE_EVENT && 156 if (ring->type != TYPE_EVENT &&
155 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) 157 !last_trb(xhci, ring, ring->deq_seg, ring->dequeue))
156 ring->num_trbs_free++; 158 ring->num_trbs_free++;
157 next = ++(ring->dequeue);
158 159
159 /* Update the dequeue pointer further if that was a link TRB or we're at 160 do {
160 * the end of an event ring segment (which doesn't have link TRBS) 161 /*
161 */ 162 * Update the dequeue pointer further if that was a link TRB or
162 while (last_trb(xhci, ring, ring->deq_seg, next)) { 163 * we're at the end of an event ring segment (which doesn't have
163 if (ring->type == TYPE_EVENT && last_trb_on_last_seg(xhci, 164 * link TRBS)
164 ring, ring->deq_seg, next)) { 165 */
165 ring->cycle_state = (ring->cycle_state ? 0 : 1); 166 if (last_trb(xhci, ring, ring->deq_seg, ring->dequeue)) {
167 if (ring->type == TYPE_EVENT &&
168 last_trb_on_last_seg(xhci, ring,
169 ring->deq_seg, ring->dequeue)) {
170 ring->cycle_state = (ring->cycle_state ? 0 : 1);
171 }
172 ring->deq_seg = ring->deq_seg->next;
173 ring->dequeue = ring->deq_seg->trbs;
174 } else {
175 ring->dequeue++;
166 } 176 }
167 ring->deq_seg = ring->deq_seg->next; 177 } while (last_trb(xhci, ring, ring->deq_seg, ring->dequeue));
168 ring->dequeue = ring->deq_seg->trbs; 178
169 next = ring->dequeue;
170 }
171 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); 179 addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
172} 180}
173 181
@@ -2073,8 +2081,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
2073 if (xhci->quirks & XHCI_TRUST_TX_LENGTH) 2081 if (xhci->quirks & XHCI_TRUST_TX_LENGTH)
2074 trb_comp_code = COMP_SHORT_TX; 2082 trb_comp_code = COMP_SHORT_TX;
2075 else 2083 else
2076 xhci_warn(xhci, "WARN Successful completion on short TX: " 2084 xhci_warn_ratelimited(xhci,
2077 "needs XHCI_TRUST_TX_LENGTH quirk?\n"); 2085 "WARN Successful completion on short TX: needs XHCI_TRUST_TX_LENGTH quirk?\n");
2078 case COMP_SHORT_TX: 2086 case COMP_SHORT_TX:
2079 break; 2087 break;
2080 case COMP_STOP: 2088 case COMP_STOP:
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7648b2d4b268..c59d5b5b6c7d 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -166,7 +166,7 @@ int xhci_reset(struct xhci_hcd *xhci)
166 xhci_writel(xhci, command, &xhci->op_regs->command); 166 xhci_writel(xhci, command, &xhci->op_regs->command);
167 167
168 ret = handshake(xhci, &xhci->op_regs->command, 168 ret = handshake(xhci, &xhci->op_regs->command,
169 CMD_RESET, 0, 250 * 1000); 169 CMD_RESET, 0, 10 * 1000 * 1000);
170 if (ret) 170 if (ret)
171 return ret; 171 return ret;
172 172
@@ -175,7 +175,8 @@ int xhci_reset(struct xhci_hcd *xhci)
175 * xHCI cannot write to any doorbells or operational registers other 175 * xHCI cannot write to any doorbells or operational registers other
176 * than status until the "Controller Not Ready" flag is cleared. 176 * than status until the "Controller Not Ready" flag is cleared.
177 */ 177 */
178 ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000); 178 ret = handshake(xhci, &xhci->op_regs->status,
179 STS_CNR, 0, 10 * 1000 * 1000);
179 180
180 for (i = 0; i < 2; ++i) { 181 for (i = 0; i < 2; ++i) {
181 xhci->bus_state[i].port_c_suspend = 0; 182 xhci->bus_state[i].port_c_suspend = 0;
@@ -658,6 +659,9 @@ void xhci_shutdown(struct usb_hcd *hcd)
658{ 659{
659 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 660 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
660 661
662 if (xhci->quirks && XHCI_SPURIOUS_REBOOT)
663 usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
664
661 spin_lock_irq(&xhci->lock); 665 spin_lock_irq(&xhci->lock);
662 xhci_halt(xhci); 666 xhci_halt(xhci);
663 spin_unlock_irq(&xhci->lock); 667 spin_unlock_irq(&xhci->lock);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index 55c0785810c9..c713256297ac 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1494,6 +1494,7 @@ struct xhci_hcd {
1494#define XHCI_TRUST_TX_LENGTH (1 << 10) 1494#define XHCI_TRUST_TX_LENGTH (1 << 10)
1495#define XHCI_LPM_SUPPORT (1 << 11) 1495#define XHCI_LPM_SUPPORT (1 << 11)
1496#define XHCI_INTEL_HOST (1 << 12) 1496#define XHCI_INTEL_HOST (1 << 12)
1497#define XHCI_SPURIOUS_REBOOT (1 << 13)
1497 unsigned int num_active_eps; 1498 unsigned int num_active_eps;
1498 unsigned int limit_active_eps; 1499 unsigned int limit_active_eps;
1499 /* There are two roothubs to keep track of bus suspend info for */ 1500 /* There are two roothubs to keep track of bus suspend info for */
@@ -1537,6 +1538,8 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci)
1537 dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args) 1538 dev_err(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1538#define xhci_warn(xhci, fmt, args...) \ 1539#define xhci_warn(xhci, fmt, args...) \
1539 dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args) 1540 dev_warn(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1541#define xhci_warn_ratelimited(xhci, fmt, args...) \
1542 dev_warn_ratelimited(xhci_to_hcd(xhci)->self.controller , fmt , ## args)
1540 1543
1541/* TODO: copied from ehci.h - can be refactored? */ 1544/* TODO: copied from ehci.h - can be refactored? */
1542/* xHCI spec says all registers are little endian */ 1545/* xHCI spec says all registers are little endian */
diff --git a/drivers/usb/musb/Kconfig b/drivers/usb/musb/Kconfig
index ef0c3f9f0947..6259f0d99324 100644
--- a/drivers/usb/musb/Kconfig
+++ b/drivers/usb/musb/Kconfig
@@ -8,7 +8,7 @@ config USB_MUSB_HDRC
8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)' 8 tristate 'Inventra Highspeed Dual Role Controller (TI, ADI, ...)'
9 depends on USB && USB_GADGET 9 depends on USB && USB_GADGET
10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN) 10 select NOP_USB_XCEIV if (ARCH_DAVINCI || MACH_OMAP3EVM || BLACKFIN)
11 select NOP_USB_XCEIV if (SOC_OMAPTI81XX || SOC_OMAPAM33XX) 11 select NOP_USB_XCEIV if (SOC_TI81XX || SOC_AM33XX)
12 select TWL4030_USB if MACH_OMAP_3430SDP 12 select TWL4030_USB if MACH_OMAP_3430SDP
13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA 13 select TWL6030_USB if MACH_OMAP_4430SDP || MACH_OMAP4_PANDA
14 select USB_OTG_UTILS 14 select USB_OTG_UTILS
@@ -57,7 +57,7 @@ config USB_MUSB_AM35X
57 57
58config USB_MUSB_DSPS 58config USB_MUSB_DSPS
59 tristate "TI DSPS platforms" 59 tristate "TI DSPS platforms"
60 depends on SOC_OMAPTI81XX || SOC_OMAPAM33XX 60 depends on SOC_TI81XX || SOC_AM33XX
61 61
62config USB_MUSB_BLACKFIN 62config USB_MUSB_BLACKFIN
63 tristate "Blackfin" 63 tristate "Blackfin"
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 217808d9fbe1..494772fc9e23 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -479,9 +479,9 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue *glue, u8 id)
479 ret = -ENODEV; 479 ret = -ENODEV;
480 goto err0; 480 goto err0;
481 } 481 }
482 strcpy((u8 *)res->name, "mc");
483 res->parent = NULL; 482 res->parent = NULL;
484 resources[1] = *res; 483 resources[1] = *res;
484 resources[1].name = "mc";
485 485
486 /* allocate the child platform device */ 486 /* allocate the child platform device */
487 musb = platform_device_alloc("musb-hdrc", -1); 487 musb = platform_device_alloc("musb-hdrc", -1);
@@ -566,27 +566,28 @@ static int __devinit dsps_probe(struct platform_device *pdev)
566 } 566 }
567 platform_set_drvdata(pdev, glue); 567 platform_set_drvdata(pdev, glue);
568 568
569 /* create the child platform device for first instances of musb */
570 ret = dsps_create_musb_pdev(glue, 0);
571 if (ret != 0) {
572 dev_err(&pdev->dev, "failed to create child pdev\n");
573 goto err2;
574 }
575
576 /* enable the usbss clocks */ 569 /* enable the usbss clocks */
577 pm_runtime_enable(&pdev->dev); 570 pm_runtime_enable(&pdev->dev);
578 571
579 ret = pm_runtime_get_sync(&pdev->dev); 572 ret = pm_runtime_get_sync(&pdev->dev);
580 if (ret < 0) { 573 if (ret < 0) {
581 dev_err(&pdev->dev, "pm_runtime_get_sync FAILED"); 574 dev_err(&pdev->dev, "pm_runtime_get_sync FAILED");
575 goto err2;
576 }
577
578 /* create the child platform device for first instances of musb */
579 ret = dsps_create_musb_pdev(glue, 0);
580 if (ret != 0) {
581 dev_err(&pdev->dev, "failed to create child pdev\n");
582 goto err3; 582 goto err3;
583 } 583 }
584 584
585 return 0; 585 return 0;
586 586
587err3: 587err3:
588 pm_runtime_disable(&pdev->dev); 588 pm_runtime_put(&pdev->dev);
589err2: 589err2:
590 pm_runtime_disable(&pdev->dev);
590 kfree(glue->wrp); 591 kfree(glue->wrp);
591err1: 592err1:
592 kfree(glue); 593 kfree(glue);
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 8c9bb1ad3069..681da06170c2 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -603,12 +603,12 @@ static int usbhsc_resume(struct device *dev)
603 struct usbhs_priv *priv = dev_get_drvdata(dev); 603 struct usbhs_priv *priv = dev_get_drvdata(dev);
604 struct platform_device *pdev = usbhs_priv_to_pdev(priv); 604 struct platform_device *pdev = usbhs_priv_to_pdev(priv);
605 605
606 usbhs_platform_call(priv, phy_reset, pdev);
607
608 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL)) 606 if (!usbhsc_flags_has(priv, USBHSF_RUNTIME_PWCTRL))
609 usbhsc_power_ctrl(priv, 1); 607 usbhsc_power_ctrl(priv, 1);
610 608
611 usbhsc_hotplug(priv); 609 usbhs_platform_call(priv, phy_reset, pdev);
610
611 usbhsc_drvcllbck_notify_hotplug(pdev);
612 612
613 return 0; 613 return 0;
614} 614}
diff --git a/drivers/usb/renesas_usbhs/mod_host.c b/drivers/usb/renesas_usbhs/mod_host.c
index 1834cf50888c..9b69a1323294 100644
--- a/drivers/usb/renesas_usbhs/mod_host.c
+++ b/drivers/usb/renesas_usbhs/mod_host.c
@@ -1266,6 +1266,12 @@ static int usbhsh_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
1266 return ret; 1266 return ret;
1267} 1267}
1268 1268
1269static int usbhsh_bus_nop(struct usb_hcd *hcd)
1270{
1271 /* nothing to do */
1272 return 0;
1273}
1274
1269static struct hc_driver usbhsh_driver = { 1275static struct hc_driver usbhsh_driver = {
1270 .description = usbhsh_hcd_name, 1276 .description = usbhsh_hcd_name,
1271 .hcd_priv_size = sizeof(struct usbhsh_hpriv), 1277 .hcd_priv_size = sizeof(struct usbhsh_hpriv),
@@ -1290,6 +1296,8 @@ static struct hc_driver usbhsh_driver = {
1290 */ 1296 */
1291 .hub_status_data = usbhsh_hub_status_data, 1297 .hub_status_data = usbhsh_hub_status_data,
1292 .hub_control = usbhsh_hub_control, 1298 .hub_control = usbhsh_hub_control,
1299 .bus_suspend = usbhsh_bus_nop,
1300 .bus_resume = usbhsh_bus_nop,
1293}; 1301};
1294 1302
1295/* 1303/*
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index f398d1e34474..c15f2e7cefc7 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -61,18 +61,23 @@ static int usb_serial_device_probe(struct device *dev)
61 goto exit; 61 goto exit;
62 } 62 }
63 63
64 /* make sure suspend/resume doesn't race against port_probe */
65 retval = usb_autopm_get_interface(port->serial->interface);
66 if (retval)
67 goto exit;
68
64 driver = port->serial->type; 69 driver = port->serial->type;
65 if (driver->port_probe) { 70 if (driver->port_probe) {
66 retval = driver->port_probe(port); 71 retval = driver->port_probe(port);
67 if (retval) 72 if (retval)
68 goto exit; 73 goto exit_with_autopm;
69 } 74 }
70 75
71 retval = device_create_file(dev, &dev_attr_port_number); 76 retval = device_create_file(dev, &dev_attr_port_number);
72 if (retval) { 77 if (retval) {
73 if (driver->port_remove) 78 if (driver->port_remove)
74 retval = driver->port_remove(port); 79 retval = driver->port_remove(port);
75 goto exit; 80 goto exit_with_autopm;
76 } 81 }
77 82
78 minor = port->number; 83 minor = port->number;
@@ -81,6 +86,8 @@ static int usb_serial_device_probe(struct device *dev)
81 "%s converter now attached to ttyUSB%d\n", 86 "%s converter now attached to ttyUSB%d\n",
82 driver->description, minor); 87 driver->description, minor);
83 88
89exit_with_autopm:
90 usb_autopm_put_interface(port->serial->interface);
84exit: 91exit:
85 return retval; 92 return retval;
86} 93}
@@ -96,6 +103,9 @@ static int usb_serial_device_remove(struct device *dev)
96 if (!port) 103 if (!port)
97 return -ENODEV; 104 return -ENODEV;
98 105
106 /* make sure suspend/resume doesn't race against port_remove */
107 usb_autopm_get_interface(port->serial->interface);
108
99 device_remove_file(&port->dev, &dev_attr_port_number); 109 device_remove_file(&port->dev, &dev_attr_port_number);
100 110
101 driver = port->serial->type; 111 driver = port->serial->type;
@@ -107,6 +117,7 @@ static int usb_serial_device_remove(struct device *dev)
107 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n", 117 dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
108 driver->description, minor); 118 driver->description, minor);
109 119
120 usb_autopm_put_interface(port->serial->interface);
110 return retval; 121 return retval;
111} 122}
112 123
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index bc912e5a3beb..5620db6469e5 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -811,6 +811,7 @@ static struct usb_device_id id_table_combined [] = {
811 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) }, 811 { USB_DEVICE(LARSENBRUSGAARD_VID, LB_ALTITRACK_PID) },
812 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) }, 812 { USB_DEVICE(GN_OTOMETRICS_VID, AURICAL_USB_PID) },
813 { USB_DEVICE(PI_VID, PI_E861_PID) }, 813 { USB_DEVICE(PI_VID, PI_E861_PID) },
814 { USB_DEVICE(KONDO_VID, KONDO_USB_SERIAL_PID) },
814 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, 815 { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) },
815 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), 816 { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID),
816 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, 817 .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 5661c7e2d415..5dd96ca6c380 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -795,6 +795,13 @@
795#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */ 795#define PI_E861_PID 0x1008 /* E-861 piezo controller USB connection */
796 796
797/* 797/*
798 * Kondo Kagaku Co.Ltd.
799 * http://www.kondo-robot.com/EN
800 */
801#define KONDO_VID 0x165c
802#define KONDO_USB_SERIAL_PID 0x0002
803
804/*
798 * Bayer Ascensia Contour blood glucose meter USB-converter cable. 805 * Bayer Ascensia Contour blood glucose meter USB-converter cable.
799 * http://winglucofacts.com/cables/ 806 * http://winglucofacts.com/cables/
800 */ 807 */
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c
index 5811d34b6c6b..2cb30c535839 100644
--- a/drivers/usb/serial/ipw.c
+++ b/drivers/usb/serial/ipw.c
@@ -227,7 +227,6 @@ static void ipw_release(struct usb_serial *serial)
227{ 227{
228 struct usb_wwan_intf_private *data = usb_get_serial_data(serial); 228 struct usb_wwan_intf_private *data = usb_get_serial_data(serial);
229 229
230 usb_wwan_release(serial);
231 usb_set_serial_data(serial, NULL); 230 usb_set_serial_data(serial, NULL);
232 kfree(data); 231 kfree(data);
233} 232}
@@ -309,12 +308,12 @@ static struct usb_serial_driver ipw_device = {
309 .description = "IPWireless converter", 308 .description = "IPWireless converter",
310 .id_table = id_table, 309 .id_table = id_table,
311 .num_ports = 1, 310 .num_ports = 1,
312 .disconnect = usb_wwan_disconnect,
313 .open = ipw_open, 311 .open = ipw_open,
314 .close = ipw_close, 312 .close = ipw_close,
315 .probe = ipw_probe, 313 .probe = ipw_probe,
316 .attach = usb_wwan_startup, 314 .attach = usb_wwan_startup,
317 .release = ipw_release, 315 .release = ipw_release,
316 .port_remove = usb_wwan_port_remove,
318 .dtr_rts = ipw_dtr_rts, 317 .dtr_rts = ipw_dtr_rts,
319 .write = usb_wwan_write, 318 .write = usb_wwan_write,
320}; 319};
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 57eca2448424..2f6da1e89bfa 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -82,8 +82,7 @@
82 * Defines used for sending commands to port 82 * Defines used for sending commands to port
83 */ 83 */
84 84
85#define WAIT_FOR_EVER (HZ * 0) /* timeout urb is wait for ever */ 85#define MOS_WDR_TIMEOUT 5000 /* default urb timeout */
86#define MOS_WDR_TIMEOUT (HZ * 5) /* default urb timeout */
87 86
88#define MOS_PORT1 0x0200 87#define MOS_PORT1 0x0200
89#define MOS_PORT2 0x0300 88#define MOS_PORT2 0x0300
@@ -1232,9 +1231,12 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty)
1232 return 0; 1231 return 0;
1233 1232
1234 spin_lock_irqsave(&mos7840_port->pool_lock, flags); 1233 spin_lock_irqsave(&mos7840_port->pool_lock, flags);
1235 for (i = 0; i < NUM_URBS; ++i) 1234 for (i = 0; i < NUM_URBS; ++i) {
1236 if (mos7840_port->busy[i]) 1235 if (mos7840_port->busy[i]) {
1237 chars += URB_TRANSFER_BUFFER_SIZE; 1236 struct urb *urb = mos7840_port->write_urb_pool[i];
1237 chars += urb->transfer_buffer_length;
1238 }
1239 }
1238 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 1240 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
1239 dbg("%s - returns %d", __func__, chars); 1241 dbg("%s - returns %d", __func__, chars);
1240 return chars; 1242 return chars;
@@ -1344,7 +1346,7 @@ static void mos7840_close(struct usb_serial_port *port)
1344static void mos7840_block_until_chase_response(struct tty_struct *tty, 1346static void mos7840_block_until_chase_response(struct tty_struct *tty,
1345 struct moschip_port *mos7840_port) 1347 struct moschip_port *mos7840_port)
1346{ 1348{
1347 int timeout = 1 * HZ; 1349 int timeout = msecs_to_jiffies(1000);
1348 int wait = 10; 1350 int wait = 10;
1349 int count; 1351 int count;
1350 1352
@@ -2672,7 +2674,7 @@ static int mos7840_startup(struct usb_serial *serial)
2672 2674
2673 /* setting configuration feature to one */ 2675 /* setting configuration feature to one */
2674 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0), 2676 usb_control_msg(serial->dev, usb_sndctrlpipe(serial->dev, 0),
2675 (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, 5 * HZ); 2677 (__u8) 0x03, 0x00, 0x01, 0x00, NULL, 0x00, MOS_WDR_TIMEOUT);
2676 return 0; 2678 return 0;
2677error: 2679error:
2678 for (/* nothing */; i >= 0; i--) { 2680 for (/* nothing */; i >= 0; i--) {
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
index 08ff9b862049..cc40f47ecea1 100644
--- a/drivers/usb/serial/option.c
+++ b/drivers/usb/serial/option.c
@@ -80,85 +80,9 @@ static void option_instat_callback(struct urb *urb);
80#define OPTION_PRODUCT_GTM380_MODEM 0x7201 80#define OPTION_PRODUCT_GTM380_MODEM 0x7201
81 81
82#define HUAWEI_VENDOR_ID 0x12D1 82#define HUAWEI_VENDOR_ID 0x12D1
83#define HUAWEI_PRODUCT_E600 0x1001
84#define HUAWEI_PRODUCT_E220 0x1003
85#define HUAWEI_PRODUCT_E220BIS 0x1004
86#define HUAWEI_PRODUCT_E1401 0x1401
87#define HUAWEI_PRODUCT_E1402 0x1402
88#define HUAWEI_PRODUCT_E1403 0x1403
89#define HUAWEI_PRODUCT_E1404 0x1404
90#define HUAWEI_PRODUCT_E1405 0x1405
91#define HUAWEI_PRODUCT_E1406 0x1406
92#define HUAWEI_PRODUCT_E1407 0x1407
93#define HUAWEI_PRODUCT_E1408 0x1408
94#define HUAWEI_PRODUCT_E1409 0x1409
95#define HUAWEI_PRODUCT_E140A 0x140A
96#define HUAWEI_PRODUCT_E140B 0x140B
97#define HUAWEI_PRODUCT_E140C 0x140C
98#define HUAWEI_PRODUCT_E140D 0x140D
99#define HUAWEI_PRODUCT_E140E 0x140E
100#define HUAWEI_PRODUCT_E140F 0x140F
101#define HUAWEI_PRODUCT_E1410 0x1410
102#define HUAWEI_PRODUCT_E1411 0x1411
103#define HUAWEI_PRODUCT_E1412 0x1412
104#define HUAWEI_PRODUCT_E1413 0x1413
105#define HUAWEI_PRODUCT_E1414 0x1414
106#define HUAWEI_PRODUCT_E1415 0x1415
107#define HUAWEI_PRODUCT_E1416 0x1416
108#define HUAWEI_PRODUCT_E1417 0x1417
109#define HUAWEI_PRODUCT_E1418 0x1418
110#define HUAWEI_PRODUCT_E1419 0x1419
111#define HUAWEI_PRODUCT_E141A 0x141A
112#define HUAWEI_PRODUCT_E141B 0x141B
113#define HUAWEI_PRODUCT_E141C 0x141C
114#define HUAWEI_PRODUCT_E141D 0x141D
115#define HUAWEI_PRODUCT_E141E 0x141E
116#define HUAWEI_PRODUCT_E141F 0x141F
117#define HUAWEI_PRODUCT_E1420 0x1420
118#define HUAWEI_PRODUCT_E1421 0x1421
119#define HUAWEI_PRODUCT_E1422 0x1422
120#define HUAWEI_PRODUCT_E1423 0x1423
121#define HUAWEI_PRODUCT_E1424 0x1424
122#define HUAWEI_PRODUCT_E1425 0x1425
123#define HUAWEI_PRODUCT_E1426 0x1426
124#define HUAWEI_PRODUCT_E1427 0x1427
125#define HUAWEI_PRODUCT_E1428 0x1428
126#define HUAWEI_PRODUCT_E1429 0x1429
127#define HUAWEI_PRODUCT_E142A 0x142A
128#define HUAWEI_PRODUCT_E142B 0x142B
129#define HUAWEI_PRODUCT_E142C 0x142C
130#define HUAWEI_PRODUCT_E142D 0x142D
131#define HUAWEI_PRODUCT_E142E 0x142E
132#define HUAWEI_PRODUCT_E142F 0x142F
133#define HUAWEI_PRODUCT_E1430 0x1430
134#define HUAWEI_PRODUCT_E1431 0x1431
135#define HUAWEI_PRODUCT_E1432 0x1432
136#define HUAWEI_PRODUCT_E1433 0x1433
137#define HUAWEI_PRODUCT_E1434 0x1434
138#define HUAWEI_PRODUCT_E1435 0x1435
139#define HUAWEI_PRODUCT_E1436 0x1436
140#define HUAWEI_PRODUCT_E1437 0x1437
141#define HUAWEI_PRODUCT_E1438 0x1438
142#define HUAWEI_PRODUCT_E1439 0x1439
143#define HUAWEI_PRODUCT_E143A 0x143A
144#define HUAWEI_PRODUCT_E143B 0x143B
145#define HUAWEI_PRODUCT_E143C 0x143C
146#define HUAWEI_PRODUCT_E143D 0x143D
147#define HUAWEI_PRODUCT_E143E 0x143E
148#define HUAWEI_PRODUCT_E143F 0x143F
149#define HUAWEI_PRODUCT_K4505 0x1464 83#define HUAWEI_PRODUCT_K4505 0x1464
150#define HUAWEI_PRODUCT_K3765 0x1465 84#define HUAWEI_PRODUCT_K3765 0x1465
151#define HUAWEI_PRODUCT_E14AC 0x14AC
152#define HUAWEI_PRODUCT_K3806 0x14AE
153#define HUAWEI_PRODUCT_K4605 0x14C6 85#define HUAWEI_PRODUCT_K4605 0x14C6
154#define HUAWEI_PRODUCT_K5005 0x14C8
155#define HUAWEI_PRODUCT_K3770 0x14C9
156#define HUAWEI_PRODUCT_K3771 0x14CA
157#define HUAWEI_PRODUCT_K4510 0x14CB
158#define HUAWEI_PRODUCT_K4511 0x14CC
159#define HUAWEI_PRODUCT_ETS1220 0x1803
160#define HUAWEI_PRODUCT_E353 0x1506
161#define HUAWEI_PRODUCT_E173S 0x1C05
162 86
163#define QUANTA_VENDOR_ID 0x0408 87#define QUANTA_VENDOR_ID 0x0408
164#define QUANTA_PRODUCT_Q101 0xEA02 88#define QUANTA_PRODUCT_Q101 0xEA02
@@ -615,104 +539,123 @@ static const struct usb_device_id option_ids[] = {
615 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) }, 539 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLX) },
616 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) }, 540 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GKE) },
617 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) }, 541 { USB_DEVICE(QUANTA_VENDOR_ID, QUANTA_PRODUCT_GLE) },
618 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E600, 0xff, 0xff, 0xff) },
619 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220, 0xff, 0xff, 0xff) },
620 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E220BIS, 0xff, 0xff, 0xff) },
621 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1401, 0xff, 0xff, 0xff) },
622 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1402, 0xff, 0xff, 0xff) },
623 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1403, 0xff, 0xff, 0xff) },
624 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1404, 0xff, 0xff, 0xff) },
625 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1405, 0xff, 0xff, 0xff) },
626 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1406, 0xff, 0xff, 0xff) },
627 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1407, 0xff, 0xff, 0xff) },
628 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1408, 0xff, 0xff, 0xff) },
629 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1409, 0xff, 0xff, 0xff) },
630 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140A, 0xff, 0xff, 0xff) },
631 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140B, 0xff, 0xff, 0xff) },
632 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140C, 0xff, 0xff, 0xff) },
633 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140D, 0xff, 0xff, 0xff) },
634 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140E, 0xff, 0xff, 0xff) },
635 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E140F, 0xff, 0xff, 0xff) },
636 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1410, 0xff, 0xff, 0xff) },
637 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1411, 0xff, 0xff, 0xff) },
638 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1412, 0xff, 0xff, 0xff) },
639 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1413, 0xff, 0xff, 0xff) },
640 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1414, 0xff, 0xff, 0xff) },
641 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1415, 0xff, 0xff, 0xff) },
642 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1416, 0xff, 0xff, 0xff) },
643 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1417, 0xff, 0xff, 0xff) },
644 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1418, 0xff, 0xff, 0xff) },
645 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1419, 0xff, 0xff, 0xff) },
646 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141A, 0xff, 0xff, 0xff) },
647 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141B, 0xff, 0xff, 0xff) },
648 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141C, 0xff, 0xff, 0xff) },
649 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141D, 0xff, 0xff, 0xff) },
650 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141E, 0xff, 0xff, 0xff) },
651 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E141F, 0xff, 0xff, 0xff) },
652 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1420, 0xff, 0xff, 0xff) },
653 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1421, 0xff, 0xff, 0xff) },
654 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1422, 0xff, 0xff, 0xff) },
655 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1423, 0xff, 0xff, 0xff) },
656 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1424, 0xff, 0xff, 0xff) },
657 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1425, 0xff, 0xff, 0xff) },
658 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1426, 0xff, 0xff, 0xff) },
659 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1427, 0xff, 0xff, 0xff) },
660 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1428, 0xff, 0xff, 0xff) },
661 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1429, 0xff, 0xff, 0xff) },
662 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142A, 0xff, 0xff, 0xff) },
663 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142B, 0xff, 0xff, 0xff) },
664 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142C, 0xff, 0xff, 0xff) },
665 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142D, 0xff, 0xff, 0xff) },
666 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142E, 0xff, 0xff, 0xff) },
667 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E142F, 0xff, 0xff, 0xff) },
668 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1430, 0xff, 0xff, 0xff) },
669 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1431, 0xff, 0xff, 0xff) },
670 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1432, 0xff, 0xff, 0xff) },
671 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1433, 0xff, 0xff, 0xff) },
672 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1434, 0xff, 0xff, 0xff) },
673 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1435, 0xff, 0xff, 0xff) },
674 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1436, 0xff, 0xff, 0xff) },
675 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1437, 0xff, 0xff, 0xff) },
676 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1438, 0xff, 0xff, 0xff) },
677 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1439, 0xff, 0xff, 0xff) },
678 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143A, 0xff, 0xff, 0xff) },
679 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143B, 0xff, 0xff, 0xff) },
680 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143C, 0xff, 0xff, 0xff) },
681 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143D, 0xff, 0xff, 0xff) },
682 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143E, 0xff, 0xff, 0xff) },
683 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E143F, 0xff, 0xff, 0xff) },
684 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S, 0xff, 0xff, 0xff) },
685 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff), 542 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4505, 0xff, 0xff, 0xff),
686 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 543 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
687 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff), 544 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3765, 0xff, 0xff, 0xff),
688 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 545 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
689 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ETS1220, 0xff, 0xff, 0xff) },
690 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E14AC, 0xff, 0xff, 0xff) },
691 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3806, 0xff, 0xff, 0xff) },
692 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff), 546 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0xff, 0xff),
693 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist }, 547 .driver_info = (kernel_ulong_t) &huawei_cdc12_blacklist },
694 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x31) }, 548 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0xff, 0xff) },
695 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4605, 0xff, 0x01, 0x32) }, 549 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x01) },
696 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x31) }, 550 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x02) },
697 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x32) }, 551 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x03) },
698 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K5005, 0xff, 0x01, 0x33) }, 552 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x04) },
699 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x31) }, 553 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x05) },
700 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3770, 0xff, 0x02, 0x32) }, 554 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x06) },
701 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x31) }, 555 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0A) },
702 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K3771, 0xff, 0x02, 0x32) }, 556 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0B) },
703 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x31) }, 557 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0D) },
704 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4510, 0xff, 0x01, 0x32) }, 558 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0E) },
705 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x31) }, 559 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x0F) },
706 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_K4511, 0xff, 0x01, 0x32) }, 560 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x10) },
707 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x01) }, 561 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x12) },
708 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x02) }, 562 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x13) },
709 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x03) }, 563 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x14) },
710 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x10) }, 564 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x15) },
711 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x12) }, 565 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x17) },
712 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x01, 0x13) }, 566 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x18) },
713 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x01) }, /* E398 3G Modem */ 567 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x19) },
714 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x02) }, /* E398 3G PC UI Interface */ 568 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1A) },
715 { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E353, 0xff, 0x02, 0x03) }, /* E398 3G Application Interface */ 569 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1B) },
570 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x1C) },
571 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x31) },
572 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x32) },
573 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x33) },
574 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x34) },
575 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x35) },
576 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x36) },
577 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3A) },
578 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3B) },
579 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3D) },
580 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3E) },
581 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x3F) },
582 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x48) },
583 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x49) },
584 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4A) },
585 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4B) },
586 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x4C) },
587 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x61) },
588 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x62) },
589 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x63) },
590 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x64) },
591 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x65) },
592 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x66) },
593 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6A) },
594 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6B) },
595 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) },
596 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) },
597 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) },
598 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) },
599 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) },
600 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) },
601 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7B) },
602 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7C) },
603 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x01) },
604 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x02) },
605 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x03) },
606 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x04) },
607 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x05) },
608 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x06) },
609 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0A) },
610 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0B) },
611 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0D) },
612 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0E) },
613 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x0F) },
614 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x10) },
615 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x12) },
616 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x13) },
617 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x14) },
618 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x15) },
619 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x17) },
620 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x18) },
621 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x19) },
622 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1A) },
623 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1B) },
624 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x1C) },
625 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x31) },
626 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x32) },
627 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x33) },
628 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x34) },
629 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x35) },
630 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x36) },
631 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3A) },
632 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3B) },
633 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3D) },
634 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3E) },
635 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x3F) },
636 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x48) },
637 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x49) },
638 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4A) },
639 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4B) },
640 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x4C) },
641 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x61) },
642 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x62) },
643 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x63) },
644 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x64) },
645 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x65) },
646 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x66) },
647 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6A) },
648 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6B) },
649 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) },
650 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) },
651 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) },
652 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) },
653 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) },
654 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) },
655 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7B) },
656 { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7C) },
657
658
716 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) }, 659 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V640) },
717 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) }, 660 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V620) },
718 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) }, 661 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_V740) },
@@ -943,6 +886,8 @@ static const struct usb_device_id option_ids[] = {
943 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff), 886 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
944 .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, 887 .driver_info = (kernel_ulong_t)&net_intf4_blacklist },
945 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) }, 888 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
889 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1018, 0xff, 0xff, 0xff),
890 .driver_info = (kernel_ulong_t)&net_intf3_blacklist },
946 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) }, 891 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1057, 0xff, 0xff, 0xff) },
947 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) }, 892 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1058, 0xff, 0xff, 0xff) },
948 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) }, 893 { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1059, 0xff, 0xff, 0xff) },
@@ -1297,8 +1242,8 @@ static struct usb_serial_driver option_1port_device = {
1297 .tiocmset = usb_wwan_tiocmset, 1242 .tiocmset = usb_wwan_tiocmset,
1298 .ioctl = usb_wwan_ioctl, 1243 .ioctl = usb_wwan_ioctl,
1299 .attach = usb_wwan_startup, 1244 .attach = usb_wwan_startup,
1300 .disconnect = usb_wwan_disconnect,
1301 .release = option_release, 1245 .release = option_release,
1246 .port_remove = usb_wwan_port_remove,
1302 .read_int_callback = option_instat_callback, 1247 .read_int_callback = option_instat_callback,
1303#ifdef CONFIG_PM 1248#ifdef CONFIG_PM
1304 .suspend = usb_wwan_suspend, 1249 .suspend = usb_wwan_suspend,
@@ -1414,8 +1359,6 @@ static void option_release(struct usb_serial *serial)
1414 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial); 1359 struct usb_wwan_intf_private *intfdata = usb_get_serial_data(serial);
1415 struct option_private *priv = intfdata->private; 1360 struct option_private *priv = intfdata->private;
1416 1361
1417 usb_wwan_release(serial);
1418
1419 kfree(priv); 1362 kfree(priv);
1420 kfree(intfdata); 1363 kfree(intfdata);
1421} 1364}
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
index 8d103019d6aa..bfd50779f0c9 100644
--- a/drivers/usb/serial/qcserial.c
+++ b/drivers/usb/serial/qcserial.c
@@ -199,43 +199,49 @@ static int qcprobe(struct usb_serial *serial, const struct usb_device_id *id)
199 199
200 /* default to enabling interface */ 200 /* default to enabling interface */
201 altsetting = 0; 201 altsetting = 0;
202 switch (ifnum) {
203 /* Composite mode; don't bind to the QMI/net interface as that
204 * gets handled by other drivers.
205 */
206 202
203 /* Composite mode; don't bind to the QMI/net interface as that
204 * gets handled by other drivers.
205 */
206
207 if (is_gobi1k) {
207 /* Gobi 1K USB layout: 208 /* Gobi 1K USB layout:
208 * 0: serial port (doesn't respond) 209 * 0: serial port (doesn't respond)
209 * 1: serial port (doesn't respond) 210 * 1: serial port (doesn't respond)
210 * 2: AT-capable modem port 211 * 2: AT-capable modem port
211 * 3: QMI/net 212 * 3: QMI/net
212 * 213 */
213 * Gobi 2K+ USB layout: 214 if (ifnum == 2)
215 dev_dbg(dev, "Modem port found\n");
216 else
217 altsetting = -1;
218 } else {
219 /* Gobi 2K+ USB layout:
214 * 0: QMI/net 220 * 0: QMI/net
215 * 1: DM/DIAG (use libqcdm from ModemManager for communication) 221 * 1: DM/DIAG (use libqcdm from ModemManager for communication)
216 * 2: AT-capable modem port 222 * 2: AT-capable modem port
217 * 3: NMEA 223 * 3: NMEA
218 */ 224 */
219 225 switch (ifnum) {
220 case 1: 226 case 0:
221 if (is_gobi1k) 227 /* Don't claim the QMI/net interface */
222 altsetting = -1; 228 altsetting = -1;
223 else 229 break;
230 case 1:
224 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n"); 231 dev_dbg(dev, "Gobi 2K+ DM/DIAG interface found\n");
225 break; 232 break;
226 case 2: 233 case 2:
227 dev_dbg(dev, "Modem port found\n"); 234 dev_dbg(dev, "Modem port found\n");
228 break; 235 break;
229 case 3: 236 case 3:
230 if (is_gobi1k)
231 altsetting = -1;
232 else
233 /* 237 /*
234 * NMEA (serial line 9600 8N1) 238 * NMEA (serial line 9600 8N1)
235 * # echo "\$GPS_START" > /dev/ttyUSBx 239 * # echo "\$GPS_START" > /dev/ttyUSBx
236 * # echo "\$GPS_STOP" > /dev/ttyUSBx 240 * # echo "\$GPS_STOP" > /dev/ttyUSBx
237 */ 241 */
238 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n"); 242 dev_dbg(dev, "Gobi 2K+ NMEA GPS interface found\n");
243 break;
244 }
239 } 245 }
240 246
241done: 247done:
@@ -262,8 +268,7 @@ static void qc_release(struct usb_serial *serial)
262{ 268{
263 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial); 269 struct usb_wwan_intf_private *priv = usb_get_serial_data(serial);
264 270
265 /* Call usb_wwan release & free the private data allocated in qcprobe */ 271 /* Free the private data allocated in qcprobe */
266 usb_wwan_release(serial);
267 usb_set_serial_data(serial, NULL); 272 usb_set_serial_data(serial, NULL);
268 kfree(priv); 273 kfree(priv);
269} 274}
@@ -283,8 +288,8 @@ static struct usb_serial_driver qcdevice = {
283 .write_room = usb_wwan_write_room, 288 .write_room = usb_wwan_write_room,
284 .chars_in_buffer = usb_wwan_chars_in_buffer, 289 .chars_in_buffer = usb_wwan_chars_in_buffer,
285 .attach = usb_wwan_startup, 290 .attach = usb_wwan_startup,
286 .disconnect = usb_wwan_disconnect,
287 .release = qc_release, 291 .release = qc_release,
292 .port_remove = usb_wwan_port_remove,
288#ifdef CONFIG_PM 293#ifdef CONFIG_PM
289 .suspend = usb_wwan_suspend, 294 .suspend = usb_wwan_suspend,
290 .resume = usb_wwan_resume, 295 .resume = usb_wwan_resume,
diff --git a/drivers/usb/serial/usb-wwan.h b/drivers/usb/serial/usb-wwan.h
index c47b6ec03063..1f034d2397c6 100644
--- a/drivers/usb/serial/usb-wwan.h
+++ b/drivers/usb/serial/usb-wwan.h
@@ -9,8 +9,7 @@ extern void usb_wwan_dtr_rts(struct usb_serial_port *port, int on);
9extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port); 9extern int usb_wwan_open(struct tty_struct *tty, struct usb_serial_port *port);
10extern void usb_wwan_close(struct usb_serial_port *port); 10extern void usb_wwan_close(struct usb_serial_port *port);
11extern int usb_wwan_startup(struct usb_serial *serial); 11extern int usb_wwan_startup(struct usb_serial *serial);
12extern void usb_wwan_disconnect(struct usb_serial *serial); 12extern int usb_wwan_port_remove(struct usb_serial_port *port);
13extern void usb_wwan_release(struct usb_serial *serial);
14extern int usb_wwan_write_room(struct tty_struct *tty); 13extern int usb_wwan_write_room(struct tty_struct *tty);
15extern void usb_wwan_set_termios(struct tty_struct *tty, 14extern void usb_wwan_set_termios(struct tty_struct *tty,
16 struct usb_serial_port *port, 15 struct usb_serial_port *port,
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index f35971dff4a5..6855d5ed0331 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -565,62 +565,52 @@ bail_out_error:
565} 565}
566EXPORT_SYMBOL(usb_wwan_startup); 566EXPORT_SYMBOL(usb_wwan_startup);
567 567
568static void stop_read_write_urbs(struct usb_serial *serial) 568int usb_wwan_port_remove(struct usb_serial_port *port)
569{ 569{
570 int i, j; 570 int i;
571 struct usb_serial_port *port;
572 struct usb_wwan_port_private *portdata; 571 struct usb_wwan_port_private *portdata;
573 572
574 /* Stop reading/writing urbs */ 573 portdata = usb_get_serial_port_data(port);
575 for (i = 0; i < serial->num_ports; ++i) { 574 usb_set_serial_port_data(port, NULL);
576 port = serial->port[i]; 575
577 portdata = usb_get_serial_port_data(port); 576 /* Stop reading/writing urbs and free them */
578 for (j = 0; j < N_IN_URB; j++) 577 for (i = 0; i < N_IN_URB; i++) {
579 usb_kill_urb(portdata->in_urbs[j]); 578 usb_kill_urb(portdata->in_urbs[i]);
580 for (j = 0; j < N_OUT_URB; j++) 579 usb_free_urb(portdata->in_urbs[i]);
581 usb_kill_urb(portdata->out_urbs[j]); 580 free_page((unsigned long)portdata->in_buffer[i]);
581 }
582 for (i = 0; i < N_OUT_URB; i++) {
583 usb_kill_urb(portdata->out_urbs[i]);
584 usb_free_urb(portdata->out_urbs[i]);
585 kfree(portdata->out_buffer[i]);
582 } 586 }
583}
584 587
585void usb_wwan_disconnect(struct usb_serial *serial) 588 /* Now free port private data */
586{ 589 kfree(portdata);
587 stop_read_write_urbs(serial); 590 return 0;
588} 591}
589EXPORT_SYMBOL(usb_wwan_disconnect); 592EXPORT_SYMBOL(usb_wwan_port_remove);
590 593
591void usb_wwan_release(struct usb_serial *serial) 594#ifdef CONFIG_PM
595static void stop_read_write_urbs(struct usb_serial *serial)
592{ 596{
593 int i, j; 597 int i, j;
594 struct usb_serial_port *port; 598 struct usb_serial_port *port;
595 struct usb_wwan_port_private *portdata; 599 struct usb_wwan_port_private *portdata;
596 600
597 /* Now free them */ 601 /* Stop reading/writing urbs */
598 for (i = 0; i < serial->num_ports; ++i) { 602 for (i = 0; i < serial->num_ports; ++i) {
599 port = serial->port[i]; 603 port = serial->port[i];
600 portdata = usb_get_serial_port_data(port); 604 portdata = usb_get_serial_port_data(port);
601 605 if (!portdata)
602 for (j = 0; j < N_IN_URB; j++) { 606 continue;
603 usb_free_urb(portdata->in_urbs[j]); 607 for (j = 0; j < N_IN_URB; j++)
604 free_page((unsigned long) 608 usb_kill_urb(portdata->in_urbs[j]);
605 portdata->in_buffer[j]); 609 for (j = 0; j < N_OUT_URB; j++)
606 portdata->in_urbs[j] = NULL; 610 usb_kill_urb(portdata->out_urbs[j]);
607 }
608 for (j = 0; j < N_OUT_URB; j++) {
609 usb_free_urb(portdata->out_urbs[j]);
610 kfree(portdata->out_buffer[j]);
611 portdata->out_urbs[j] = NULL;
612 }
613 }
614
615 /* Now free per port private data */
616 for (i = 0; i < serial->num_ports; i++) {
617 port = serial->port[i];
618 kfree(usb_get_serial_port_data(port));
619 } 611 }
620} 612}
621EXPORT_SYMBOL(usb_wwan_release);
622 613
623#ifdef CONFIG_PM
624int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message) 614int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message)
625{ 615{
626 struct usb_wwan_intf_private *intfdata = serial->private; 616 struct usb_wwan_intf_private *intfdata = serial->private;
@@ -712,7 +702,7 @@ int usb_wwan_resume(struct usb_serial *serial)
712 702
713 /* skip closed ports */ 703 /* skip closed ports */
714 spin_lock_irq(&intfdata->susp_lock); 704 spin_lock_irq(&intfdata->susp_lock);
715 if (!portdata->opened) { 705 if (!portdata || !portdata->opened) {
716 spin_unlock_irq(&intfdata->susp_lock); 706 spin_unlock_irq(&intfdata->susp_lock);
717 continue; 707 continue;
718 } 708 }