aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-06-07 01:06:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-07 01:06:53 -0400
commite900f2c0973b0e9eb549230be55bacef9eea6f65 (patch)
tree054db70b8ad091ef3be16828e7616b04b5b52862
parentbe19c4ab813a0fec6cd8204a998e8904ad0f8ed3 (diff)
parent9d082030692ab37c7d5c1f357b34d9170256d581 (diff)
Merge tag 'usb-4.1-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB and PHY driver fixes from Greg KH: "Here are some USB and PHY driver fixes that resolve some reported regressions. Also in here are some new device ids. All of the details are in the shortlog and these patches have been in linux-next with no problems" * tag 'usb-4.1-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (22 commits) USB: cp210x: add ID for HubZ dual ZigBee and Z-Wave dongle usb: renesas_usbhs: Don't disable the pipe if Control write status stage usb: renesas_usbhs: Fix fifo unclear in usbhsf_prepare_pop usb: gadget: f_fs: fix check in read operation usb: musb: fix order of conditions for assigning end point operations usb: gadget: f_uac1: check return code from config_ep_by_speed usb: gadget: ffs: fix: Always call ffs_closed() in ffs_data_clear() usb: gadget: g_ffs: Fix counting of missing_functions usb: s3c2410_udc: correct reversed pullup logic usb: dwc3: gadget: Fix incorrect DEPCMD and DGCMD status macros usb: phy: tahvo: Pass the IRQF_ONESHOT flag usb: phy: ab8500-usb: Pass the IRQF_ONESHOT flag usb: renesas_usbhs: Revise the binding document about the dma-names usb: host: xhci: add mutex for non-thread-safe data usb: make module xhci_hcd removable USB: serial: ftdi_sio: Add support for a Motion Tracker Development Board usb: gadget: f_midi: fix segfault when reading empty id phy: phy-rcar-gen2: Fix USBHS_UGSTS_LOCK value phy: omap-usb2: invoke pm_runtime_disable on error path phy: fix Kconfig dependencies ...
-rw-r--r--Documentation/devicetree/bindings/usb/renesas_usbhs.txt6
-rw-r--r--drivers/phy/Kconfig10
-rw-r--r--drivers/phy/phy-core.c4
-rw-r--r--drivers/phy/phy-omap-usb2.c1
-rw-r--r--drivers/phy/phy-rcar-gen2.c4
-rw-r--r--drivers/usb/dwc3/core.h4
-rw-r--r--drivers/usb/gadget/function/f_fs.c15
-rw-r--r--drivers/usb/gadget/function/f_midi.c8
-rw-r--r--drivers/usb/gadget/function/f_uac1.c5
-rw-r--r--drivers/usb/gadget/legacy/g_ffs.c4
-rw-r--r--drivers/usb/gadget/udc/s3c2410_udc.c2
-rw-r--r--drivers/usb/host/xhci.c57
-rw-r--r--drivers/usb/host/xhci.h2
-rw-r--r--drivers/usb/musb/musb_core.c14
-rw-r--r--drivers/usb/phy/phy-ab8500-usb.c6
-rw-r--r--drivers/usb/phy/phy-tahvo.c3
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c38
-rw-r--r--drivers/usb/serial/cp210x.c1
-rw-r--r--drivers/usb/serial/ftdi_sio.c1
-rw-r--r--drivers/usb/serial/ftdi_sio_ids.h1
20 files changed, 123 insertions, 63 deletions
diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index dc2a18f0b3a1..ddbe304beb21 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -15,10 +15,8 @@ Optional properties:
15 - phys: phandle + phy specifier pair 15 - phys: phandle + phy specifier pair
16 - phy-names: must be "usb" 16 - phy-names: must be "usb"
17 - dmas: Must contain a list of references to DMA specifiers. 17 - dmas: Must contain a list of references to DMA specifiers.
18 - dma-names : Must contain a list of DMA names: 18 - dma-names : named "ch%d", where %d is the channel number ranging from zero
19 - tx0 ... tx<n> 19 to the number of channels (DnFIFOs) minus one.
20 - rx0 ... rx<n>
21 - This <n> means DnFIFO in USBHS module.
22 20
23Example: 21Example:
24 usbhs: usb@e6590000 { 22 usbhs: usb@e6590000 {
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index a53bd5b52df9..fc9b9f0ea91e 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -38,7 +38,9 @@ config ARMADA375_USBCLUSTER_PHY
38config PHY_DM816X_USB 38config PHY_DM816X_USB
39 tristate "TI dm816x USB PHY driver" 39 tristate "TI dm816x USB PHY driver"
40 depends on ARCH_OMAP2PLUS 40 depends on ARCH_OMAP2PLUS
41 depends on USB_SUPPORT
41 select GENERIC_PHY 42 select GENERIC_PHY
43 select USB_PHY
42 help 44 help
43 Enable this for dm816x USB to work. 45 Enable this for dm816x USB to work.
44 46
@@ -97,8 +99,9 @@ config OMAP_CONTROL_PHY
97config OMAP_USB2 99config OMAP_USB2
98 tristate "OMAP USB2 PHY Driver" 100 tristate "OMAP USB2 PHY Driver"
99 depends on ARCH_OMAP2PLUS 101 depends on ARCH_OMAP2PLUS
100 depends on USB_PHY 102 depends on USB_SUPPORT
101 select GENERIC_PHY 103 select GENERIC_PHY
104 select USB_PHY
102 select OMAP_CONTROL_PHY 105 select OMAP_CONTROL_PHY
103 depends on OMAP_OCP2SCP 106 depends on OMAP_OCP2SCP
104 help 107 help
@@ -122,8 +125,9 @@ config TI_PIPE3
122config TWL4030_USB 125config TWL4030_USB
123 tristate "TWL4030 USB Transceiver Driver" 126 tristate "TWL4030 USB Transceiver Driver"
124 depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS 127 depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
125 depends on USB_PHY 128 depends on USB_SUPPORT
126 select GENERIC_PHY 129 select GENERIC_PHY
130 select USB_PHY
127 help 131 help
128 Enable this to support the USB OTG transceiver on TWL4030 132 Enable this to support the USB OTG transceiver on TWL4030
129 family chips (including the TWL5030 and TPS659x0 devices). 133 family chips (including the TWL5030 and TPS659x0 devices).
@@ -304,7 +308,7 @@ config PHY_STIH41X_USB
304 308
305config PHY_QCOM_UFS 309config PHY_QCOM_UFS
306 tristate "Qualcomm UFS PHY driver" 310 tristate "Qualcomm UFS PHY driver"
307 depends on OF && ARCH_MSM 311 depends on OF && ARCH_QCOM
308 select GENERIC_PHY 312 select GENERIC_PHY
309 help 313 help
310 Support for UFS PHY on QCOM chipsets. 314 Support for UFS PHY on QCOM chipsets.
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 3791838f4bd4..63bc12d7a73e 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -530,7 +530,7 @@ struct phy *phy_optional_get(struct device *dev, const char *string)
530{ 530{
531 struct phy *phy = phy_get(dev, string); 531 struct phy *phy = phy_get(dev, string);
532 532
533 if (PTR_ERR(phy) == -ENODEV) 533 if (IS_ERR(phy) && (PTR_ERR(phy) == -ENODEV))
534 phy = NULL; 534 phy = NULL;
535 535
536 return phy; 536 return phy;
@@ -584,7 +584,7 @@ struct phy *devm_phy_optional_get(struct device *dev, const char *string)
584{ 584{
585 struct phy *phy = devm_phy_get(dev, string); 585 struct phy *phy = devm_phy_get(dev, string);
586 586
587 if (PTR_ERR(phy) == -ENODEV) 587 if (IS_ERR(phy) && (PTR_ERR(phy) == -ENODEV))
588 phy = NULL; 588 phy = NULL;
589 589
590 return phy; 590 return phy;
diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
index 183ef4368101..c1a468686bdc 100644
--- a/drivers/phy/phy-omap-usb2.c
+++ b/drivers/phy/phy-omap-usb2.c
@@ -275,6 +275,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
275 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k"); 275 phy->wkupclk = devm_clk_get(phy->dev, "usb_phy_cm_clk32k");
276 if (IS_ERR(phy->wkupclk)) { 276 if (IS_ERR(phy->wkupclk)) {
277 dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n"); 277 dev_err(&pdev->dev, "unable to get usb_phy_cm_clk32k\n");
278 pm_runtime_disable(phy->dev);
278 return PTR_ERR(phy->wkupclk); 279 return PTR_ERR(phy->wkupclk);
279 } else { 280 } else {
280 dev_warn(&pdev->dev, 281 dev_warn(&pdev->dev,
diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c
index 778276aba3aa..97d45f47d1ad 100644
--- a/drivers/phy/phy-rcar-gen2.c
+++ b/drivers/phy/phy-rcar-gen2.c
@@ -23,7 +23,7 @@
23#define USBHS_LPSTS 0x02 23#define USBHS_LPSTS 0x02
24#define USBHS_UGCTRL 0x80 24#define USBHS_UGCTRL 0x80
25#define USBHS_UGCTRL2 0x84 25#define USBHS_UGCTRL2 0x84
26#define USBHS_UGSTS 0x88 /* The manuals have 0x90 */ 26#define USBHS_UGSTS 0x88 /* From technical update */
27 27
28/* Low Power Status register (LPSTS) */ 28/* Low Power Status register (LPSTS) */
29#define USBHS_LPSTS_SUSPM 0x4000 29#define USBHS_LPSTS_SUSPM 0x4000
@@ -41,7 +41,7 @@
41#define USBHS_UGCTRL2_USB0SEL_HS_USB 0x00000030 41#define USBHS_UGCTRL2_USB0SEL_HS_USB 0x00000030
42 42
43/* USB General status register (UGSTS) */ 43/* USB General status register (UGSTS) */
44#define USBHS_UGSTS_LOCK 0x00000300 /* The manuals have 0x3 */ 44#define USBHS_UGSTS_LOCK 0x00000100 /* From technical update */
45 45
46#define PHYS_PER_CHANNEL 2 46#define PHYS_PER_CHANNEL 2
47 47
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index fdab715a0631..c0eafa6fd403 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -339,7 +339,7 @@
339#define DWC3_DGCMD_SET_ENDPOINT_NRDY 0x0c 339#define DWC3_DGCMD_SET_ENDPOINT_NRDY 0x0c
340#define DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK 0x10 340#define DWC3_DGCMD_RUN_SOC_BUS_LOOPBACK 0x10
341 341
342#define DWC3_DGCMD_STATUS(n) (((n) >> 15) & 1) 342#define DWC3_DGCMD_STATUS(n) (((n) >> 12) & 0x0F)
343#define DWC3_DGCMD_CMDACT (1 << 10) 343#define DWC3_DGCMD_CMDACT (1 << 10)
344#define DWC3_DGCMD_CMDIOC (1 << 8) 344#define DWC3_DGCMD_CMDIOC (1 << 8)
345 345
@@ -355,7 +355,7 @@
355#define DWC3_DEPCMD_PARAM_SHIFT 16 355#define DWC3_DEPCMD_PARAM_SHIFT 16
356#define DWC3_DEPCMD_PARAM(x) ((x) << DWC3_DEPCMD_PARAM_SHIFT) 356#define DWC3_DEPCMD_PARAM(x) ((x) << DWC3_DEPCMD_PARAM_SHIFT)
357#define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f) 357#define DWC3_DEPCMD_GET_RSC_IDX(x) (((x) >> DWC3_DEPCMD_PARAM_SHIFT) & 0x7f)
358#define DWC3_DEPCMD_STATUS(x) (((x) >> 15) & 1) 358#define DWC3_DEPCMD_STATUS(x) (((x) >> 12) & 0x0F)
359#define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11) 359#define DWC3_DEPCMD_HIPRI_FORCERM (1 << 11)
360#define DWC3_DEPCMD_CMDACT (1 << 10) 360#define DWC3_DEPCMD_CMDACT (1 << 10)
361#define DWC3_DEPCMD_CMDIOC (1 << 8) 361#define DWC3_DEPCMD_CMDIOC (1 << 8)
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
index 6bdb57069044..3507f880eb74 100644
--- a/drivers/usb/gadget/function/f_fs.c
+++ b/drivers/usb/gadget/function/f_fs.c
@@ -315,7 +315,6 @@ static ssize_t ffs_ep0_write(struct file *file, const char __user *buf,
315 return ret; 315 return ret;
316 } 316 }
317 317
318 set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);
319 return len; 318 return len;
320 } 319 }
321 break; 320 break;
@@ -847,7 +846,7 @@ static ssize_t ffs_epfile_io(struct file *file, struct ffs_io_data *io_data)
847 ret = ep->status; 846 ret = ep->status;
848 if (io_data->read && ret > 0) { 847 if (io_data->read && ret > 0) {
849 ret = copy_to_iter(data, ret, &io_data->data); 848 ret = copy_to_iter(data, ret, &io_data->data);
850 if (unlikely(iov_iter_count(&io_data->data))) 849 if (!ret)
851 ret = -EFAULT; 850 ret = -EFAULT;
852 } 851 }
853 } 852 }
@@ -1463,8 +1462,7 @@ static void ffs_data_clear(struct ffs_data *ffs)
1463{ 1462{
1464 ENTER(); 1463 ENTER();
1465 1464
1466 if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags)) 1465 ffs_closed(ffs);
1467 ffs_closed(ffs);
1468 1466
1469 BUG_ON(ffs->gadget); 1467 BUG_ON(ffs->gadget);
1470 1468
@@ -3422,9 +3420,13 @@ static int ffs_ready(struct ffs_data *ffs)
3422 ffs_obj->desc_ready = true; 3420 ffs_obj->desc_ready = true;
3423 ffs_obj->ffs_data = ffs; 3421 ffs_obj->ffs_data = ffs;
3424 3422
3425 if (ffs_obj->ffs_ready_callback) 3423 if (ffs_obj->ffs_ready_callback) {
3426 ret = ffs_obj->ffs_ready_callback(ffs); 3424 ret = ffs_obj->ffs_ready_callback(ffs);
3425 if (ret)
3426 goto done;
3427 }
3427 3428
3429 set_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags);
3428done: 3430done:
3429 ffs_dev_unlock(); 3431 ffs_dev_unlock();
3430 return ret; 3432 return ret;
@@ -3443,7 +3445,8 @@ static void ffs_closed(struct ffs_data *ffs)
3443 3445
3444 ffs_obj->desc_ready = false; 3446 ffs_obj->desc_ready = false;
3445 3447
3446 if (ffs_obj->ffs_closed_callback) 3448 if (test_and_clear_bit(FFS_FL_CALL_CLOSED_CALLBACK, &ffs->flags) &&
3449 ffs_obj->ffs_closed_callback)
3447 ffs_obj->ffs_closed_callback(ffs); 3450 ffs_obj->ffs_closed_callback(ffs);
3448 3451
3449 if (!ffs_obj->opts || ffs_obj->opts->no_configfs 3452 if (!ffs_obj->opts || ffs_obj->opts->no_configfs
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 259b656c0b3e..6316aa5b1c49 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -973,7 +973,13 @@ static ssize_t f_midi_opts_id_show(struct f_midi_opts *opts, char *page)
973 int result; 973 int result;
974 974
975 mutex_lock(&opts->lock); 975 mutex_lock(&opts->lock);
976 result = strlcpy(page, opts->id, PAGE_SIZE); 976 if (opts->id) {
977 result = strlcpy(page, opts->id, PAGE_SIZE);
978 } else {
979 page[0] = 0;
980 result = 0;
981 }
982
977 mutex_unlock(&opts->lock); 983 mutex_unlock(&opts->lock);
978 984
979 return result; 985 return result;
diff --git a/drivers/usb/gadget/function/f_uac1.c b/drivers/usb/gadget/function/f_uac1.c
index 9719abfb6145..7856b3394494 100644
--- a/drivers/usb/gadget/function/f_uac1.c
+++ b/drivers/usb/gadget/function/f_uac1.c
@@ -588,7 +588,10 @@ static int f_audio_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
588 588
589 if (intf == 1) { 589 if (intf == 1) {
590 if (alt == 1) { 590 if (alt == 1) {
591 config_ep_by_speed(cdev->gadget, f, out_ep); 591 err = config_ep_by_speed(cdev->gadget, f, out_ep);
592 if (err)
593 return err;
594
592 usb_ep_enable(out_ep); 595 usb_ep_enable(out_ep);
593 out_ep->driver_data = audio; 596 out_ep->driver_data = audio;
594 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size); 597 audio->copy_buf = f_audio_buffer_alloc(audio_buf_size);
diff --git a/drivers/usb/gadget/legacy/g_ffs.c b/drivers/usb/gadget/legacy/g_ffs.c
index 7b9ef7e257d2..e821931c965c 100644
--- a/drivers/usb/gadget/legacy/g_ffs.c
+++ b/drivers/usb/gadget/legacy/g_ffs.c
@@ -304,8 +304,10 @@ static int functionfs_ready_callback(struct ffs_data *ffs)
304 gfs_registered = true; 304 gfs_registered = true;
305 305
306 ret = usb_composite_probe(&gfs_driver); 306 ret = usb_composite_probe(&gfs_driver);
307 if (unlikely(ret < 0)) 307 if (unlikely(ret < 0)) {
308 ++missing_funcs;
308 gfs_registered = false; 309 gfs_registered = false;
310 }
309 311
310 return ret; 312 return ret;
311} 313}
diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c
index b808951491cc..99fd9a5667df 100644
--- a/drivers/usb/gadget/udc/s3c2410_udc.c
+++ b/drivers/usb/gadget/udc/s3c2410_udc.c
@@ -1487,7 +1487,7 @@ static int s3c2410_udc_pullup(struct usb_gadget *gadget, int is_on)
1487 1487
1488 dprintk(DEBUG_NORMAL, "%s()\n", __func__); 1488 dprintk(DEBUG_NORMAL, "%s()\n", __func__);
1489 1489
1490 s3c2410_udc_set_pullup(udc, is_on ? 0 : 1); 1490 s3c2410_udc_set_pullup(udc, is_on);
1491 return 0; 1491 return 0;
1492} 1492}
1493 1493
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ec8ac1674854..36bf089b708f 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3682,18 +3682,21 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
3682{ 3682{
3683 struct xhci_hcd *xhci = hcd_to_xhci(hcd); 3683 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
3684 unsigned long flags; 3684 unsigned long flags;
3685 int ret; 3685 int ret, slot_id;
3686 struct xhci_command *command; 3686 struct xhci_command *command;
3687 3687
3688 command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); 3688 command = xhci_alloc_command(xhci, false, false, GFP_KERNEL);
3689 if (!command) 3689 if (!command)
3690 return 0; 3690 return 0;
3691 3691
3692 /* xhci->slot_id and xhci->addr_dev are not thread-safe */
3693 mutex_lock(&xhci->mutex);
3692 spin_lock_irqsave(&xhci->lock, flags); 3694 spin_lock_irqsave(&xhci->lock, flags);
3693 command->completion = &xhci->addr_dev; 3695 command->completion = &xhci->addr_dev;
3694 ret = xhci_queue_slot_control(xhci, command, TRB_ENABLE_SLOT, 0); 3696 ret = xhci_queue_slot_control(xhci, command, TRB_ENABLE_SLOT, 0);
3695 if (ret) { 3697 if (ret) {
3696 spin_unlock_irqrestore(&xhci->lock, flags); 3698 spin_unlock_irqrestore(&xhci->lock, flags);
3699 mutex_unlock(&xhci->mutex);
3697 xhci_dbg(xhci, "FIXME: allocate a command ring segment\n"); 3700 xhci_dbg(xhci, "FIXME: allocate a command ring segment\n");
3698 kfree(command); 3701 kfree(command);
3699 return 0; 3702 return 0;
@@ -3702,8 +3705,10 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
3702 spin_unlock_irqrestore(&xhci->lock, flags); 3705 spin_unlock_irqrestore(&xhci->lock, flags);
3703 3706
3704 wait_for_completion(command->completion); 3707 wait_for_completion(command->completion);
3708 slot_id = xhci->slot_id;
3709 mutex_unlock(&xhci->mutex);
3705 3710
3706 if (!xhci->slot_id || command->status != COMP_SUCCESS) { 3711 if (!slot_id || command->status != COMP_SUCCESS) {
3707 xhci_err(xhci, "Error while assigning device slot ID\n"); 3712 xhci_err(xhci, "Error while assigning device slot ID\n");
3708 xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n", 3713 xhci_err(xhci, "Max number of devices this xHCI host supports is %u.\n",
3709 HCS_MAX_SLOTS( 3714 HCS_MAX_SLOTS(
@@ -3728,11 +3733,11 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
3728 * xhci_discover_or_reset_device(), which may be called as part of 3733 * xhci_discover_or_reset_device(), which may be called as part of
3729 * mass storage driver error handling. 3734 * mass storage driver error handling.
3730 */ 3735 */
3731 if (!xhci_alloc_virt_device(xhci, xhci->slot_id, udev, GFP_NOIO)) { 3736 if (!xhci_alloc_virt_device(xhci, slot_id, udev, GFP_NOIO)) {
3732 xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n"); 3737 xhci_warn(xhci, "Could not allocate xHCI USB device data structures\n");
3733 goto disable_slot; 3738 goto disable_slot;
3734 } 3739 }
3735 udev->slot_id = xhci->slot_id; 3740 udev->slot_id = slot_id;
3736 3741
3737#ifndef CONFIG_USB_DEFAULT_PERSIST 3742#ifndef CONFIG_USB_DEFAULT_PERSIST
3738 /* 3743 /*
@@ -3778,12 +3783,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3778 struct xhci_slot_ctx *slot_ctx; 3783 struct xhci_slot_ctx *slot_ctx;
3779 struct xhci_input_control_ctx *ctrl_ctx; 3784 struct xhci_input_control_ctx *ctrl_ctx;
3780 u64 temp_64; 3785 u64 temp_64;
3781 struct xhci_command *command; 3786 struct xhci_command *command = NULL;
3787
3788 mutex_lock(&xhci->mutex);
3782 3789
3783 if (!udev->slot_id) { 3790 if (!udev->slot_id) {
3784 xhci_dbg_trace(xhci, trace_xhci_dbg_address, 3791 xhci_dbg_trace(xhci, trace_xhci_dbg_address,
3785 "Bad Slot ID %d", udev->slot_id); 3792 "Bad Slot ID %d", udev->slot_id);
3786 return -EINVAL; 3793 ret = -EINVAL;
3794 goto out;
3787 } 3795 }
3788 3796
3789 virt_dev = xhci->devs[udev->slot_id]; 3797 virt_dev = xhci->devs[udev->slot_id];
@@ -3796,7 +3804,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3796 */ 3804 */
3797 xhci_warn(xhci, "Virt dev invalid for slot_id 0x%x!\n", 3805 xhci_warn(xhci, "Virt dev invalid for slot_id 0x%x!\n",
3798 udev->slot_id); 3806 udev->slot_id);
3799 return -EINVAL; 3807 ret = -EINVAL;
3808 goto out;
3800 } 3809 }
3801 3810
3802 if (setup == SETUP_CONTEXT_ONLY) { 3811 if (setup == SETUP_CONTEXT_ONLY) {
@@ -3804,13 +3813,15 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3804 if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) == 3813 if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) ==
3805 SLOT_STATE_DEFAULT) { 3814 SLOT_STATE_DEFAULT) {
3806 xhci_dbg(xhci, "Slot already in default state\n"); 3815 xhci_dbg(xhci, "Slot already in default state\n");
3807 return 0; 3816 goto out;
3808 } 3817 }
3809 } 3818 }
3810 3819
3811 command = xhci_alloc_command(xhci, false, false, GFP_KERNEL); 3820 command = xhci_alloc_command(xhci, false, false, GFP_KERNEL);
3812 if (!command) 3821 if (!command) {
3813 return -ENOMEM; 3822 ret = -ENOMEM;
3823 goto out;
3824 }
3814 3825
3815 command->in_ctx = virt_dev->in_ctx; 3826 command->in_ctx = virt_dev->in_ctx;
3816 command->completion = &xhci->addr_dev; 3827 command->completion = &xhci->addr_dev;
@@ -3820,8 +3831,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3820 if (!ctrl_ctx) { 3831 if (!ctrl_ctx) {
3821 xhci_warn(xhci, "%s: Could not get input context, bad type.\n", 3832 xhci_warn(xhci, "%s: Could not get input context, bad type.\n",
3822 __func__); 3833 __func__);
3823 kfree(command); 3834 ret = -EINVAL;
3824 return -EINVAL; 3835 goto out;
3825 } 3836 }
3826 /* 3837 /*
3827 * If this is the first Set Address since device plug-in or 3838 * If this is the first Set Address since device plug-in or
@@ -3848,8 +3859,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3848 spin_unlock_irqrestore(&xhci->lock, flags); 3859 spin_unlock_irqrestore(&xhci->lock, flags);
3849 xhci_dbg_trace(xhci, trace_xhci_dbg_address, 3860 xhci_dbg_trace(xhci, trace_xhci_dbg_address,
3850 "FIXME: allocate a command ring segment"); 3861 "FIXME: allocate a command ring segment");
3851 kfree(command); 3862 goto out;
3852 return ret;
3853 } 3863 }
3854 xhci_ring_cmd_db(xhci); 3864 xhci_ring_cmd_db(xhci);
3855 spin_unlock_irqrestore(&xhci->lock, flags); 3865 spin_unlock_irqrestore(&xhci->lock, flags);
@@ -3896,10 +3906,8 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3896 ret = -EINVAL; 3906 ret = -EINVAL;
3897 break; 3907 break;
3898 } 3908 }
3899 if (ret) { 3909 if (ret)
3900 kfree(command); 3910 goto out;
3901 return ret;
3902 }
3903 temp_64 = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr); 3911 temp_64 = xhci_read_64(xhci, &xhci->op_regs->dcbaa_ptr);
3904 xhci_dbg_trace(xhci, trace_xhci_dbg_address, 3912 xhci_dbg_trace(xhci, trace_xhci_dbg_address,
3905 "Op regs DCBAA ptr = %#016llx", temp_64); 3913 "Op regs DCBAA ptr = %#016llx", temp_64);
@@ -3932,8 +3940,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
3932 xhci_dbg_trace(xhci, trace_xhci_dbg_address, 3940 xhci_dbg_trace(xhci, trace_xhci_dbg_address,
3933 "Internal device address = %d", 3941 "Internal device address = %d",
3934 le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK); 3942 le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK);
3943out:
3944 mutex_unlock(&xhci->mutex);
3935 kfree(command); 3945 kfree(command);
3936 return 0; 3946 return ret;
3937} 3947}
3938 3948
3939int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) 3949int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
@@ -4855,6 +4865,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
4855 return 0; 4865 return 0;
4856 } 4866 }
4857 4867
4868 mutex_init(&xhci->mutex);
4858 xhci->cap_regs = hcd->regs; 4869 xhci->cap_regs = hcd->regs;
4859 xhci->op_regs = hcd->regs + 4870 xhci->op_regs = hcd->regs +
4860 HC_LENGTH(readl(&xhci->cap_regs->hc_capbase)); 4871 HC_LENGTH(readl(&xhci->cap_regs->hc_capbase));
@@ -5011,4 +5022,12 @@ static int __init xhci_hcd_init(void)
5011 BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8); 5022 BUILD_BUG_ON(sizeof(struct xhci_run_regs) != (8+8*128)*32/8);
5012 return 0; 5023 return 0;
5013} 5024}
5025
5026/*
5027 * If an init function is provided, an exit function must also be provided
5028 * to allow module unload.
5029 */
5030static void __exit xhci_hcd_fini(void) { }
5031
5014module_init(xhci_hcd_init); 5032module_init(xhci_hcd_init);
5033module_exit(xhci_hcd_fini);
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index ea75e8ccd3c1..6977f8491fa7 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -1497,6 +1497,8 @@ struct xhci_hcd {
1497 struct list_head lpm_failed_devs; 1497 struct list_head lpm_failed_devs;
1498 1498
1499 /* slot enabling and address device helpers */ 1499 /* slot enabling and address device helpers */
1500 /* these are not thread safe so use mutex */
1501 struct mutex mutex;
1500 struct completion addr_dev; 1502 struct completion addr_dev;
1501 int slot_id; 1503 int slot_id;
1502 /* For USB 3.0 LPM enable/disable. */ 1504 /* For USB 3.0 LPM enable/disable. */
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 3789b08ef67b..6dca3d794ced 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -2021,13 +2021,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
2021 if (musb->ops->quirks) 2021 if (musb->ops->quirks)
2022 musb->io.quirks = musb->ops->quirks; 2022 musb->io.quirks = musb->ops->quirks;
2023 2023
2024 /* At least tusb6010 has it's own offsets.. */ 2024 /* Most devices use indexed offset or flat offset */
2025 if (musb->ops->ep_offset)
2026 musb->io.ep_offset = musb->ops->ep_offset;
2027 if (musb->ops->ep_select)
2028 musb->io.ep_select = musb->ops->ep_select;
2029
2030 /* ..and some devices use indexed offset or flat offset */
2031 if (musb->io.quirks & MUSB_INDEXED_EP) { 2025 if (musb->io.quirks & MUSB_INDEXED_EP) {
2032 musb->io.ep_offset = musb_indexed_ep_offset; 2026 musb->io.ep_offset = musb_indexed_ep_offset;
2033 musb->io.ep_select = musb_indexed_ep_select; 2027 musb->io.ep_select = musb_indexed_ep_select;
@@ -2036,6 +2030,12 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl)
2036 musb->io.ep_select = musb_flat_ep_select; 2030 musb->io.ep_select = musb_flat_ep_select;
2037 } 2031 }
2038 2032
2033 /* At least tusb6010 has its own offsets */
2034 if (musb->ops->ep_offset)
2035 musb->io.ep_offset = musb->ops->ep_offset;
2036 if (musb->ops->ep_select)
2037 musb->io.ep_select = musb->ops->ep_select;
2038
2039 if (musb->ops->fifo_mode) 2039 if (musb->ops->fifo_mode)
2040 fifo_mode = musb->ops->fifo_mode; 2040 fifo_mode = musb->ops->fifo_mode;
2041 else 2041 else
diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 7225d526df04..03ab0c699f74 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -1179,7 +1179,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
1179 } 1179 }
1180 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, 1180 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
1181 ab8500_usb_link_status_irq, 1181 ab8500_usb_link_status_irq,
1182 IRQF_NO_SUSPEND | IRQF_SHARED, 1182 IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
1183 "usb-link-status", ab); 1183 "usb-link-status", ab);
1184 if (err < 0) { 1184 if (err < 0) {
1185 dev_err(ab->dev, "request_irq failed for link status irq\n"); 1185 dev_err(ab->dev, "request_irq failed for link status irq\n");
@@ -1195,7 +1195,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
1195 } 1195 }
1196 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, 1196 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
1197 ab8500_usb_disconnect_irq, 1197 ab8500_usb_disconnect_irq,
1198 IRQF_NO_SUSPEND | IRQF_SHARED, 1198 IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
1199 "usb-id-fall", ab); 1199 "usb-id-fall", ab);
1200 if (err < 0) { 1200 if (err < 0) {
1201 dev_err(ab->dev, "request_irq failed for ID fall irq\n"); 1201 dev_err(ab->dev, "request_irq failed for ID fall irq\n");
@@ -1211,7 +1211,7 @@ static int ab8500_usb_irq_setup(struct platform_device *pdev,
1211 } 1211 }
1212 err = devm_request_threaded_irq(&pdev->dev, irq, NULL, 1212 err = devm_request_threaded_irq(&pdev->dev, irq, NULL,
1213 ab8500_usb_disconnect_irq, 1213 ab8500_usb_disconnect_irq,
1214 IRQF_NO_SUSPEND | IRQF_SHARED, 1214 IRQF_NO_SUSPEND | IRQF_SHARED | IRQF_ONESHOT,
1215 "usb-vbus-fall", ab); 1215 "usb-vbus-fall", ab);
1216 if (err < 0) { 1216 if (err < 0) {
1217 dev_err(ab->dev, "request_irq failed for Vbus fall irq\n"); 1217 dev_err(ab->dev, "request_irq failed for Vbus fall irq\n");
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index 845f658276b1..2b28443d07b9 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -401,7 +401,8 @@ static int tahvo_usb_probe(struct platform_device *pdev)
401 dev_set_drvdata(&pdev->dev, tu); 401 dev_set_drvdata(&pdev->dev, tu);
402 402
403 tu->irq = platform_get_irq(pdev, 0); 403 tu->irq = platform_get_irq(pdev, 0);
404 ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt, 0, 404 ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
405 IRQF_ONESHOT,
405 "tahvo-vbus", tu); 406 "tahvo-vbus", tu);
406 if (ret) { 407 if (ret) {
407 dev_err(&pdev->dev, "could not register tahvo-vbus irq: %d\n", 408 dev_err(&pdev->dev, "could not register tahvo-vbus irq: %d\n",
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 8597cf9cfceb..c0f5c652d272 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -611,6 +611,8 @@ struct usbhs_pkt_handle usbhs_fifo_pio_push_handler = {
611static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done) 611static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
612{ 612{
613 struct usbhs_pipe *pipe = pkt->pipe; 613 struct usbhs_pipe *pipe = pkt->pipe;
614 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe);
615 struct usbhs_fifo *fifo = usbhsf_get_cfifo(priv);
614 616
615 if (usbhs_pipe_is_busy(pipe)) 617 if (usbhs_pipe_is_busy(pipe))
616 return 0; 618 return 0;
@@ -624,6 +626,9 @@ static int usbhsf_prepare_pop(struct usbhs_pkt *pkt, int *is_done)
624 usbhs_pipe_data_sequence(pipe, pkt->sequence); 626 usbhs_pipe_data_sequence(pipe, pkt->sequence);
625 pkt->sequence = -1; /* -1 sequence will be ignored */ 627 pkt->sequence = -1; /* -1 sequence will be ignored */
626 628
629 if (usbhs_pipe_is_dcp(pipe))
630 usbhsf_fifo_clear(pipe, fifo);
631
627 usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length); 632 usbhs_pipe_set_trans_count_if_bulk(pipe, pkt->length);
628 usbhs_pipe_enable(pipe); 633 usbhs_pipe_enable(pipe);
629 usbhs_pipe_running(pipe, 1); 634 usbhs_pipe_running(pipe, 1);
@@ -673,7 +678,14 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
673 *is_done = 1; 678 *is_done = 1;
674 usbhsf_rx_irq_ctrl(pipe, 0); 679 usbhsf_rx_irq_ctrl(pipe, 0);
675 usbhs_pipe_running(pipe, 0); 680 usbhs_pipe_running(pipe, 0);
676 usbhs_pipe_disable(pipe); /* disable pipe first */ 681 /*
682 * If function mode, since this controller is possible to enter
683 * Control Write status stage at this timing, this driver
684 * should not disable the pipe. If such a case happens, this
685 * controller is not able to complete the status stage.
686 */
687 if (!usbhs_mod_is_host(priv) && !usbhs_pipe_is_dcp(pipe))
688 usbhs_pipe_disable(pipe); /* disable pipe first */
677 } 689 }
678 690
679 /* 691 /*
@@ -1227,15 +1239,21 @@ static void usbhsf_dma_init_dt(struct device *dev, struct usbhs_fifo *fifo,
1227{ 1239{
1228 char name[16]; 1240 char name[16];
1229 1241
1230 snprintf(name, sizeof(name), "tx%d", channel); 1242 /*
1231 fifo->tx_chan = dma_request_slave_channel_reason(dev, name); 1243 * To avoid complex handing for DnFIFOs, the driver uses each
1232 if (IS_ERR(fifo->tx_chan)) 1244 * DnFIFO as TX or RX direction (not bi-direction).
1233 fifo->tx_chan = NULL; 1245 * So, the driver uses odd channels for TX, even channels for RX.
1234 1246 */
1235 snprintf(name, sizeof(name), "rx%d", channel); 1247 snprintf(name, sizeof(name), "ch%d", channel);
1236 fifo->rx_chan = dma_request_slave_channel_reason(dev, name); 1248 if (channel & 1) {
1237 if (IS_ERR(fifo->rx_chan)) 1249 fifo->tx_chan = dma_request_slave_channel_reason(dev, name);
1238 fifo->rx_chan = NULL; 1250 if (IS_ERR(fifo->tx_chan))
1251 fifo->tx_chan = NULL;
1252 } else {
1253 fifo->rx_chan = dma_request_slave_channel_reason(dev, name);
1254 if (IS_ERR(fifo->rx_chan))
1255 fifo->rx_chan = NULL;
1256 }
1239} 1257}
1240 1258
1241static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo, 1259static void usbhsf_dma_init(struct usbhs_priv *priv, struct usbhs_fifo *fifo,
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index 9031750e7404..ffd739e31bfc 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -128,6 +128,7 @@ static const struct usb_device_id id_table[] = {
128 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */ 128 { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */
129 { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */ 129 { USB_DEVICE(0x10C4, 0x8977) }, /* CEL MeshWorks DevKit Device */
130 { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */ 130 { USB_DEVICE(0x10C4, 0x8998) }, /* KCF Technologies PRN */
131 { USB_DEVICE(0x10C4, 0x8A2A) }, /* HubZ dual ZigBee and Z-Wave dongle */
131 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */ 132 { USB_DEVICE(0x10C4, 0xEA60) }, /* Silicon Labs factory default */
132 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */ 133 { USB_DEVICE(0x10C4, 0xEA61) }, /* Silicon Labs factory default */
133 { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */ 134 { USB_DEVICE(0x10C4, 0xEA70) }, /* Silicon Labs factory default */
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 8eb68a31cab6..4c8b3b82103d 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -699,6 +699,7 @@ static const struct usb_device_id id_table_combined[] = {
699 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) }, 699 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) },
700 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) }, 700 { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
701 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) }, 701 { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
702 { USB_DEVICE(XSENS_VID, XSENS_MTDEVBOARD_PID) },
702 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) }, 703 { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
703 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) }, 704 { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
704 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, 705 { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) },
diff --git a/drivers/usb/serial/ftdi_sio_ids.h b/drivers/usb/serial/ftdi_sio_ids.h
index 4e4f46f3c89c..792e054126de 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -155,6 +155,7 @@
155#define XSENS_AWINDA_STATION_PID 0x0101 155#define XSENS_AWINDA_STATION_PID 0x0101
156#define XSENS_AWINDA_DONGLE_PID 0x0102 156#define XSENS_AWINDA_DONGLE_PID 0x0102
157#define XSENS_MTW_PID 0x0200 /* Xsens MTw */ 157#define XSENS_MTW_PID 0x0200 /* Xsens MTw */
158#define XSENS_MTDEVBOARD_PID 0x0300 /* Motion Tracker Development Board */
158#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */ 159#define XSENS_CONVERTER_PID 0xD00D /* Xsens USB-serial converter */
159 160
160/* Xsens devices using FTDI VID */ 161/* Xsens devices using FTDI VID */