diff options
Diffstat (limited to 'drivers/usb')
45 files changed, 425 insertions, 205 deletions
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 3df5005c554d..9bdc6bd73432 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c | |||
@@ -742,7 +742,6 @@ static int ci_hdrc_remove(struct platform_device *pdev) | |||
742 | ci_role_destroy(ci); | 742 | ci_role_destroy(ci); |
743 | ci_hdrc_enter_lpm(ci, true); | 743 | ci_hdrc_enter_lpm(ci, true); |
744 | usb_phy_shutdown(ci->transceiver); | 744 | usb_phy_shutdown(ci->transceiver); |
745 | kfree(ci->hw_bank.regmap); | ||
746 | 745 | ||
747 | return 0; | 746 | return 0; |
748 | } | 747 | } |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e934e19f49f5..077d58ac3dcb 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -60,6 +60,9 @@ static struct acm *acm_table[ACM_TTY_MINORS]; | |||
60 | 60 | ||
61 | static DEFINE_MUTEX(acm_table_lock); | 61 | static DEFINE_MUTEX(acm_table_lock); |
62 | 62 | ||
63 | static void acm_tty_set_termios(struct tty_struct *tty, | ||
64 | struct ktermios *termios_old); | ||
65 | |||
63 | /* | 66 | /* |
64 | * acm_table accessors | 67 | * acm_table accessors |
65 | */ | 68 | */ |
@@ -145,8 +148,15 @@ static int acm_ctrl_msg(struct acm *acm, int request, int value, | |||
145 | /* devices aren't required to support these requests. | 148 | /* devices aren't required to support these requests. |
146 | * the cdc acm descriptor tells whether they do... | 149 | * the cdc acm descriptor tells whether they do... |
147 | */ | 150 | */ |
148 | #define acm_set_control(acm, control) \ | 151 | static inline int acm_set_control(struct acm *acm, int control) |
149 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, control, NULL, 0) | 152 | { |
153 | if (acm->quirks & QUIRK_CONTROL_LINE_STATE) | ||
154 | return -EOPNOTSUPP; | ||
155 | |||
156 | return acm_ctrl_msg(acm, USB_CDC_REQ_SET_CONTROL_LINE_STATE, | ||
157 | control, NULL, 0); | ||
158 | } | ||
159 | |||
150 | #define acm_set_line(acm, line) \ | 160 | #define acm_set_line(acm, line) \ |
151 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) | 161 | acm_ctrl_msg(acm, USB_CDC_REQ_SET_LINE_CODING, 0, line, sizeof *(line)) |
152 | #define acm_send_break(acm, ms) \ | 162 | #define acm_send_break(acm, ms) \ |
@@ -554,6 +564,8 @@ static int acm_port_activate(struct tty_port *port, struct tty_struct *tty) | |||
554 | goto error_submit_urb; | 564 | goto error_submit_urb; |
555 | } | 565 | } |
556 | 566 | ||
567 | acm_tty_set_termios(tty, NULL); | ||
568 | |||
557 | /* | 569 | /* |
558 | * Unthrottle device in case the TTY was closed while throttled. | 570 | * Unthrottle device in case the TTY was closed while throttled. |
559 | */ | 571 | */ |
@@ -980,11 +992,12 @@ static void acm_tty_set_termios(struct tty_struct *tty, | |||
980 | /* FIXME: Needs to clear unsupported bits in the termios */ | 992 | /* FIXME: Needs to clear unsupported bits in the termios */ |
981 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); | 993 | acm->clocal = ((termios->c_cflag & CLOCAL) != 0); |
982 | 994 | ||
983 | if (!newline.dwDTERate) { | 995 | if (C_BAUD(tty) == B0) { |
984 | newline.dwDTERate = acm->line.dwDTERate; | 996 | newline.dwDTERate = acm->line.dwDTERate; |
985 | newctrl &= ~ACM_CTRL_DTR; | 997 | newctrl &= ~ACM_CTRL_DTR; |
986 | } else | 998 | } else if (termios_old && (termios_old->c_cflag & CBAUD) == B0) { |
987 | newctrl |= ACM_CTRL_DTR; | 999 | newctrl |= ACM_CTRL_DTR; |
1000 | } | ||
988 | 1001 | ||
989 | if (newctrl != acm->ctrlout) | 1002 | if (newctrl != acm->ctrlout) |
990 | acm_set_control(acm, acm->ctrlout = newctrl); | 1003 | acm_set_control(acm, acm->ctrlout = newctrl); |
@@ -1314,6 +1327,7 @@ made_compressed_probe: | |||
1314 | tty_port_init(&acm->port); | 1327 | tty_port_init(&acm->port); |
1315 | acm->port.ops = &acm_port_ops; | 1328 | acm->port.ops = &acm_port_ops; |
1316 | init_usb_anchor(&acm->delayed); | 1329 | init_usb_anchor(&acm->delayed); |
1330 | acm->quirks = quirks; | ||
1317 | 1331 | ||
1318 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); | 1332 | buf = usb_alloc_coherent(usb_dev, ctrlsize, GFP_KERNEL, &acm->ctrl_dma); |
1319 | if (!buf) { | 1333 | if (!buf) { |
@@ -1681,6 +1695,9 @@ static const struct usb_device_id acm_ids[] = { | |||
1681 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ | 1695 | { USB_DEVICE(0x0572, 0x1328), /* Shiro / Aztech USB MODEM UM-3100 */ |
1682 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 1696 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
1683 | }, | 1697 | }, |
1698 | { USB_DEVICE(0x20df, 0x0001), /* Simtec Electronics Entropy Key */ | ||
1699 | .driver_info = QUIRK_CONTROL_LINE_STATE, }, | ||
1700 | { USB_DEVICE(0x2184, 0x001c) }, /* GW Instek AFG-2225 */ | ||
1684 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ | 1701 | { USB_DEVICE(0x22b8, 0x6425), /* Motorola MOTOMAGX phones */ |
1685 | }, | 1702 | }, |
1686 | /* Motorola H24 HSPA module: */ | 1703 | /* Motorola H24 HSPA module: */ |
diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index fc75651afe1c..d3251ebd09e2 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h | |||
@@ -121,6 +121,7 @@ struct acm { | |||
121 | unsigned int throttle_req:1; /* throttle requested */ | 121 | unsigned int throttle_req:1; /* throttle requested */ |
122 | u8 bInterval; | 122 | u8 bInterval; |
123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ | 123 | struct usb_anchor delayed; /* writes queued for a device about to be woken */ |
124 | unsigned long quirks; | ||
124 | }; | 125 | }; |
125 | 126 | ||
126 | #define CDC_DATA_INTERFACE_TYPE 0x0a | 127 | #define CDC_DATA_INTERFACE_TYPE 0x0a |
@@ -132,3 +133,4 @@ struct acm { | |||
132 | #define NOT_A_MODEM BIT(3) | 133 | #define NOT_A_MODEM BIT(3) |
133 | #define NO_DATA_INTERFACE BIT(4) | 134 | #define NO_DATA_INTERFACE BIT(4) |
134 | #define IGNORE_DEVICE BIT(5) | 135 | #define IGNORE_DEVICE BIT(5) |
136 | #define QUIRK_CONTROL_LINE_STATE BIT(6) | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index b84fb141e122..a6efb4184f2b 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -2060,6 +2060,8 @@ int usb_alloc_streams(struct usb_interface *interface, | |||
2060 | return -EINVAL; | 2060 | return -EINVAL; |
2061 | if (dev->speed != USB_SPEED_SUPER) | 2061 | if (dev->speed != USB_SPEED_SUPER) |
2062 | return -EINVAL; | 2062 | return -EINVAL; |
2063 | if (dev->state < USB_STATE_CONFIGURED) | ||
2064 | return -ENODEV; | ||
2063 | 2065 | ||
2064 | for (i = 0; i < num_eps; i++) { | 2066 | for (i = 0; i < num_eps; i++) { |
2065 | /* Streams only apply to bulk endpoints. */ | 2067 | /* Streams only apply to bulk endpoints. */ |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 11e80ac31324..b649fef2e35d 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -4468,9 +4468,6 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1, | |||
4468 | if (retval) | 4468 | if (retval) |
4469 | goto fail; | 4469 | goto fail; |
4470 | 4470 | ||
4471 | if (hcd->usb_phy && !hdev->parent) | ||
4472 | usb_phy_notify_connect(hcd->usb_phy, udev->speed); | ||
4473 | |||
4474 | /* | 4471 | /* |
4475 | * Some superspeed devices have finished the link training process | 4472 | * Some superspeed devices have finished the link training process |
4476 | * and attached to a superspeed hub port, but the device descriptor | 4473 | * and attached to a superspeed hub port, but the device descriptor |
@@ -4627,8 +4624,7 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4627 | 4624 | ||
4628 | /* Disconnect any existing devices under this port */ | 4625 | /* Disconnect any existing devices under this port */ |
4629 | if (udev) { | 4626 | if (udev) { |
4630 | if (hcd->usb_phy && !hdev->parent && | 4627 | if (hcd->usb_phy && !hdev->parent) |
4631 | !(portstatus & USB_PORT_STAT_CONNECTION)) | ||
4632 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); | 4628 | usb_phy_notify_disconnect(hcd->usb_phy, udev->speed); |
4633 | usb_disconnect(&port_dev->child); | 4629 | usb_disconnect(&port_dev->child); |
4634 | } | 4630 | } |
@@ -4783,6 +4779,10 @@ static void hub_port_connect(struct usb_hub *hub, int port1, u16 portstatus, | |||
4783 | port_dev->child = NULL; | 4779 | port_dev->child = NULL; |
4784 | spin_unlock_irq(&device_state_lock); | 4780 | spin_unlock_irq(&device_state_lock); |
4785 | mutex_unlock(&usb_port_peer_mutex); | 4781 | mutex_unlock(&usb_port_peer_mutex); |
4782 | } else { | ||
4783 | if (hcd->usb_phy && !hdev->parent) | ||
4784 | usb_phy_notify_connect(hcd->usb_phy, | ||
4785 | udev->speed); | ||
4786 | } | 4786 | } |
4787 | } | 4787 | } |
4788 | 4788 | ||
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 5ae883dc21f5..39b4081b632d 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c | |||
@@ -97,6 +97,12 @@ static const struct usb_device_id usb_quirk_list[] = { | |||
97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = | 97 | { USB_DEVICE(0x04f3, 0x0089), .driver_info = |
98 | USB_QUIRK_DEVICE_QUALIFIER }, | 98 | USB_QUIRK_DEVICE_QUALIFIER }, |
99 | 99 | ||
100 | { USB_DEVICE(0x04f3, 0x009b), .driver_info = | ||
101 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
102 | |||
103 | { USB_DEVICE(0x04f3, 0x016f), .driver_info = | ||
104 | USB_QUIRK_DEVICE_QUALIFIER }, | ||
105 | |||
100 | /* Roland SC-8820 */ | 106 | /* Roland SC-8820 */ |
101 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, | 107 | { USB_DEVICE(0x0582, 0x0007), .driver_info = USB_QUIRK_RESET_RESUME }, |
102 | 108 | ||
diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index bf015ab3b44c..55c90c53f2d6 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h | |||
@@ -619,7 +619,7 @@ struct dwc2_hsotg { | |||
619 | unsigned port_suspend_change:1; | 619 | unsigned port_suspend_change:1; |
620 | unsigned port_over_current_change:1; | 620 | unsigned port_over_current_change:1; |
621 | unsigned port_l1_change:1; | 621 | unsigned port_l1_change:1; |
622 | unsigned reserved:26; | 622 | unsigned reserved:25; |
623 | } b; | 623 | } b; |
624 | } flags; | 624 | } flags; |
625 | 625 | ||
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 7b5856fadd93..8b5c079c7b7d 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c | |||
@@ -2327,7 +2327,7 @@ irq_retry: | |||
2327 | 2327 | ||
2328 | u32 usb_status = readl(hsotg->regs + GOTGCTL); | 2328 | u32 usb_status = readl(hsotg->regs + GOTGCTL); |
2329 | 2329 | ||
2330 | dev_info(hsotg->dev, "%s: USBRst\n", __func__); | 2330 | dev_dbg(hsotg->dev, "%s: USBRst\n", __func__); |
2331 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", | 2331 | dev_dbg(hsotg->dev, "GNPTXSTS=%08x\n", |
2332 | readl(hsotg->regs + GNPTXSTS)); | 2332 | readl(hsotg->regs + GNPTXSTS)); |
2333 | 2333 | ||
@@ -2561,8 +2561,10 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, | |||
2561 | hs_ep->fifo_size = val; | 2561 | hs_ep->fifo_size = val; |
2562 | break; | 2562 | break; |
2563 | } | 2563 | } |
2564 | if (i == 8) | 2564 | if (i == 8) { |
2565 | return -ENOMEM; | 2565 | ret = -ENOMEM; |
2566 | goto error; | ||
2567 | } | ||
2566 | } | 2568 | } |
2567 | 2569 | ||
2568 | /* for non control endpoints, set PID to D0 */ | 2570 | /* for non control endpoints, set PID to D0 */ |
@@ -2579,6 +2581,7 @@ static int s3c_hsotg_ep_enable(struct usb_ep *ep, | |||
2579 | /* enable the endpoint interrupt */ | 2581 | /* enable the endpoint interrupt */ |
2580 | s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); | 2582 | s3c_hsotg_ctrl_epint(hsotg, index, dir_in, 1); |
2581 | 2583 | ||
2584 | error: | ||
2582 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2585 | spin_unlock_irqrestore(&hsotg->lock, flags); |
2583 | return ret; | 2586 | return ret; |
2584 | } | 2587 | } |
@@ -2934,9 +2937,7 @@ static int s3c_hsotg_udc_stop(struct usb_gadget *gadget, | |||
2934 | 2937 | ||
2935 | spin_lock_irqsave(&hsotg->lock, flags); | 2938 | spin_lock_irqsave(&hsotg->lock, flags); |
2936 | 2939 | ||
2937 | if (!driver) | 2940 | hsotg->driver = NULL; |
2938 | hsotg->driver = NULL; | ||
2939 | |||
2940 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | 2941 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; |
2941 | 2942 | ||
2942 | spin_unlock_irqrestore(&hsotg->lock, flags); | 2943 | spin_unlock_irqrestore(&hsotg->lock, flags); |
@@ -3567,6 +3568,7 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3567 | s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum); | 3568 | s3c_hsotg_initep(hsotg, &hsotg->eps[epnum], epnum); |
3568 | 3569 | ||
3569 | /* disable power and clock */ | 3570 | /* disable power and clock */ |
3571 | s3c_hsotg_phy_disable(hsotg); | ||
3570 | 3572 | ||
3571 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | 3573 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), |
3572 | hsotg->supplies); | 3574 | hsotg->supplies); |
@@ -3575,8 +3577,6 @@ static int s3c_hsotg_probe(struct platform_device *pdev) | |||
3575 | goto err_ep_mem; | 3577 | goto err_ep_mem; |
3576 | } | 3578 | } |
3577 | 3579 | ||
3578 | s3c_hsotg_phy_disable(hsotg); | ||
3579 | |||
3580 | ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); | 3580 | ret = usb_add_gadget_udc(&pdev->dev, &hsotg->gadget); |
3581 | if (ret) | 3581 | if (ret) |
3582 | goto err_ep_mem; | 3582 | goto err_ep_mem; |
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 2f537d588225..a0aa9f3da441 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c | |||
@@ -597,7 +597,7 @@ static int dwc3_omap_prepare(struct device *dev) | |||
597 | { | 597 | { |
598 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 598 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
599 | 599 | ||
600 | dwc3_omap_write_irqmisc_set(omap, 0x00); | 600 | dwc3_omap_disable_irqs(omap); |
601 | 601 | ||
602 | return 0; | 602 | return 0; |
603 | } | 603 | } |
@@ -605,19 +605,8 @@ static int dwc3_omap_prepare(struct device *dev) | |||
605 | static void dwc3_omap_complete(struct device *dev) | 605 | static void dwc3_omap_complete(struct device *dev) |
606 | { | 606 | { |
607 | struct dwc3_omap *omap = dev_get_drvdata(dev); | 607 | struct dwc3_omap *omap = dev_get_drvdata(dev); |
608 | u32 reg; | ||
609 | 608 | ||
610 | reg = (USBOTGSS_IRQMISC_OEVT | | 609 | dwc3_omap_enable_irqs(omap); |
611 | USBOTGSS_IRQMISC_DRVVBUS_RISE | | ||
612 | USBOTGSS_IRQMISC_CHRGVBUS_RISE | | ||
613 | USBOTGSS_IRQMISC_DISCHRGVBUS_RISE | | ||
614 | USBOTGSS_IRQMISC_IDPULLUP_RISE | | ||
615 | USBOTGSS_IRQMISC_DRVVBUS_FALL | | ||
616 | USBOTGSS_IRQMISC_CHRGVBUS_FALL | | ||
617 | USBOTGSS_IRQMISC_DISCHRGVBUS_FALL | | ||
618 | USBOTGSS_IRQMISC_IDPULLUP_FALL); | ||
619 | |||
620 | dwc3_omap_write_irqmisc_set(omap, reg); | ||
621 | } | 610 | } |
622 | 611 | ||
623 | static int dwc3_omap_suspend(struct device *dev) | 612 | static int dwc3_omap_suspend(struct device *dev) |
diff --git a/drivers/usb/dwc3/dwc3-pci.c b/drivers/usb/dwc3/dwc3-pci.c index 436fb08c40b8..a36cf66302fb 100644 --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd | 30 | #define PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3 0xabcd |
31 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 | 31 | #define PCI_DEVICE_ID_INTEL_BYT 0x0f37 |
32 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e | 32 | #define PCI_DEVICE_ID_INTEL_MRFLD 0x119e |
33 | #define PCI_DEVICE_ID_INTEL_BSW 0x22B7 | ||
33 | 34 | ||
34 | struct dwc3_pci { | 35 | struct dwc3_pci { |
35 | struct device *dev; | 36 | struct device *dev; |
@@ -181,6 +182,7 @@ static const struct pci_device_id dwc3_pci_id_table[] = { | |||
181 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, | 182 | PCI_DEVICE(PCI_VENDOR_ID_SYNOPSYS, |
182 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), | 183 | PCI_DEVICE_ID_SYNOPSYS_HAPSUSB3), |
183 | }, | 184 | }, |
185 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BSW), }, | ||
184 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, | 186 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_BYT), }, |
185 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, | 187 | { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_MRFLD), }, |
186 | { } /* Terminating Entry */ | 188 | { } /* Terminating Entry */ |
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index b35938777dde..711b23019d54 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c | |||
@@ -256,7 +256,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) | |||
256 | 256 | ||
257 | /* stall is always issued on EP0 */ | 257 | /* stall is always issued on EP0 */ |
258 | dep = dwc->eps[0]; | 258 | dep = dwc->eps[0]; |
259 | __dwc3_gadget_ep_set_halt(dep, 1); | 259 | __dwc3_gadget_ep_set_halt(dep, 1, false); |
260 | dep->flags = DWC3_EP_ENABLED; | 260 | dep->flags = DWC3_EP_ENABLED; |
261 | dwc->delayed_status = false; | 261 | dwc->delayed_status = false; |
262 | 262 | ||
@@ -271,7 +271,7 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc) | |||
271 | dwc3_ep0_out_start(dwc); | 271 | dwc3_ep0_out_start(dwc); |
272 | } | 272 | } |
273 | 273 | ||
274 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | 274 | int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) |
275 | { | 275 | { |
276 | struct dwc3_ep *dep = to_dwc3_ep(ep); | 276 | struct dwc3_ep *dep = to_dwc3_ep(ep); |
277 | struct dwc3 *dwc = dep->dwc; | 277 | struct dwc3 *dwc = dep->dwc; |
@@ -281,6 +281,20 @@ int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | |||
281 | return 0; | 281 | return 0; |
282 | } | 282 | } |
283 | 283 | ||
284 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | ||
285 | { | ||
286 | struct dwc3_ep *dep = to_dwc3_ep(ep); | ||
287 | struct dwc3 *dwc = dep->dwc; | ||
288 | unsigned long flags; | ||
289 | int ret; | ||
290 | |||
291 | spin_lock_irqsave(&dwc->lock, flags); | ||
292 | ret = __dwc3_gadget_ep0_set_halt(ep, value); | ||
293 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
294 | |||
295 | return ret; | ||
296 | } | ||
297 | |||
284 | void dwc3_ep0_out_start(struct dwc3 *dwc) | 298 | void dwc3_ep0_out_start(struct dwc3 *dwc) |
285 | { | 299 | { |
286 | int ret; | 300 | int ret; |
@@ -466,7 +480,7 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc, | |||
466 | return -EINVAL; | 480 | return -EINVAL; |
467 | if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) | 481 | if (set == 0 && (dep->flags & DWC3_EP_WEDGE)) |
468 | break; | 482 | break; |
469 | ret = __dwc3_gadget_ep_set_halt(dep, set); | 483 | ret = __dwc3_gadget_ep_set_halt(dep, set, true); |
470 | if (ret) | 484 | if (ret) |
471 | return -EINVAL; | 485 | return -EINVAL; |
472 | break; | 486 | break; |
@@ -775,9 +789,6 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
775 | 789 | ||
776 | dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; | 790 | dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; |
777 | 791 | ||
778 | r = next_request(&ep0->request_list); | ||
779 | ur = &r->request; | ||
780 | |||
781 | trb = dwc->ep0_trb; | 792 | trb = dwc->ep0_trb; |
782 | 793 | ||
783 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); | 794 | status = DWC3_TRB_SIZE_TRBSTS(trb->size); |
@@ -790,6 +801,12 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
790 | return; | 801 | return; |
791 | } | 802 | } |
792 | 803 | ||
804 | r = next_request(&ep0->request_list); | ||
805 | if (!r) | ||
806 | return; | ||
807 | |||
808 | ur = &r->request; | ||
809 | |||
793 | length = trb->size & DWC3_TRB_SIZE_MASK; | 810 | length = trb->size & DWC3_TRB_SIZE_MASK; |
794 | 811 | ||
795 | if (dwc->ep0_bounced) { | 812 | if (dwc->ep0_bounced) { |
@@ -811,12 +828,19 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc, | |||
811 | 828 | ||
812 | dwc3_ep0_stall_and_restart(dwc); | 829 | dwc3_ep0_stall_and_restart(dwc); |
813 | } else { | 830 | } else { |
814 | /* | 831 | dwc3_gadget_giveback(ep0, r, 0); |
815 | * handle the case where we have to send a zero packet. This | 832 | |
816 | * seems to be case when req.length > maxpacket. Could it be? | 833 | if (IS_ALIGNED(ur->length, ep0->endpoint.maxpacket) && |
817 | */ | 834 | ur->length && ur->zero) { |
818 | if (r) | 835 | int ret; |
819 | dwc3_gadget_giveback(ep0, r, 0); | 836 | |
837 | dwc->ep0_next_event = DWC3_EP0_COMPLETE; | ||
838 | |||
839 | ret = dwc3_ep0_start_trans(dwc, epnum, | ||
840 | dwc->ctrl_req_addr, 0, | ||
841 | DWC3_TRBCTL_CONTROL_DATA); | ||
842 | WARN_ON(ret < 0); | ||
843 | } | ||
820 | } | 844 | } |
821 | } | 845 | } |
822 | 846 | ||
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 3818b26bfc05..546ea5431b8c 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c | |||
@@ -525,12 +525,11 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep, | |||
525 | if (!usb_endpoint_xfer_isoc(desc)) | 525 | if (!usb_endpoint_xfer_isoc(desc)) |
526 | return 0; | 526 | return 0; |
527 | 527 | ||
528 | memset(&trb_link, 0, sizeof(trb_link)); | ||
529 | |||
530 | /* Link TRB for ISOC. The HWO bit is never reset */ | 528 | /* Link TRB for ISOC. The HWO bit is never reset */ |
531 | trb_st_hw = &dep->trb_pool[0]; | 529 | trb_st_hw = &dep->trb_pool[0]; |
532 | 530 | ||
533 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; | 531 | trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; |
532 | memset(trb_link, 0, sizeof(*trb_link)); | ||
534 | 533 | ||
535 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 534 | trb_link->bpl = lower_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |
536 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); | 535 | trb_link->bph = upper_32_bits(dwc3_trb_dma_offset(dep, trb_st_hw)); |
@@ -581,7 +580,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep) | |||
581 | 580 | ||
582 | /* make sure HW endpoint isn't stalled */ | 581 | /* make sure HW endpoint isn't stalled */ |
583 | if (dep->flags & DWC3_EP_STALL) | 582 | if (dep->flags & DWC3_EP_STALL) |
584 | __dwc3_gadget_ep_set_halt(dep, 0); | 583 | __dwc3_gadget_ep_set_halt(dep, 0, false); |
585 | 584 | ||
586 | reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); | 585 | reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); |
587 | reg &= ~DWC3_DALEPENA_EP(dep->number); | 586 | reg &= ~DWC3_DALEPENA_EP(dep->number); |
@@ -1202,15 +1201,28 @@ out0: | |||
1202 | return ret; | 1201 | return ret; |
1203 | } | 1202 | } |
1204 | 1203 | ||
1205 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value) | 1204 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol) |
1206 | { | 1205 | { |
1207 | struct dwc3_gadget_ep_cmd_params params; | 1206 | struct dwc3_gadget_ep_cmd_params params; |
1208 | struct dwc3 *dwc = dep->dwc; | 1207 | struct dwc3 *dwc = dep->dwc; |
1209 | int ret; | 1208 | int ret; |
1210 | 1209 | ||
1210 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
1211 | dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); | ||
1212 | return -EINVAL; | ||
1213 | } | ||
1214 | |||
1211 | memset(¶ms, 0x00, sizeof(params)); | 1215 | memset(¶ms, 0x00, sizeof(params)); |
1212 | 1216 | ||
1213 | if (value) { | 1217 | if (value) { |
1218 | if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) || | ||
1219 | (!list_empty(&dep->req_queued) || | ||
1220 | !list_empty(&dep->request_list)))) { | ||
1221 | dev_dbg(dwc->dev, "%s: pending request, cannot halt\n", | ||
1222 | dep->name); | ||
1223 | return -EAGAIN; | ||
1224 | } | ||
1225 | |||
1214 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, | 1226 | ret = dwc3_send_gadget_ep_cmd(dwc, dep->number, |
1215 | DWC3_DEPCMD_SETSTALL, ¶ms); | 1227 | DWC3_DEPCMD_SETSTALL, ¶ms); |
1216 | if (ret) | 1228 | if (ret) |
@@ -1241,15 +1253,7 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value) | |||
1241 | int ret; | 1253 | int ret; |
1242 | 1254 | ||
1243 | spin_lock_irqsave(&dwc->lock, flags); | 1255 | spin_lock_irqsave(&dwc->lock, flags); |
1244 | 1256 | ret = __dwc3_gadget_ep_set_halt(dep, value, false); | |
1245 | if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) { | ||
1246 | dev_err(dwc->dev, "%s is of Isochronous type\n", dep->name); | ||
1247 | ret = -EINVAL; | ||
1248 | goto out; | ||
1249 | } | ||
1250 | |||
1251 | ret = __dwc3_gadget_ep_set_halt(dep, value); | ||
1252 | out: | ||
1253 | spin_unlock_irqrestore(&dwc->lock, flags); | 1257 | spin_unlock_irqrestore(&dwc->lock, flags); |
1254 | 1258 | ||
1255 | return ret; | 1259 | return ret; |
@@ -1260,15 +1264,18 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) | |||
1260 | struct dwc3_ep *dep = to_dwc3_ep(ep); | 1264 | struct dwc3_ep *dep = to_dwc3_ep(ep); |
1261 | struct dwc3 *dwc = dep->dwc; | 1265 | struct dwc3 *dwc = dep->dwc; |
1262 | unsigned long flags; | 1266 | unsigned long flags; |
1267 | int ret; | ||
1263 | 1268 | ||
1264 | spin_lock_irqsave(&dwc->lock, flags); | 1269 | spin_lock_irqsave(&dwc->lock, flags); |
1265 | dep->flags |= DWC3_EP_WEDGE; | 1270 | dep->flags |= DWC3_EP_WEDGE; |
1266 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1267 | 1271 | ||
1268 | if (dep->number == 0 || dep->number == 1) | 1272 | if (dep->number == 0 || dep->number == 1) |
1269 | return dwc3_gadget_ep0_set_halt(ep, 1); | 1273 | ret = __dwc3_gadget_ep0_set_halt(ep, 1); |
1270 | else | 1274 | else |
1271 | return dwc3_gadget_ep_set_halt(ep, 1); | 1275 | ret = __dwc3_gadget_ep_set_halt(dep, 1, false); |
1276 | spin_unlock_irqrestore(&dwc->lock, flags); | ||
1277 | |||
1278 | return ret; | ||
1272 | } | 1279 | } |
1273 | 1280 | ||
1274 | /* -------------------------------------------------------------------------- */ | 1281 | /* -------------------------------------------------------------------------- */ |
diff --git a/drivers/usb/dwc3/gadget.h b/drivers/usb/dwc3/gadget.h index 178ad8982206..18ae3eaa8b6f 100644 --- a/drivers/usb/dwc3/gadget.h +++ b/drivers/usb/dwc3/gadget.h | |||
@@ -82,10 +82,11 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, | |||
82 | void dwc3_ep0_interrupt(struct dwc3 *dwc, | 82 | void dwc3_ep0_interrupt(struct dwc3 *dwc, |
83 | const struct dwc3_event_depevt *event); | 83 | const struct dwc3_event_depevt *event); |
84 | void dwc3_ep0_out_start(struct dwc3 *dwc); | 84 | void dwc3_ep0_out_start(struct dwc3 *dwc); |
85 | int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); | ||
85 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); | 86 | int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value); |
86 | int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, | 87 | int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, |
87 | gfp_t gfp_flags); | 88 | gfp_t gfp_flags); |
88 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value); | 89 | int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol); |
89 | 90 | ||
90 | /** | 91 | /** |
91 | * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW | 92 | * dwc3_gadget_ep_get_transfer_index - Gets transfer index from HW |
diff --git a/drivers/usb/dwc3/trace.h b/drivers/usb/dwc3/trace.h index 78aff1da089a..60b0f41eafc4 100644 --- a/drivers/usb/dwc3/trace.h +++ b/drivers/usb/dwc3/trace.h | |||
@@ -73,15 +73,23 @@ DECLARE_EVENT_CLASS(dwc3_log_ctrl, | |||
73 | TP_PROTO(struct usb_ctrlrequest *ctrl), | 73 | TP_PROTO(struct usb_ctrlrequest *ctrl), |
74 | TP_ARGS(ctrl), | 74 | TP_ARGS(ctrl), |
75 | TP_STRUCT__entry( | 75 | TP_STRUCT__entry( |
76 | __field(struct usb_ctrlrequest *, ctrl) | 76 | __field(__u8, bRequestType) |
77 | __field(__u8, bRequest) | ||
78 | __field(__le16, wValue) | ||
79 | __field(__le16, wIndex) | ||
80 | __field(__le16, wLength) | ||
77 | ), | 81 | ), |
78 | TP_fast_assign( | 82 | TP_fast_assign( |
79 | __entry->ctrl = ctrl; | 83 | __entry->bRequestType = ctrl->bRequestType; |
84 | __entry->bRequest = ctrl->bRequest; | ||
85 | __entry->wValue = ctrl->wValue; | ||
86 | __entry->wIndex = ctrl->wIndex; | ||
87 | __entry->wLength = ctrl->wLength; | ||
80 | ), | 88 | ), |
81 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", | 89 | TP_printk("bRequestType %02x bRequest %02x wValue %04x wIndex %04x wLength %d", |
82 | __entry->ctrl->bRequestType, __entry->ctrl->bRequest, | 90 | __entry->bRequestType, __entry->bRequest, |
83 | le16_to_cpu(__entry->ctrl->wValue), le16_to_cpu(__entry->ctrl->wIndex), | 91 | le16_to_cpu(__entry->wValue), le16_to_cpu(__entry->wIndex), |
84 | le16_to_cpu(__entry->ctrl->wLength) | 92 | le16_to_cpu(__entry->wLength) |
85 | ) | 93 | ) |
86 | ); | 94 | ); |
87 | 95 | ||
@@ -94,15 +102,22 @@ DECLARE_EVENT_CLASS(dwc3_log_request, | |||
94 | TP_PROTO(struct dwc3_request *req), | 102 | TP_PROTO(struct dwc3_request *req), |
95 | TP_ARGS(req), | 103 | TP_ARGS(req), |
96 | TP_STRUCT__entry( | 104 | TP_STRUCT__entry( |
105 | __dynamic_array(char, name, DWC3_MSG_MAX) | ||
97 | __field(struct dwc3_request *, req) | 106 | __field(struct dwc3_request *, req) |
107 | __field(unsigned, actual) | ||
108 | __field(unsigned, length) | ||
109 | __field(int, status) | ||
98 | ), | 110 | ), |
99 | TP_fast_assign( | 111 | TP_fast_assign( |
112 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", req->dep->name); | ||
100 | __entry->req = req; | 113 | __entry->req = req; |
114 | __entry->actual = req->request.actual; | ||
115 | __entry->length = req->request.length; | ||
116 | __entry->status = req->request.status; | ||
101 | ), | 117 | ), |
102 | TP_printk("%s: req %p length %u/%u ==> %d", | 118 | TP_printk("%s: req %p length %u/%u ==> %d", |
103 | __entry->req->dep->name, __entry->req, | 119 | __get_str(name), __entry->req, __entry->actual, __entry->length, |
104 | __entry->req->request.actual, __entry->req->request.length, | 120 | __entry->status |
105 | __entry->req->request.status | ||
106 | ) | 121 | ) |
107 | ); | 122 | ); |
108 | 123 | ||
@@ -158,17 +173,17 @@ DECLARE_EVENT_CLASS(dwc3_log_gadget_ep_cmd, | |||
158 | struct dwc3_gadget_ep_cmd_params *params), | 173 | struct dwc3_gadget_ep_cmd_params *params), |
159 | TP_ARGS(dep, cmd, params), | 174 | TP_ARGS(dep, cmd, params), |
160 | TP_STRUCT__entry( | 175 | TP_STRUCT__entry( |
161 | __field(struct dwc3_ep *, dep) | 176 | __dynamic_array(char, name, DWC3_MSG_MAX) |
162 | __field(unsigned int, cmd) | 177 | __field(unsigned int, cmd) |
163 | __field(struct dwc3_gadget_ep_cmd_params *, params) | 178 | __field(struct dwc3_gadget_ep_cmd_params *, params) |
164 | ), | 179 | ), |
165 | TP_fast_assign( | 180 | TP_fast_assign( |
166 | __entry->dep = dep; | 181 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
167 | __entry->cmd = cmd; | 182 | __entry->cmd = cmd; |
168 | __entry->params = params; | 183 | __entry->params = params; |
169 | ), | 184 | ), |
170 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", | 185 | TP_printk("%s: cmd '%s' [%d] params %08x %08x %08x\n", |
171 | __entry->dep->name, dwc3_gadget_ep_cmd_string(__entry->cmd), | 186 | __get_str(name), dwc3_gadget_ep_cmd_string(__entry->cmd), |
172 | __entry->cmd, __entry->params->param0, | 187 | __entry->cmd, __entry->params->param0, |
173 | __entry->params->param1, __entry->params->param2 | 188 | __entry->params->param1, __entry->params->param2 |
174 | ) | 189 | ) |
@@ -184,16 +199,24 @@ DECLARE_EVENT_CLASS(dwc3_log_trb, | |||
184 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), | 199 | TP_PROTO(struct dwc3_ep *dep, struct dwc3_trb *trb), |
185 | TP_ARGS(dep, trb), | 200 | TP_ARGS(dep, trb), |
186 | TP_STRUCT__entry( | 201 | TP_STRUCT__entry( |
187 | __field(struct dwc3_ep *, dep) | 202 | __dynamic_array(char, name, DWC3_MSG_MAX) |
188 | __field(struct dwc3_trb *, trb) | 203 | __field(struct dwc3_trb *, trb) |
204 | __field(u32, bpl) | ||
205 | __field(u32, bph) | ||
206 | __field(u32, size) | ||
207 | __field(u32, ctrl) | ||
189 | ), | 208 | ), |
190 | TP_fast_assign( | 209 | TP_fast_assign( |
191 | __entry->dep = dep; | 210 | snprintf(__get_str(name), DWC3_MSG_MAX, "%s", dep->name); |
192 | __entry->trb = trb; | 211 | __entry->trb = trb; |
212 | __entry->bpl = trb->bpl; | ||
213 | __entry->bph = trb->bph; | ||
214 | __entry->size = trb->size; | ||
215 | __entry->ctrl = trb->ctrl; | ||
193 | ), | 216 | ), |
194 | TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", | 217 | TP_printk("%s: trb %p bph %08x bpl %08x size %08x ctrl %08x\n", |
195 | __entry->dep->name, __entry->trb, __entry->trb->bph, | 218 | __get_str(name), __entry->trb, __entry->bph, __entry->bpl, |
196 | __entry->trb->bpl, __entry->trb->size, __entry->trb->ctrl | 219 | __entry->size, __entry->ctrl |
197 | ) | 220 | ) |
198 | ); | 221 | ); |
199 | 222 | ||
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index a8c18df171c3..f6a51fddd5b5 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c | |||
@@ -560,7 +560,7 @@ static int bos_desc(struct usb_composite_dev *cdev) | |||
560 | usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; | 560 | usb_ext->bLength = USB_DT_USB_EXT_CAP_SIZE; |
561 | usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; | 561 | usb_ext->bDescriptorType = USB_DT_DEVICE_CAPABILITY; |
562 | usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; | 562 | usb_ext->bDevCapabilityType = USB_CAP_TYPE_EXT; |
563 | usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT); | 563 | usb_ext->bmAttributes = cpu_to_le32(USB_LPM_SUPPORT | USB_BESL_SUPPORT); |
564 | 564 | ||
565 | /* | 565 | /* |
566 | * The Superspeed USB Capability descriptor shall be implemented by all | 566 | * The Superspeed USB Capability descriptor shall be implemented by all |
diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c index 6da4685490ef..aad8165e98ef 100644 --- a/drivers/usb/gadget/function/f_acm.c +++ b/drivers/usb/gadget/function/f_acm.c | |||
@@ -433,12 +433,12 @@ static int acm_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
433 | dev_vdbg(&cdev->gadget->dev, | 433 | dev_vdbg(&cdev->gadget->dev, |
434 | "reset acm control interface %d\n", intf); | 434 | "reset acm control interface %d\n", intf); |
435 | usb_ep_disable(acm->notify); | 435 | usb_ep_disable(acm->notify); |
436 | } else { | 436 | } |
437 | dev_vdbg(&cdev->gadget->dev, | 437 | |
438 | "init acm ctrl interface %d\n", intf); | 438 | if (!acm->notify->desc) |
439 | if (config_ep_by_speed(cdev->gadget, f, acm->notify)) | 439 | if (config_ep_by_speed(cdev->gadget, f, acm->notify)) |
440 | return -EINVAL; | 440 | return -EINVAL; |
441 | } | 441 | |
442 | usb_ep_enable(acm->notify); | 442 | usb_ep_enable(acm->notify); |
443 | acm->notify->driver_data = acm; | 443 | acm->notify->driver_data = acm; |
444 | 444 | ||
diff --git a/drivers/usb/gadget/function/f_eem.c b/drivers/usb/gadget/function/f_eem.c index 4d8b236ea608..c9e90de5bdd9 100644 --- a/drivers/usb/gadget/function/f_eem.c +++ b/drivers/usb/gadget/function/f_eem.c | |||
@@ -325,7 +325,6 @@ static int eem_bind(struct usb_configuration *c, struct usb_function *f) | |||
325 | return 0; | 325 | return 0; |
326 | 326 | ||
327 | fail: | 327 | fail: |
328 | usb_free_all_descriptors(f); | ||
329 | if (eem->port.out_ep) | 328 | if (eem->port.out_ep) |
330 | eem->port.out_ep->driver_data = NULL; | 329 | eem->port.out_ep->driver_data = NULL; |
331 | if (eem->port.in_ep) | 330 | if (eem->port.in_ep) |
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c index 7c6771d027a2..63314ede7ba6 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c | |||
@@ -647,15 +647,26 @@ static void ffs_user_copy_worker(struct work_struct *work) | |||
647 | if (io_data->read && ret > 0) { | 647 | if (io_data->read && ret > 0) { |
648 | int i; | 648 | int i; |
649 | size_t pos = 0; | 649 | size_t pos = 0; |
650 | |||
651 | /* | ||
652 | * Since req->length may be bigger than io_data->len (after | ||
653 | * being rounded up to maxpacketsize), we may end up with more | ||
654 | * data then user space has space for. | ||
655 | */ | ||
656 | ret = min_t(int, ret, io_data->len); | ||
657 | |||
650 | use_mm(io_data->mm); | 658 | use_mm(io_data->mm); |
651 | for (i = 0; i < io_data->nr_segs; i++) { | 659 | for (i = 0; i < io_data->nr_segs; i++) { |
660 | size_t len = min_t(size_t, ret - pos, | ||
661 | io_data->iovec[i].iov_len); | ||
662 | if (!len) | ||
663 | break; | ||
652 | if (unlikely(copy_to_user(io_data->iovec[i].iov_base, | 664 | if (unlikely(copy_to_user(io_data->iovec[i].iov_base, |
653 | &io_data->buf[pos], | 665 | &io_data->buf[pos], len))) { |
654 | io_data->iovec[i].iov_len))) { | ||
655 | ret = -EFAULT; | 666 | ret = -EFAULT; |
656 | break; | 667 | break; |
657 | } | 668 | } |
658 | pos += io_data->iovec[i].iov_len; | 669 | pos += len; |
659 | } | 670 | } |
660 | unuse_mm(io_data->mm); | 671 | unuse_mm(io_data->mm); |
661 | } | 672 | } |
@@ -687,7 +698,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
687 | struct ffs_epfile *epfile = file->private_data; | 698 | struct ffs_epfile *epfile = file->private_data; |
688 | struct ffs_ep *ep; | 699 | struct ffs_ep *ep; |
689 | char *data = NULL; | 700 | char *data = NULL; |
690 | ssize_t ret, data_len; | 701 | ssize_t ret, data_len = -EINVAL; |
691 | int halt; | 702 | int halt; |
692 | 703 | ||
693 | /* Are we still active? */ | 704 | /* Are we still active? */ |
@@ -787,13 +798,30 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
787 | /* Fire the request */ | 798 | /* Fire the request */ |
788 | struct usb_request *req; | 799 | struct usb_request *req; |
789 | 800 | ||
801 | /* | ||
802 | * Sanity Check: even though data_len can't be used | ||
803 | * uninitialized at the time I write this comment, some | ||
804 | * compilers complain about this situation. | ||
805 | * In order to keep the code clean from warnings, data_len is | ||
806 | * being initialized to -EINVAL during its declaration, which | ||
807 | * means we can't rely on compiler anymore to warn no future | ||
808 | * changes won't result in data_len being used uninitialized. | ||
809 | * For such reason, we're adding this redundant sanity check | ||
810 | * here. | ||
811 | */ | ||
812 | if (unlikely(data_len == -EINVAL)) { | ||
813 | WARN(1, "%s: data_len == -EINVAL\n", __func__); | ||
814 | ret = -EINVAL; | ||
815 | goto error_lock; | ||
816 | } | ||
817 | |||
790 | if (io_data->aio) { | 818 | if (io_data->aio) { |
791 | req = usb_ep_alloc_request(ep->ep, GFP_KERNEL); | 819 | req = usb_ep_alloc_request(ep->ep, GFP_KERNEL); |
792 | if (unlikely(!req)) | 820 | if (unlikely(!req)) |
793 | goto error_lock; | 821 | goto error_lock; |
794 | 822 | ||
795 | req->buf = data; | 823 | req->buf = data; |
796 | req->length = io_data->len; | 824 | req->length = data_len; |
797 | 825 | ||
798 | io_data->buf = data; | 826 | io_data->buf = data; |
799 | io_data->ep = ep->ep; | 827 | io_data->ep = ep->ep; |
@@ -815,7 +843,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data) | |||
815 | 843 | ||
816 | req = ep->req; | 844 | req = ep->req; |
817 | req->buf = data; | 845 | req->buf = data; |
818 | req->length = io_data->len; | 846 | req->length = data_len; |
819 | 847 | ||
820 | req->context = &done; | 848 | req->context = &done; |
821 | req->complete = ffs_epfile_io_complete; | 849 | req->complete = ffs_epfile_io_complete; |
@@ -2663,8 +2691,6 @@ static inline struct f_fs_opts *ffs_do_functionfs_bind(struct usb_function *f, | |||
2663 | func->conf = c; | 2691 | func->conf = c; |
2664 | func->gadget = c->cdev->gadget; | 2692 | func->gadget = c->cdev->gadget; |
2665 | 2693 | ||
2666 | ffs_data_get(func->ffs); | ||
2667 | |||
2668 | /* | 2694 | /* |
2669 | * in drivers/usb/gadget/configfs.c:configfs_composite_bind() | 2695 | * in drivers/usb/gadget/configfs.c:configfs_composite_bind() |
2670 | * configurations are bound in sequence with list_for_each_entry, | 2696 | * configurations are bound in sequence with list_for_each_entry, |
diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index a95290a1289f..59ab62c92b66 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c | |||
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, struct usb_function *f) | |||
621 | dev = MKDEV(major, hidg->minor); | 621 | dev = MKDEV(major, hidg->minor); |
622 | status = cdev_add(&hidg->cdev, dev, 1); | 622 | status = cdev_add(&hidg->cdev, dev, 1); |
623 | if (status) | 623 | if (status) |
624 | goto fail; | 624 | goto fail_free_descs; |
625 | 625 | ||
626 | device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); | 626 | device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor); |
627 | 627 | ||
628 | return 0; | 628 | return 0; |
629 | 629 | ||
630 | fail_free_descs: | ||
631 | usb_free_all_descriptors(f); | ||
630 | fail: | 632 | fail: |
631 | ERROR(f->config->cdev, "hidg_bind FAILED\n"); | 633 | ERROR(f->config->cdev, "hidg_bind FAILED\n"); |
632 | if (hidg->req != NULL) { | 634 | if (hidg->req != NULL) { |
@@ -635,7 +637,6 @@ fail: | |||
635 | usb_ep_free_request(hidg->in_ep, hidg->req); | 637 | usb_ep_free_request(hidg->in_ep, hidg->req); |
636 | } | 638 | } |
637 | 639 | ||
638 | usb_free_all_descriptors(f); | ||
639 | return status; | 640 | return status; |
640 | } | 641 | } |
641 | 642 | ||
diff --git a/drivers/usb/gadget/function/f_loopback.c b/drivers/usb/gadget/function/f_loopback.c index bf04389137e6..298b46112b1a 100644 --- a/drivers/usb/gadget/function/f_loopback.c +++ b/drivers/usb/gadget/function/f_loopback.c | |||
@@ -253,22 +253,13 @@ static void loopback_complete(struct usb_ep *ep, struct usb_request *req) | |||
253 | 253 | ||
254 | case 0: /* normal completion? */ | 254 | case 0: /* normal completion? */ |
255 | if (ep == loop->out_ep) { | 255 | if (ep == loop->out_ep) { |
256 | /* loop this OUT packet back IN to the host */ | ||
257 | req->zero = (req->actual < req->length); | 256 | req->zero = (req->actual < req->length); |
258 | req->length = req->actual; | 257 | req->length = req->actual; |
259 | status = usb_ep_queue(loop->in_ep, req, GFP_ATOMIC); | ||
260 | if (status == 0) | ||
261 | return; | ||
262 | |||
263 | /* "should never get here" */ | ||
264 | ERROR(cdev, "can't loop %s to %s: %d\n", | ||
265 | ep->name, loop->in_ep->name, | ||
266 | status); | ||
267 | } | 258 | } |
268 | 259 | ||
269 | /* queue the buffer for some later OUT packet */ | 260 | /* queue the buffer for some later OUT packet */ |
270 | req->length = buflen; | 261 | req->length = buflen; |
271 | status = usb_ep_queue(loop->out_ep, req, GFP_ATOMIC); | 262 | status = usb_ep_queue(ep, req, GFP_ATOMIC); |
272 | if (status == 0) | 263 | if (status == 0) |
273 | return; | 264 | return; |
274 | 265 | ||
@@ -308,60 +299,66 @@ static inline struct usb_request *lb_alloc_ep_req(struct usb_ep *ep, int len) | |||
308 | return alloc_ep_req(ep, len, buflen); | 299 | return alloc_ep_req(ep, len, buflen); |
309 | } | 300 | } |
310 | 301 | ||
311 | static int | 302 | static int enable_endpoint(struct usb_composite_dev *cdev, struct f_loopback *loop, |
312 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) | 303 | struct usb_ep *ep) |
313 | { | 304 | { |
314 | int result = 0; | ||
315 | struct usb_ep *ep; | ||
316 | struct usb_request *req; | 305 | struct usb_request *req; |
317 | unsigned i; | 306 | unsigned i; |
307 | int result; | ||
318 | 308 | ||
319 | /* one endpoint writes data back IN to the host */ | 309 | /* |
320 | ep = loop->in_ep; | 310 | * one endpoint writes data back IN to the host while another endpoint |
311 | * just reads OUT packets | ||
312 | */ | ||
321 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); | 313 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); |
322 | if (result) | 314 | if (result) |
323 | return result; | 315 | goto fail0; |
324 | result = usb_ep_enable(ep); | 316 | result = usb_ep_enable(ep); |
325 | if (result < 0) | 317 | if (result < 0) |
326 | return result; | ||
327 | ep->driver_data = loop; | ||
328 | |||
329 | /* one endpoint just reads OUT packets */ | ||
330 | ep = loop->out_ep; | ||
331 | result = config_ep_by_speed(cdev->gadget, &(loop->function), ep); | ||
332 | if (result) | ||
333 | goto fail0; | 318 | goto fail0; |
334 | |||
335 | result = usb_ep_enable(ep); | ||
336 | if (result < 0) { | ||
337 | fail0: | ||
338 | ep = loop->in_ep; | ||
339 | usb_ep_disable(ep); | ||
340 | ep->driver_data = NULL; | ||
341 | return result; | ||
342 | } | ||
343 | ep->driver_data = loop; | 319 | ep->driver_data = loop; |
344 | 320 | ||
345 | /* allocate a bunch of read buffers and queue them all at once. | 321 | /* |
322 | * allocate a bunch of read buffers and queue them all at once. | ||
346 | * we buffer at most 'qlen' transfers; fewer if any need more | 323 | * we buffer at most 'qlen' transfers; fewer if any need more |
347 | * than 'buflen' bytes each. | 324 | * than 'buflen' bytes each. |
348 | */ | 325 | */ |
349 | for (i = 0; i < qlen && result == 0; i++) { | 326 | for (i = 0; i < qlen && result == 0; i++) { |
350 | req = lb_alloc_ep_req(ep, 0); | 327 | req = lb_alloc_ep_req(ep, 0); |
351 | if (req) { | 328 | if (!req) |
352 | req->complete = loopback_complete; | 329 | goto fail1; |
353 | result = usb_ep_queue(ep, req, GFP_ATOMIC); | 330 | |
354 | if (result) | 331 | req->complete = loopback_complete; |
355 | ERROR(cdev, "%s queue req --> %d\n", | 332 | result = usb_ep_queue(ep, req, GFP_ATOMIC); |
356 | ep->name, result); | 333 | if (result) { |
357 | } else { | 334 | ERROR(cdev, "%s queue req --> %d\n", |
358 | usb_ep_disable(ep); | 335 | ep->name, result); |
359 | ep->driver_data = NULL; | 336 | goto fail1; |
360 | result = -ENOMEM; | ||
361 | goto fail0; | ||
362 | } | 337 | } |
363 | } | 338 | } |
364 | 339 | ||
340 | return 0; | ||
341 | |||
342 | fail1: | ||
343 | usb_ep_disable(ep); | ||
344 | |||
345 | fail0: | ||
346 | return result; | ||
347 | } | ||
348 | |||
349 | static int | ||
350 | enable_loopback(struct usb_composite_dev *cdev, struct f_loopback *loop) | ||
351 | { | ||
352 | int result = 0; | ||
353 | |||
354 | result = enable_endpoint(cdev, loop, loop->in_ep); | ||
355 | if (result) | ||
356 | return result; | ||
357 | |||
358 | result = enable_endpoint(cdev, loop, loop->out_ep); | ||
359 | if (result) | ||
360 | return result; | ||
361 | |||
365 | DBG(cdev, "%s enabled\n", loop->function.name); | 362 | DBG(cdev, "%s enabled\n", loop->function.name); |
366 | return result; | 363 | return result; |
367 | } | 364 | } |
diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/function/f_ncm.c index 146f48cc65d7..16361b0a8b46 100644 --- a/drivers/usb/gadget/function/f_ncm.c +++ b/drivers/usb/gadget/function/f_ncm.c | |||
@@ -1461,7 +1461,6 @@ static int ncm_bind(struct usb_configuration *c, struct usb_function *f) | |||
1461 | return 0; | 1461 | return 0; |
1462 | 1462 | ||
1463 | fail: | 1463 | fail: |
1464 | usb_free_all_descriptors(f); | ||
1465 | if (ncm->notify_req) { | 1464 | if (ncm->notify_req) { |
1466 | kfree(ncm->notify_req->buf); | 1465 | kfree(ncm->notify_req->buf); |
1467 | usb_ep_free_request(ncm->notify, ncm->notify_req); | 1466 | usb_ep_free_request(ncm->notify, ncm->notify_req); |
diff --git a/drivers/usb/gadget/function/f_obex.c b/drivers/usb/gadget/function/f_obex.c index 5f40080c92cc..a1b79c53499c 100644 --- a/drivers/usb/gadget/function/f_obex.c +++ b/drivers/usb/gadget/function/f_obex.c | |||
@@ -35,6 +35,7 @@ struct f_obex { | |||
35 | struct gserial port; | 35 | struct gserial port; |
36 | u8 ctrl_id; | 36 | u8 ctrl_id; |
37 | u8 data_id; | 37 | u8 data_id; |
38 | u8 cur_alt; | ||
38 | u8 port_num; | 39 | u8 port_num; |
39 | u8 can_activate; | 40 | u8 can_activate; |
40 | }; | 41 | }; |
@@ -235,6 +236,8 @@ static int obex_set_alt(struct usb_function *f, unsigned intf, unsigned alt) | |||
235 | } else | 236 | } else |
236 | goto fail; | 237 | goto fail; |
237 | 238 | ||
239 | obex->cur_alt = alt; | ||
240 | |||
238 | return 0; | 241 | return 0; |
239 | 242 | ||
240 | fail: | 243 | fail: |
@@ -245,10 +248,7 @@ static int obex_get_alt(struct usb_function *f, unsigned intf) | |||
245 | { | 248 | { |
246 | struct f_obex *obex = func_to_obex(f); | 249 | struct f_obex *obex = func_to_obex(f); |
247 | 250 | ||
248 | if (intf == obex->ctrl_id) | 251 | return obex->cur_alt; |
249 | return 0; | ||
250 | |||
251 | return obex->port.in->driver_data ? 1 : 0; | ||
252 | } | 252 | } |
253 | 253 | ||
254 | static void obex_disable(struct usb_function *f) | 254 | static void obex_disable(struct usb_function *f) |
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct usb_function *f) | |||
397 | return 0; | 397 | return 0; |
398 | 398 | ||
399 | fail: | 399 | fail: |
400 | usb_free_all_descriptors(f); | ||
401 | /* we might as well release our claims on endpoints */ | 400 | /* we might as well release our claims on endpoints */ |
402 | if (obex->port.out) | 401 | if (obex->port.out) |
403 | obex->port.out->driver_data = NULL; | 402 | obex->port.out->driver_data = NULL; |
diff --git a/drivers/usb/gadget/function/f_phonet.c b/drivers/usb/gadget/function/f_phonet.c index b9cfc1571d71..1ec8b7ffdccd 100644 --- a/drivers/usb/gadget/function/f_phonet.c +++ b/drivers/usb/gadget/function/f_phonet.c | |||
@@ -570,8 +570,8 @@ static int pn_bind(struct usb_configuration *c, struct usb_function *f) | |||
570 | err_req: | 570 | err_req: |
571 | for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) | 571 | for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++) |
572 | usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); | 572 | usb_ep_free_request(fp->out_ep, fp->out_reqv[i]); |
573 | err: | ||
574 | usb_free_all_descriptors(f); | 573 | usb_free_all_descriptors(f); |
574 | err: | ||
575 | if (fp->out_ep) | 575 | if (fp->out_ep) |
576 | fp->out_ep->driver_data = NULL; | 576 | fp->out_ep->driver_data = NULL; |
577 | if (fp->in_ep) | 577 | if (fp->in_ep) |
diff --git a/drivers/usb/gadget/function/f_rndis.c b/drivers/usb/gadget/function/f_rndis.c index ddb09dc6d1f2..f13fc6a58565 100644 --- a/drivers/usb/gadget/function/f_rndis.c +++ b/drivers/usb/gadget/function/f_rndis.c | |||
@@ -802,8 +802,10 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
802 | 802 | ||
803 | if (rndis->manufacturer && rndis->vendorID && | 803 | if (rndis->manufacturer && rndis->vendorID && |
804 | rndis_set_param_vendor(rndis->config, rndis->vendorID, | 804 | rndis_set_param_vendor(rndis->config, rndis->vendorID, |
805 | rndis->manufacturer)) | 805 | rndis->manufacturer)) { |
806 | goto fail; | 806 | status = -EINVAL; |
807 | goto fail_free_descs; | ||
808 | } | ||
807 | 809 | ||
808 | /* NOTE: all that is done without knowing or caring about | 810 | /* NOTE: all that is done without knowing or caring about |
809 | * the network link ... which is unavailable to this code | 811 | * the network link ... which is unavailable to this code |
@@ -817,10 +819,11 @@ rndis_bind(struct usb_configuration *c, struct usb_function *f) | |||
817 | rndis->notify->name); | 819 | rndis->notify->name); |
818 | return 0; | 820 | return 0; |
819 | 821 | ||
822 | fail_free_descs: | ||
823 | usb_free_all_descriptors(f); | ||
820 | fail: | 824 | fail: |
821 | kfree(f->os_desc_table); | 825 | kfree(f->os_desc_table); |
822 | f->os_desc_n = 0; | 826 | f->os_desc_n = 0; |
823 | usb_free_all_descriptors(f); | ||
824 | 827 | ||
825 | if (rndis->notify_req) { | 828 | if (rndis->notify_req) { |
826 | kfree(rndis->notify_req->buf); | 829 | kfree(rndis->notify_req->buf); |
diff --git a/drivers/usb/gadget/function/f_subset.c b/drivers/usb/gadget/function/f_subset.c index 1ea8baf33333..e3dfa675ff06 100644 --- a/drivers/usb/gadget/function/f_subset.c +++ b/drivers/usb/gadget/function/f_subset.c | |||
@@ -380,7 +380,6 @@ geth_bind(struct usb_configuration *c, struct usb_function *f) | |||
380 | return 0; | 380 | return 0; |
381 | 381 | ||
382 | fail: | 382 | fail: |
383 | usb_free_all_descriptors(f); | ||
384 | /* we might as well release our claims on endpoints */ | 383 | /* we might as well release our claims on endpoints */ |
385 | if (geth->port.out_ep) | 384 | if (geth->port.out_ep) |
386 | geth->port.out_ep->driver_data = NULL; | 385 | geth->port.out_ep->driver_data = NULL; |
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index a5a27a504d67..33e16658e5cf 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c | |||
@@ -512,6 +512,11 @@ static int snd_uac2_remove(struct platform_device *pdev) | |||
512 | return 0; | 512 | return 0; |
513 | } | 513 | } |
514 | 514 | ||
515 | static void snd_uac2_release(struct device *dev) | ||
516 | { | ||
517 | dev_dbg(dev, "releasing '%s'\n", dev_name(dev)); | ||
518 | } | ||
519 | |||
515 | static int alsa_uac2_init(struct audio_dev *agdev) | 520 | static int alsa_uac2_init(struct audio_dev *agdev) |
516 | { | 521 | { |
517 | struct snd_uac2_chip *uac2 = &agdev->uac2; | 522 | struct snd_uac2_chip *uac2 = &agdev->uac2; |
@@ -523,6 +528,7 @@ static int alsa_uac2_init(struct audio_dev *agdev) | |||
523 | 528 | ||
524 | uac2->pdev.id = 0; | 529 | uac2->pdev.id = 0; |
525 | uac2->pdev.name = uac2_name; | 530 | uac2->pdev.name = uac2_name; |
531 | uac2->pdev.dev.release = snd_uac2_release; | ||
526 | 532 | ||
527 | /* Register snd_uac2 driver */ | 533 | /* Register snd_uac2 driver */ |
528 | err = platform_driver_register(&uac2->pdrv); | 534 | err = platform_driver_register(&uac2->pdrv); |
@@ -772,6 +778,7 @@ struct usb_endpoint_descriptor fs_epout_desc = { | |||
772 | 778 | ||
773 | .bEndpointAddress = USB_DIR_OUT, | 779 | .bEndpointAddress = USB_DIR_OUT, |
774 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 780 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
781 | .wMaxPacketSize = cpu_to_le16(1023), | ||
775 | .bInterval = 1, | 782 | .bInterval = 1, |
776 | }; | 783 | }; |
777 | 784 | ||
@@ -780,6 +787,7 @@ struct usb_endpoint_descriptor hs_epout_desc = { | |||
780 | .bDescriptorType = USB_DT_ENDPOINT, | 787 | .bDescriptorType = USB_DT_ENDPOINT, |
781 | 788 | ||
782 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 789 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
790 | .wMaxPacketSize = cpu_to_le16(1024), | ||
783 | .bInterval = 4, | 791 | .bInterval = 4, |
784 | }; | 792 | }; |
785 | 793 | ||
@@ -847,6 +855,7 @@ struct usb_endpoint_descriptor fs_epin_desc = { | |||
847 | 855 | ||
848 | .bEndpointAddress = USB_DIR_IN, | 856 | .bEndpointAddress = USB_DIR_IN, |
849 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
858 | .wMaxPacketSize = cpu_to_le16(1023), | ||
850 | .bInterval = 1, | 859 | .bInterval = 1, |
851 | }; | 860 | }; |
852 | 861 | ||
@@ -855,6 +864,7 @@ struct usb_endpoint_descriptor hs_epin_desc = { | |||
855 | .bDescriptorType = USB_DT_ENDPOINT, | 864 | .bDescriptorType = USB_DT_ENDPOINT, |
856 | 865 | ||
857 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, | 866 | .bmAttributes = USB_ENDPOINT_XFER_ISOC | USB_ENDPOINT_SYNC_ASYNC, |
867 | .wMaxPacketSize = cpu_to_le16(1024), | ||
858 | .bInterval = 4, | 868 | .bInterval = 4, |
859 | }; | 869 | }; |
860 | 870 | ||
@@ -947,6 +957,9 @@ free_ep(struct uac2_rtd_params *prm, struct usb_ep *ep) | |||
947 | struct snd_uac2_chip *uac2 = prm->uac2; | 957 | struct snd_uac2_chip *uac2 = prm->uac2; |
948 | int i; | 958 | int i; |
949 | 959 | ||
960 | if (!prm->ep_enabled) | ||
961 | return; | ||
962 | |||
950 | prm->ep_enabled = false; | 963 | prm->ep_enabled = false; |
951 | 964 | ||
952 | for (i = 0; i < USB_XFERS; i++) { | 965 | for (i = 0; i < USB_XFERS; i++) { |
@@ -1071,7 +1084,7 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1071 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1084 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1072 | if (!prm->rbuf) { | 1085 | if (!prm->rbuf) { |
1073 | prm->max_psize = 0; | 1086 | prm->max_psize = 0; |
1074 | goto err; | 1087 | goto err_free_descs; |
1075 | } | 1088 | } |
1076 | 1089 | ||
1077 | prm = &agdev->uac2.p_prm; | 1090 | prm = &agdev->uac2.p_prm; |
@@ -1079,17 +1092,19 @@ afunc_bind(struct usb_configuration *cfg, struct usb_function *fn) | |||
1079 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); | 1092 | prm->rbuf = kzalloc(prm->max_psize * USB_XFERS, GFP_KERNEL); |
1080 | if (!prm->rbuf) { | 1093 | if (!prm->rbuf) { |
1081 | prm->max_psize = 0; | 1094 | prm->max_psize = 0; |
1082 | goto err; | 1095 | goto err_free_descs; |
1083 | } | 1096 | } |
1084 | 1097 | ||
1085 | ret = alsa_uac2_init(agdev); | 1098 | ret = alsa_uac2_init(agdev); |
1086 | if (ret) | 1099 | if (ret) |
1087 | goto err; | 1100 | goto err_free_descs; |
1088 | return 0; | 1101 | return 0; |
1102 | |||
1103 | err_free_descs: | ||
1104 | usb_free_all_descriptors(fn); | ||
1089 | err: | 1105 | err: |
1090 | kfree(agdev->uac2.p_prm.rbuf); | 1106 | kfree(agdev->uac2.p_prm.rbuf); |
1091 | kfree(agdev->uac2.c_prm.rbuf); | 1107 | kfree(agdev->uac2.c_prm.rbuf); |
1092 | usb_free_all_descriptors(fn); | ||
1093 | if (agdev->in_ep) | 1108 | if (agdev->in_ep) |
1094 | agdev->in_ep->driver_data = NULL; | 1109 | agdev->in_ep->driver_data = NULL; |
1095 | if (agdev->out_ep) | 1110 | if (agdev->out_ep) |
diff --git a/drivers/usb/gadget/function/f_uvc.c b/drivers/usb/gadget/function/f_uvc.c index e126439e4b65..945b3bd2ca98 100644 --- a/drivers/usb/gadget/function/f_uvc.c +++ b/drivers/usb/gadget/function/f_uvc.c | |||
@@ -279,27 +279,41 @@ uvc_function_get_alt(struct usb_function *f, unsigned interface) | |||
279 | else if (interface != uvc->streaming_intf) | 279 | else if (interface != uvc->streaming_intf) |
280 | return -EINVAL; | 280 | return -EINVAL; |
281 | else | 281 | else |
282 | return uvc->state == UVC_STATE_STREAMING ? 1 : 0; | 282 | return uvc->video.ep->driver_data ? 1 : 0; |
283 | } | 283 | } |
284 | 284 | ||
285 | static int | 285 | static int |
286 | uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | 286 | uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) |
287 | { | 287 | { |
288 | struct uvc_device *uvc = to_uvc(f); | 288 | struct uvc_device *uvc = to_uvc(f); |
289 | struct usb_composite_dev *cdev = f->config->cdev; | ||
289 | struct v4l2_event v4l2_event; | 290 | struct v4l2_event v4l2_event; |
290 | struct uvc_event *uvc_event = (void *)&v4l2_event.u.data; | 291 | struct uvc_event *uvc_event = (void *)&v4l2_event.u.data; |
291 | int ret; | 292 | int ret; |
292 | 293 | ||
293 | INFO(f->config->cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt); | 294 | INFO(cdev, "uvc_function_set_alt(%u, %u)\n", interface, alt); |
294 | 295 | ||
295 | if (interface == uvc->control_intf) { | 296 | if (interface == uvc->control_intf) { |
296 | if (alt) | 297 | if (alt) |
297 | return -EINVAL; | 298 | return -EINVAL; |
298 | 299 | ||
300 | if (uvc->control_ep->driver_data) { | ||
301 | INFO(cdev, "reset UVC Control\n"); | ||
302 | usb_ep_disable(uvc->control_ep); | ||
303 | uvc->control_ep->driver_data = NULL; | ||
304 | } | ||
305 | |||
306 | if (!uvc->control_ep->desc) | ||
307 | if (config_ep_by_speed(cdev->gadget, f, uvc->control_ep)) | ||
308 | return -EINVAL; | ||
309 | |||
310 | usb_ep_enable(uvc->control_ep); | ||
311 | uvc->control_ep->driver_data = uvc; | ||
312 | |||
299 | if (uvc->state == UVC_STATE_DISCONNECTED) { | 313 | if (uvc->state == UVC_STATE_DISCONNECTED) { |
300 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 314 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
301 | v4l2_event.type = UVC_EVENT_CONNECT; | 315 | v4l2_event.type = UVC_EVENT_CONNECT; |
302 | uvc_event->speed = f->config->cdev->gadget->speed; | 316 | uvc_event->speed = cdev->gadget->speed; |
303 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 317 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
304 | 318 | ||
305 | uvc->state = UVC_STATE_CONNECTED; | 319 | uvc->state = UVC_STATE_CONNECTED; |
@@ -321,8 +335,10 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | |||
321 | if (uvc->state != UVC_STATE_STREAMING) | 335 | if (uvc->state != UVC_STATE_STREAMING) |
322 | return 0; | 336 | return 0; |
323 | 337 | ||
324 | if (uvc->video.ep) | 338 | if (uvc->video.ep) { |
325 | usb_ep_disable(uvc->video.ep); | 339 | usb_ep_disable(uvc->video.ep); |
340 | uvc->video.ep->driver_data = NULL; | ||
341 | } | ||
326 | 342 | ||
327 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 343 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
328 | v4l2_event.type = UVC_EVENT_STREAMOFF; | 344 | v4l2_event.type = UVC_EVENT_STREAMOFF; |
@@ -335,14 +351,22 @@ uvc_function_set_alt(struct usb_function *f, unsigned interface, unsigned alt) | |||
335 | if (uvc->state != UVC_STATE_CONNECTED) | 351 | if (uvc->state != UVC_STATE_CONNECTED) |
336 | return 0; | 352 | return 0; |
337 | 353 | ||
338 | if (uvc->video.ep) { | 354 | if (!uvc->video.ep) |
339 | ret = config_ep_by_speed(f->config->cdev->gadget, | 355 | return -EINVAL; |
340 | &(uvc->func), uvc->video.ep); | 356 | |
341 | if (ret) | 357 | if (uvc->video.ep->driver_data) { |
342 | return ret; | 358 | INFO(cdev, "reset UVC\n"); |
343 | usb_ep_enable(uvc->video.ep); | 359 | usb_ep_disable(uvc->video.ep); |
360 | uvc->video.ep->driver_data = NULL; | ||
344 | } | 361 | } |
345 | 362 | ||
363 | ret = config_ep_by_speed(f->config->cdev->gadget, | ||
364 | &(uvc->func), uvc->video.ep); | ||
365 | if (ret) | ||
366 | return ret; | ||
367 | usb_ep_enable(uvc->video.ep); | ||
368 | uvc->video.ep->driver_data = uvc; | ||
369 | |||
346 | memset(&v4l2_event, 0, sizeof(v4l2_event)); | 370 | memset(&v4l2_event, 0, sizeof(v4l2_event)); |
347 | v4l2_event.type = UVC_EVENT_STREAMON; | 371 | v4l2_event.type = UVC_EVENT_STREAMON; |
348 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 372 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
@@ -366,6 +390,16 @@ uvc_function_disable(struct usb_function *f) | |||
366 | v4l2_event_queue(uvc->vdev, &v4l2_event); | 390 | v4l2_event_queue(uvc->vdev, &v4l2_event); |
367 | 391 | ||
368 | uvc->state = UVC_STATE_DISCONNECTED; | 392 | uvc->state = UVC_STATE_DISCONNECTED; |
393 | |||
394 | if (uvc->video.ep->driver_data) { | ||
395 | usb_ep_disable(uvc->video.ep); | ||
396 | uvc->video.ep->driver_data = NULL; | ||
397 | } | ||
398 | |||
399 | if (uvc->control_ep->driver_data) { | ||
400 | usb_ep_disable(uvc->control_ep); | ||
401 | uvc->control_ep->driver_data = NULL; | ||
402 | } | ||
369 | } | 403 | } |
370 | 404 | ||
371 | /* -------------------------------------------------------------------------- | 405 | /* -------------------------------------------------------------------------- |
diff --git a/drivers/usb/gadget/function/uvc_video.c b/drivers/usb/gadget/function/uvc_video.c index c3e1f27dbbef..9cb86bc1a9a5 100644 --- a/drivers/usb/gadget/function/uvc_video.c +++ b/drivers/usb/gadget/function/uvc_video.c | |||
@@ -352,7 +352,8 @@ int uvcg_video_enable(struct uvc_video *video, int enable) | |||
352 | 352 | ||
353 | if (!enable) { | 353 | if (!enable) { |
354 | for (i = 0; i < UVC_NUM_REQUESTS; ++i) | 354 | for (i = 0; i < UVC_NUM_REQUESTS; ++i) |
355 | usb_ep_dequeue(video->ep, video->req[i]); | 355 | if (video->req[i]) |
356 | usb_ep_dequeue(video->ep, video->req[i]); | ||
356 | 357 | ||
357 | uvc_video_free_requests(video); | 358 | uvc_video_free_requests(video); |
358 | uvcg_queue_enable(&video->queue, 0); | 359 | uvcg_queue_enable(&video->queue, 0); |
diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 3ea287b0e448..217365d35a25 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig | |||
@@ -357,6 +357,7 @@ config USB_EG20T | |||
357 | 357 | ||
358 | config USB_GADGET_XILINX | 358 | config USB_GADGET_XILINX |
359 | tristate "Xilinx USB Driver" | 359 | tristate "Xilinx USB Driver" |
360 | depends on HAS_DMA | ||
360 | depends on OF || COMPILE_TEST | 361 | depends on OF || COMPILE_TEST |
361 | help | 362 | help |
362 | USB peripheral controller driver for Xilinx USB2 device. | 363 | USB peripheral controller driver for Xilinx USB2 device. |
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index f107bb60a5ab..f2054659f25b 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c | |||
@@ -507,6 +507,11 @@ static ssize_t usb_udc_softconn_store(struct device *dev, | |||
507 | { | 507 | { |
508 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); | 508 | struct usb_udc *udc = container_of(dev, struct usb_udc, dev); |
509 | 509 | ||
510 | if (!udc->driver) { | ||
511 | dev_err(dev, "soft-connect without a gadget driver\n"); | ||
512 | return -EOPNOTSUPP; | ||
513 | } | ||
514 | |||
510 | if (sysfs_streq(buf, "connect")) { | 515 | if (sysfs_streq(buf, "connect")) { |
511 | usb_gadget_udc_start(udc->gadget, udc->driver); | 516 | usb_gadget_udc_start(udc->gadget, udc->driver); |
512 | usb_gadget_connect(udc->gadget); | 517 | usb_gadget_connect(udc->gadget); |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a8a30b1d4167..a3ca1375dd52 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -234,7 +234,7 @@ config USB_EHCI_SH | |||
234 | 234 | ||
235 | config USB_EHCI_EXYNOS | 235 | config USB_EHCI_EXYNOS |
236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" | 236 | tristate "EHCI support for Samsung S5P/EXYNOS SoC Series" |
237 | depends on PLAT_S5P || ARCH_EXYNOS | 237 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
238 | help | 238 | help |
239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. | 239 | Enable support for the Samsung Exynos SOC's on-chip EHCI controller. |
240 | 240 | ||
@@ -550,7 +550,7 @@ config USB_OHCI_SH | |||
550 | 550 | ||
551 | config USB_OHCI_EXYNOS | 551 | config USB_OHCI_EXYNOS |
552 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" | 552 | tristate "OHCI support for Samsung S5P/EXYNOS SoC Series" |
553 | depends on PLAT_S5P || ARCH_EXYNOS | 553 | depends on ARCH_S5PV210 || ARCH_EXYNOS |
554 | help | 554 | help |
555 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. | 555 | Enable support for the Samsung Exynos SOC's on-chip OHCI controller. |
556 | 556 | ||
diff --git a/drivers/usb/host/hwa-hc.c b/drivers/usb/host/hwa-hc.c index d0d8fadf7066..1db0626c8bf4 100644 --- a/drivers/usb/host/hwa-hc.c +++ b/drivers/usb/host/hwa-hc.c | |||
@@ -607,7 +607,7 @@ found: | |||
607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; | 607 | wa->wa_descr = wa_descr = (struct usb_wa_descriptor *) hdr; |
608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) | 608 | if (le16_to_cpu(wa_descr->bcdWAVersion) > 0x0100) |
609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", | 609 | dev_warn(dev, "Wire Adapter v%d.%d newer than groked v1.0\n", |
610 | le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00 >> 8, | 610 | (le16_to_cpu(wa_descr->bcdWAVersion) & 0xff00) >> 8, |
611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); | 611 | le16_to_cpu(wa_descr->bcdWAVersion) & 0x00ff); |
612 | result = 0; | 612 | result = 0; |
613 | error: | 613 | error: |
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c index 280dde93abe5..9a69b1f1b300 100644 --- a/drivers/usb/host/xhci-pci.c +++ b/drivers/usb/host/xhci-pci.c | |||
@@ -128,20 +128,6 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
128 | xhci->quirks |= XHCI_AVOID_BEI; | 128 | xhci->quirks |= XHCI_AVOID_BEI; |
129 | } | 129 | } |
130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | 130 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && |
131 | (pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_XHCI || | ||
132 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI)) { | ||
133 | /* Workaround for occasional spurious wakeups from S5 (or | ||
134 | * any other sleep) on Haswell machines with LPT and LPT-LP | ||
135 | * with the new Intel BIOS | ||
136 | */ | ||
137 | /* Limit the quirk to only known vendors, as this triggers | ||
138 | * yet another BIOS bug on some other machines | ||
139 | * https://bugzilla.kernel.org/show_bug.cgi?id=66171 | ||
140 | */ | ||
141 | if (pdev->subsystem_vendor == PCI_VENDOR_ID_HP) | ||
142 | xhci->quirks |= XHCI_SPURIOUS_WAKEUP; | ||
143 | } | ||
144 | if (pdev->vendor == PCI_VENDOR_ID_INTEL && | ||
145 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { | 131 | pdev->device == PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_XHCI) { |
146 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; | 132 | xhci->quirks |= XHCI_SPURIOUS_REBOOT; |
147 | } | 133 | } |
@@ -162,6 +148,10 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci) | |||
162 | pdev->device == 0x3432) | 148 | pdev->device == 0x3432) |
163 | xhci->quirks |= XHCI_BROKEN_STREAMS; | 149 | xhci->quirks |= XHCI_BROKEN_STREAMS; |
164 | 150 | ||
151 | if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA && | ||
152 | pdev->device == 0x1042) | ||
153 | xhci->quirks |= XHCI_BROKEN_STREAMS; | ||
154 | |||
165 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 155 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
166 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, | 156 | xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, |
167 | "QUIRK: Resetting on resume"); | 157 | "QUIRK: Resetting on resume"); |
diff --git a/drivers/usb/musb/musb_cppi41.c b/drivers/usb/musb/musb_cppi41.c index acdfb3e68a90..5a9b977fbc19 100644 --- a/drivers/usb/musb/musb_cppi41.c +++ b/drivers/usb/musb/musb_cppi41.c | |||
@@ -209,7 +209,8 @@ static enum hrtimer_restart cppi41_recheck_tx_req(struct hrtimer *timer) | |||
209 | } | 209 | } |
210 | } | 210 | } |
211 | 211 | ||
212 | if (!list_empty(&controller->early_tx_list)) { | 212 | if (!list_empty(&controller->early_tx_list) && |
213 | !hrtimer_is_queued(&controller->early_tx)) { | ||
213 | ret = HRTIMER_RESTART; | 214 | ret = HRTIMER_RESTART; |
214 | hrtimer_forward_now(&controller->early_tx, | 215 | hrtimer_forward_now(&controller->early_tx, |
215 | ktime_set(0, 20 * NSEC_PER_USEC)); | 216 | ktime_set(0, 20 * NSEC_PER_USEC)); |
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index 154bcf1b5dfa..48bc09e7b83b 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c | |||
@@ -868,9 +868,15 @@ static int dsps_suspend(struct device *dev) | |||
868 | struct dsps_glue *glue = dev_get_drvdata(dev); | 868 | struct dsps_glue *glue = dev_get_drvdata(dev); |
869 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 869 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
870 | struct musb *musb = platform_get_drvdata(glue->musb); | 870 | struct musb *musb = platform_get_drvdata(glue->musb); |
871 | void __iomem *mbase = musb->ctrl_base; | 871 | void __iomem *mbase; |
872 | 872 | ||
873 | del_timer_sync(&glue->timer); | 873 | del_timer_sync(&glue->timer); |
874 | |||
875 | if (!musb) | ||
876 | /* This can happen if the musb device is in -EPROBE_DEFER */ | ||
877 | return 0; | ||
878 | |||
879 | mbase = musb->ctrl_base; | ||
874 | glue->context.control = dsps_readl(mbase, wrp->control); | 880 | glue->context.control = dsps_readl(mbase, wrp->control); |
875 | glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); | 881 | glue->context.epintr = dsps_readl(mbase, wrp->epintr_set); |
876 | glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); | 882 | glue->context.coreintr = dsps_readl(mbase, wrp->coreintr_set); |
@@ -887,8 +893,12 @@ static int dsps_resume(struct device *dev) | |||
887 | struct dsps_glue *glue = dev_get_drvdata(dev); | 893 | struct dsps_glue *glue = dev_get_drvdata(dev); |
888 | const struct dsps_musb_wrapper *wrp = glue->wrp; | 894 | const struct dsps_musb_wrapper *wrp = glue->wrp; |
889 | struct musb *musb = platform_get_drvdata(glue->musb); | 895 | struct musb *musb = platform_get_drvdata(glue->musb); |
890 | void __iomem *mbase = musb->ctrl_base; | 896 | void __iomem *mbase; |
897 | |||
898 | if (!musb) | ||
899 | return 0; | ||
891 | 900 | ||
901 | mbase = musb->ctrl_base; | ||
892 | dsps_writel(mbase, wrp->control, glue->context.control); | 902 | dsps_writel(mbase, wrp->control, glue->context.control); |
893 | dsps_writel(mbase, wrp->epintr_set, glue->context.epintr); | 903 | dsps_writel(mbase, wrp->epintr_set, glue->context.epintr); |
894 | dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr); | 904 | dsps_writel(mbase, wrp->coreintr_set, glue->context.coreintr); |
@@ -896,7 +906,9 @@ static int dsps_resume(struct device *dev) | |||
896 | dsps_writel(mbase, wrp->mode, glue->context.mode); | 906 | dsps_writel(mbase, wrp->mode, glue->context.mode); |
897 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); | 907 | dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode); |
898 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); | 908 | dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode); |
899 | setup_timer(&glue->timer, otg_timer, (unsigned long) musb); | 909 | if (musb->xceiv->state == OTG_STATE_B_IDLE && |
910 | musb->port_mode == MUSB_PORT_MODE_DUAL_ROLE) | ||
911 | mod_timer(&glue->timer, jiffies + wrp->poll_seconds * HZ); | ||
900 | 912 | ||
901 | return 0; | 913 | return 0; |
902 | } | 914 | } |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index eca1747ca8c7..cfd009dc4018 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -155,6 +155,7 @@ static const struct usb_device_id id_table[] = { | |||
155 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ | 155 | { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ |
156 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ | 156 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ |
157 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ | 157 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ |
158 | { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ | ||
158 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | 159 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ |
159 | { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ | 160 | { USB_DEVICE(0x1D6F, 0x0010) }, /* Seluxit ApS RF Dongle */ |
160 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ | 161 | { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */ |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index dc72b924c399..0dad8ce5a609 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -140,6 +140,7 @@ static struct ftdi_sio_quirk ftdi_8u2232c_quirk = { | |||
140 | * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. | 140 | * /sys/bus/usb-serial/drivers/ftdi_sio/new_id and send a patch or report. |
141 | */ | 141 | */ |
142 | static const struct usb_device_id id_table_combined[] = { | 142 | static const struct usb_device_id id_table_combined[] = { |
143 | { USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) }, | ||
143 | { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, | 144 | { USB_DEVICE(FTDI_VID, FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID) }, |
144 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, | 145 | { USB_DEVICE(FTDI_VID, FTDI_CTI_MINI_PID) }, |
145 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, | 146 | { USB_DEVICE(FTDI_VID, FTDI_CTI_NANO_PID) }, |
@@ -661,6 +662,8 @@ static const struct usb_device_id id_table_combined[] = { | |||
661 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, | 662 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) }, |
662 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, | 663 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) }, |
663 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, | 664 | { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) }, |
665 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, | ||
666 | { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, | ||
664 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, | 667 | { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, |
665 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, | 668 | { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, |
666 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, | 669 | { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, |
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h index 5937b2d242f2..6786b705ccf6 100644 --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h | |||
@@ -30,6 +30,12 @@ | |||
30 | 30 | ||
31 | /*** third-party PIDs (using FTDI_VID) ***/ | 31 | /*** third-party PIDs (using FTDI_VID) ***/ |
32 | 32 | ||
33 | /* | ||
34 | * Certain versions of the official Windows FTDI driver reprogrammed | ||
35 | * counterfeit FTDI devices to PID 0. Support these devices anyway. | ||
36 | */ | ||
37 | #define FTDI_BRICK_PID 0x0000 | ||
38 | |||
33 | #define FTDI_LUMEL_PD12_PID 0x6002 | 39 | #define FTDI_LUMEL_PD12_PID 0x6002 |
34 | 40 | ||
35 | /* | 41 | /* |
@@ -143,8 +149,12 @@ | |||
143 | * Xsens Technologies BV products (http://www.xsens.com). | 149 | * Xsens Technologies BV products (http://www.xsens.com). |
144 | */ | 150 | */ |
145 | #define XSENS_VID 0x2639 | 151 | #define XSENS_VID 0x2639 |
146 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | 152 | #define XSENS_AWINDA_STATION_PID 0x0101 |
153 | #define XSENS_AWINDA_DONGLE_PID 0x0102 | ||
147 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ | 154 | #define XSENS_MTW_PID 0x0200 /* Xsens MTw */ |
155 | #define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ | ||
156 | |||
157 | /* Xsens devices using FTDI VID */ | ||
148 | #define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ | 158 | #define XSENS_CONVERTER_0_PID 0xD388 /* Xsens USB converter */ |
149 | #define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ | 159 | #define XSENS_CONVERTER_1_PID 0xD389 /* Xsens Wireless Receiver */ |
150 | #define XSENS_CONVERTER_2_PID 0xD38A | 160 | #define XSENS_CONVERTER_2_PID 0xD38A |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 078f9ed419c8..02c420af251e 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -335,7 +335,8 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
335 | port->interrupt_out_urb->transfer_buffer_length = length; | 335 | port->interrupt_out_urb->transfer_buffer_length = length; |
336 | 336 | ||
337 | priv->cur_pos = priv->cur_pos + length; | 337 | priv->cur_pos = priv->cur_pos + length; |
338 | result = usb_submit_urb(port->interrupt_out_urb, GFP_NOIO); | 338 | result = usb_submit_urb(port->interrupt_out_urb, |
339 | GFP_ATOMIC); | ||
339 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); | 340 | dev_dbg(&port->dev, "%s - Send write URB returns: %i\n", __func__, result); |
340 | todo = priv->filled - priv->cur_pos; | 341 | todo = priv->filled - priv->cur_pos; |
341 | 342 | ||
@@ -350,7 +351,7 @@ static int kobil_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
350 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || | 351 | if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || |
351 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { | 352 | priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { |
352 | result = usb_submit_urb(port->interrupt_in_urb, | 353 | result = usb_submit_urb(port->interrupt_in_urb, |
353 | GFP_NOIO); | 354 | GFP_ATOMIC); |
354 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); | 355 | dev_dbg(&port->dev, "%s - Send read URB returns: %i\n", __func__, result); |
355 | } | 356 | } |
356 | } | 357 | } |
@@ -414,8 +415,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
414 | int result; | 415 | int result; |
415 | int dtr = 0; | 416 | int dtr = 0; |
416 | int rts = 0; | 417 | int rts = 0; |
417 | unsigned char *transfer_buffer; | ||
418 | int transfer_buffer_length = 8; | ||
419 | 418 | ||
420 | /* FIXME: locking ? */ | 419 | /* FIXME: locking ? */ |
421 | priv = usb_get_serial_port_data(port); | 420 | priv = usb_get_serial_port_data(port); |
@@ -425,11 +424,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
425 | return -EINVAL; | 424 | return -EINVAL; |
426 | } | 425 | } |
427 | 426 | ||
428 | /* allocate memory for transfer buffer */ | ||
429 | transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL); | ||
430 | if (!transfer_buffer) | ||
431 | return -ENOMEM; | ||
432 | |||
433 | if (set & TIOCM_RTS) | 427 | if (set & TIOCM_RTS) |
434 | rts = 1; | 428 | rts = 1; |
435 | if (set & TIOCM_DTR) | 429 | if (set & TIOCM_DTR) |
@@ -469,7 +463,6 @@ static int kobil_tiocmset(struct tty_struct *tty, | |||
469 | KOBIL_TIMEOUT); | 463 | KOBIL_TIMEOUT); |
470 | } | 464 | } |
471 | dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result); | 465 | dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, result); |
472 | kfree(transfer_buffer); | ||
473 | return (result < 0) ? result : 0; | 466 | return (result < 0) ? result : 0; |
474 | } | 467 | } |
475 | 468 | ||
@@ -530,8 +523,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
530 | { | 523 | { |
531 | struct usb_serial_port *port = tty->driver_data; | 524 | struct usb_serial_port *port = tty->driver_data; |
532 | struct kobil_private *priv = usb_get_serial_port_data(port); | 525 | struct kobil_private *priv = usb_get_serial_port_data(port); |
533 | unsigned char *transfer_buffer; | ||
534 | int transfer_buffer_length = 8; | ||
535 | int result; | 526 | int result; |
536 | 527 | ||
537 | if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || | 528 | if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID || |
@@ -541,10 +532,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
541 | 532 | ||
542 | switch (cmd) { | 533 | switch (cmd) { |
543 | case TCFLSH: | 534 | case TCFLSH: |
544 | transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL); | ||
545 | if (!transfer_buffer) | ||
546 | return -ENOBUFS; | ||
547 | |||
548 | result = usb_control_msg(port->serial->dev, | 535 | result = usb_control_msg(port->serial->dev, |
549 | usb_sndctrlpipe(port->serial->dev, 0), | 536 | usb_sndctrlpipe(port->serial->dev, 0), |
550 | SUSBCRequest_Misc, | 537 | SUSBCRequest_Misc, |
@@ -559,7 +546,6 @@ static int kobil_ioctl(struct tty_struct *tty, | |||
559 | dev_dbg(&port->dev, | 546 | dev_dbg(&port->dev, |
560 | "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", | 547 | "%s - Send reset_all_queues (FLUSH) URB returns: %i\n", |
561 | __func__, result); | 548 | __func__, result); |
562 | kfree(transfer_buffer); | ||
563 | return (result < 0) ? -EIO: 0; | 549 | return (result < 0) ? -EIO: 0; |
564 | default: | 550 | default: |
565 | return -ENOIOCTLCMD; | 551 | return -ENOIOCTLCMD; |
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 4856fb7e637e..4b7bfb394a32 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -215,7 +215,7 @@ static int opticon_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
215 | 215 | ||
216 | /* The connected devices do not have a bulk write endpoint, | 216 | /* The connected devices do not have a bulk write endpoint, |
217 | * to transmit data to de barcode device the control endpoint is used */ | 217 | * to transmit data to de barcode device the control endpoint is used */ |
218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_NOIO); | 218 | dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_ATOMIC); |
219 | if (!dr) { | 219 | if (!dr) { |
220 | count = -ENOMEM; | 220 | count = -ENOMEM; |
221 | goto error_no_dr; | 221 | goto error_no_dr; |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index d1a3f6044c8a..7a4c21b4f676 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -269,6 +269,7 @@ static void option_instat_callback(struct urb *urb); | |||
269 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 | 269 | #define TELIT_PRODUCT_DE910_DUAL 0x1010 |
270 | #define TELIT_PRODUCT_UE910_V2 0x1012 | 270 | #define TELIT_PRODUCT_UE910_V2 0x1012 |
271 | #define TELIT_PRODUCT_LE920 0x1200 | 271 | #define TELIT_PRODUCT_LE920 0x1200 |
272 | #define TELIT_PRODUCT_LE910 0x1201 | ||
272 | 273 | ||
273 | /* ZTE PRODUCTS */ | 274 | /* ZTE PRODUCTS */ |
274 | #define ZTE_VENDOR_ID 0x19d2 | 275 | #define ZTE_VENDOR_ID 0x19d2 |
@@ -362,6 +363,7 @@ static void option_instat_callback(struct urb *urb); | |||
362 | 363 | ||
363 | /* Haier products */ | 364 | /* Haier products */ |
364 | #define HAIER_VENDOR_ID 0x201e | 365 | #define HAIER_VENDOR_ID 0x201e |
366 | #define HAIER_PRODUCT_CE81B 0x10f8 | ||
365 | #define HAIER_PRODUCT_CE100 0x2009 | 367 | #define HAIER_PRODUCT_CE100 0x2009 |
366 | 368 | ||
367 | /* Cinterion (formerly Siemens) products */ | 369 | /* Cinterion (formerly Siemens) products */ |
@@ -589,6 +591,11 @@ static const struct option_blacklist_info zte_1255_blacklist = { | |||
589 | .reserved = BIT(3) | BIT(4), | 591 | .reserved = BIT(3) | BIT(4), |
590 | }; | 592 | }; |
591 | 593 | ||
594 | static const struct option_blacklist_info telit_le910_blacklist = { | ||
595 | .sendsetup = BIT(0), | ||
596 | .reserved = BIT(1) | BIT(2), | ||
597 | }; | ||
598 | |||
592 | static const struct option_blacklist_info telit_le920_blacklist = { | 599 | static const struct option_blacklist_info telit_le920_blacklist = { |
593 | .sendsetup = BIT(0), | 600 | .sendsetup = BIT(0), |
594 | .reserved = BIT(1) | BIT(5), | 601 | .reserved = BIT(1) | BIT(5), |
@@ -1138,6 +1145,8 @@ static const struct usb_device_id option_ids[] = { | |||
1138 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, | 1145 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) }, |
1139 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, | 1146 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) }, |
1140 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, | 1147 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) }, |
1148 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910), | ||
1149 | .driver_info = (kernel_ulong_t)&telit_le910_blacklist }, | ||
1141 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), | 1150 | { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920), |
1142 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, | 1151 | .driver_info = (kernel_ulong_t)&telit_le920_blacklist }, |
1143 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ | 1152 | { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 0xff, 0xff) }, /* ZTE WCDMA products */ |
@@ -1621,6 +1630,7 @@ static const struct usb_device_id option_ids[] = { | |||
1621 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, | 1630 | { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) }, |
1622 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, | 1631 | { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) }, |
1623 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, | 1632 | { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) }, |
1633 | { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 0xff, 0xff, 0xff) }, | ||
1624 | /* Pirelli */ | 1634 | /* Pirelli */ |
1625 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, | 1635 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 0xff) }, |
1626 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, | 1636 | { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 0xff) }, |
diff --git a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c index 4bc2fc98636e..73f125e0cb58 100644 --- a/drivers/usb/storage/initializers.c +++ b/drivers/usb/storage/initializers.c | |||
@@ -52,7 +52,7 @@ int usb_stor_euscsi_init(struct us_data *us) | |||
52 | us->iobuf[0] = 0x1; | 52 | us->iobuf[0] = 0x1; |
53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 53 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, | 54 | 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, |
55 | 0x01, 0x0, us->iobuf, 0x1, USB_CTRL_SET_TIMEOUT); | 55 | 0x01, 0x0, us->iobuf, 0x1, 5 * HZ); |
56 | usb_stor_dbg(us, "-- result is %d\n", result); | 56 | usb_stor_dbg(us, "-- result is %d\n", result); |
57 | 57 | ||
58 | return 0; | 58 | return 0; |
@@ -100,7 +100,7 @@ int usb_stor_huawei_e220_init(struct us_data *us) | |||
100 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, | 100 | result = usb_stor_control_msg(us, us->send_ctrl_pipe, |
101 | USB_REQ_SET_FEATURE, | 101 | USB_REQ_SET_FEATURE, |
102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, | 102 | USB_TYPE_STANDARD | USB_RECIP_DEVICE, |
103 | 0x01, 0x0, NULL, 0x0, 1000); | 103 | 0x01, 0x0, NULL, 0x0, 1 * HZ); |
104 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); | 104 | usb_stor_dbg(us, "Huawei mode set result is %d\n", result); |
105 | return 0; | 105 | return 0; |
106 | } | 106 | } |
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c index 8591d89a38e6..27e4a580d2ed 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c | |||
@@ -626,6 +626,7 @@ static int config_autodelink_after_power_on(struct us_data *us) | |||
626 | return 0; | 626 | return 0; |
627 | } | 627 | } |
628 | 628 | ||
629 | #ifdef CONFIG_PM | ||
629 | static int config_autodelink_before_power_down(struct us_data *us) | 630 | static int config_autodelink_before_power_down(struct us_data *us) |
630 | { | 631 | { |
631 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); | 632 | struct rts51x_chip *chip = (struct rts51x_chip *)(us->extra); |
@@ -716,6 +717,7 @@ static void fw5895_init(struct us_data *us) | |||
716 | } | 717 | } |
717 | } | 718 | } |
718 | } | 719 | } |
720 | #endif | ||
719 | 721 | ||
720 | #ifdef CONFIG_REALTEK_AUTOPM | 722 | #ifdef CONFIG_REALTEK_AUTOPM |
721 | static void fw5895_set_mmc_wp(struct us_data *us) | 723 | static void fw5895_set_mmc_wp(struct us_data *us) |
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c index 22c7d4360fa2..b1d815eb6d0b 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c | |||
@@ -1118,6 +1118,31 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1118 | */ | 1118 | */ |
1119 | if (result == USB_STOR_XFER_LONG) | 1119 | if (result == USB_STOR_XFER_LONG) |
1120 | fake_sense = 1; | 1120 | fake_sense = 1; |
1121 | |||
1122 | /* | ||
1123 | * Sometimes a device will mistakenly skip the data phase | ||
1124 | * and go directly to the status phase without sending a | ||
1125 | * zero-length packet. If we get a 13-byte response here, | ||
1126 | * check whether it really is a CSW. | ||
1127 | */ | ||
1128 | if (result == USB_STOR_XFER_SHORT && | ||
1129 | srb->sc_data_direction == DMA_FROM_DEVICE && | ||
1130 | transfer_length - scsi_get_resid(srb) == | ||
1131 | US_BULK_CS_WRAP_LEN) { | ||
1132 | struct scatterlist *sg = NULL; | ||
1133 | unsigned int offset = 0; | ||
1134 | |||
1135 | if (usb_stor_access_xfer_buf((unsigned char *) bcs, | ||
1136 | US_BULK_CS_WRAP_LEN, srb, &sg, | ||
1137 | &offset, FROM_XFER_BUF) == | ||
1138 | US_BULK_CS_WRAP_LEN && | ||
1139 | bcs->Signature == | ||
1140 | cpu_to_le32(US_BULK_CS_SIGN)) { | ||
1141 | usb_stor_dbg(us, "Device skipped data phase\n"); | ||
1142 | scsi_set_resid(srb, transfer_length); | ||
1143 | goto skipped_data_phase; | ||
1144 | } | ||
1145 | } | ||
1121 | } | 1146 | } |
1122 | 1147 | ||
1123 | /* See flow chart on pg 15 of the Bulk Only Transport spec for | 1148 | /* See flow chart on pg 15 of the Bulk Only Transport spec for |
@@ -1153,6 +1178,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us) | |||
1153 | if (result != USB_STOR_XFER_GOOD) | 1178 | if (result != USB_STOR_XFER_GOOD) |
1154 | return USB_STOR_TRANSPORT_ERROR; | 1179 | return USB_STOR_TRANSPORT_ERROR; |
1155 | 1180 | ||
1181 | skipped_data_phase: | ||
1156 | /* check bulk status */ | 1182 | /* check bulk status */ |
1157 | residue = le32_to_cpu(bcs->Residue); | 1183 | residue = le32_to_cpu(bcs->Residue); |
1158 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", | 1184 | usb_stor_dbg(us, "Bulk Status S 0x%x T 0x%x R %u Stat 0x%x\n", |
diff --git a/drivers/usb/storage/unusual_uas.h b/drivers/usb/storage/unusual_uas.h index 8511b54a65d9..2fefaf923e4a 100644 --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h | |||
@@ -54,6 +54,20 @@ UNUSUAL_DEV(0x0bc2, 0x3312, 0x0000, 0x9999, | |||
54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 54 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
55 | US_FL_NO_ATA_1X), | 55 | US_FL_NO_ATA_1X), |
56 | 56 | ||
57 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
58 | UNUSUAL_DEV(0x0bc2, 0x3320, 0x0000, 0x9999, | ||
59 | "Seagate", | ||
60 | "Expansion Desk", | ||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
62 | US_FL_NO_ATA_1X), | ||
63 | |||
64 | /* Reported-by: Bogdan Mihalcea <bogdan.mihalcea@infim.ro> */ | ||
65 | UNUSUAL_DEV(0x0bc2, 0xa003, 0x0000, 0x9999, | ||
66 | "Seagate", | ||
67 | "Backup Plus", | ||
68 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
69 | US_FL_NO_ATA_1X), | ||
70 | |||
57 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | 71 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ |
58 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | 72 | UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, |
59 | "Seagate", | 73 | "Seagate", |
@@ -61,6 +75,13 @@ UNUSUAL_DEV(0x0bc2, 0xab20, 0x0000, 0x9999, | |||
61 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 75 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
62 | US_FL_NO_ATA_1X), | 76 | US_FL_NO_ATA_1X), |
63 | 77 | ||
78 | /* https://bbs.archlinux.org/viewtopic.php?id=183190 */ | ||
79 | UNUSUAL_DEV(0x0bc2, 0xab21, 0x0000, 0x9999, | ||
80 | "Seagate", | ||
81 | "Backup+ BK", | ||
82 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
83 | US_FL_NO_ATA_1X), | ||
84 | |||
64 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ | 85 | /* Reported-by: Claudio Bizzarri <claudio.bizzarri@gmail.com> */ |
65 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, | 86 | UNUSUAL_DEV(0x152d, 0x0567, 0x0000, 0x9999, |
66 | "JMicron", | 87 | "JMicron", |
@@ -75,3 +96,10 @@ UNUSUAL_DEV(0x174c, 0x5106, 0x0000, 0x9999, | |||
75 | "ASM1051", | 96 | "ASM1051", |
76 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | 97 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, |
77 | US_FL_IGNORE_UAS), | 98 | US_FL_IGNORE_UAS), |
99 | |||
100 | /* Reported-by: Hans de Goede <hdegoede@redhat.com> */ | ||
101 | UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, | ||
102 | "VIA", | ||
103 | "VL711", | ||
104 | USB_SC_DEVICE, USB_PR_DEVICE, NULL, | ||
105 | US_FL_NO_ATA_1X), | ||