usb-chipidea-msm-initialize-phy-on-reset-event.patch
usb-ftdi_sio-add-support-for-ge-healthcare-nemo-tracker-device.patch
usb-ftdi_sio-add-support-for-novitus-bono-e-thermal-printer.patch
+usb-zte_ev-fix-removed-pids.patch
+uwb-init-beacon-cache-entry-before-registering-uwb-device.patch
+usb-host-xhci-fix-compliance-mode-workaround.patch
+xhci-fix-null-pointer-dereference-if-xhci-initialization-fails.patch
+usb-xhci-fix-oops-in-xhci-error-handling-code.patch
+xhci-fix-oops-when-xhci-resumes-from-hibernate-with-hw-lpm-capable-devices.patch
+usb-hub-take-hub-hdev-reference-when-processing-from-eventlist.patch
+usb-document-the-u-flag-for-usb-storage-quirks-parameter.patch
+storage-add-single-lun-quirk-for-jaz-usb-adapter.patch
+usb-storage-add-quirk-for-adaptec-usbconnect-2000-usb-to-scsi-adapter.patch
+usb-storage-add-quirk-for-ariston-technologies-iconnect-usb-to-scsi-adapter.patch
+usb-storage-add-quirks-for-entrega-xircom-usb-to-scsi-converters.patch
+usb-ehci-unlink-qhs-even-after-the-controller-has-stopped.patch
+usb-dwc3-core-fix-order-of-pm-runtime-calls.patch
+usb-dwc3-core-fix-ordering-for-phy-suspend.patch
+usb-dwc3-omap-fix-ordering-for-runtime-pm-calls.patch
+usb-dwc2-gadget-fix-phy-disable-sequence.patch
+usb-dwc2-gadget-fix-phy-initialization-sequence.patch
+usb-dwc2-gadget-break-infinite-loop-in-endpoint-disable-code.patch
+usb-dwc2-gadget-do-not-call-disconnect-method-in-pullup.patch
+usb-dwc2-gadget-delay-enabling-irq-once-hardware-is-configured-properly.patch
+usb-dwc2-gadget-avoid-disabling-ep0.patch
--- /dev/null
+From c66f1c62e85927357e7b3f4c701614dcb5c498a2 Mon Sep 17 00:00:00 2001
+From: Mark <markk@clara.co.uk>
+Date: Thu, 11 Sep 2014 13:15:45 +0100
+Subject: storage: Add single-LUN quirk for Jaz USB Adapter
+
+From: Mark <markk@clara.co.uk>
+
+commit c66f1c62e85927357e7b3f4c701614dcb5c498a2 upstream.
+
+The Iomega Jaz USB Adapter is a SCSI-USB converter cable. The hardware
+seems to be identical to e.g. the Microtech XpressSCSI, using a Shuttle/
+SCM chip set. However its firmware restricts it to only work with Jaz
+drives.
+
+On connecting the cable a message like this appears four times in the log:
+ reset full speed USB device number 4 using uhci_hcd
+
+That's non-fatal but the US_FL_SINGLE_LUN quirk fixes it.
+
+Signed-off-by: Mark Knibbs <markk@clara.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/unusual_devs.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -741,6 +741,12 @@ UNUSUAL_DEV( 0x059b, 0x0001, 0x0100, 0x
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_SINGLE_LUN ),
+
++UNUSUAL_DEV( 0x059b, 0x0040, 0x0100, 0x0100,
++ "Iomega",
++ "Jaz USB Adapter",
++ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
++ US_FL_SINGLE_LUN ),
++
+ /* Reported by <Hendryk.Pfeiffer@gmx.de> */
+ UNUSUAL_DEV( 0x059f, 0x0643, 0x0000, 0x0000,
+ "LaCie",
--- /dev/null
+From b6089f19fe0cec625b5963a851a07c3e412c27c8 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Tue, 2 Sep 2014 15:42:18 -0400
+Subject: USB: document the 'u' flag for usb-storage quirks parameter
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit b6089f19fe0cec625b5963a851a07c3e412c27c8 upstream.
+
+Commit d24d481b7d36 (usb-storage: Modify and export adjust_quirks so
+that it can be used by uas) added the 'u' flag to the quirks module
+parameter for usb-storage, but neglected to update the
+documentation. This patch adds the documentation.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ Documentation/kernel-parameters.txt | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/Documentation/kernel-parameters.txt
++++ b/Documentation/kernel-parameters.txt
+@@ -3478,6 +3478,7 @@ bytes respectively. Such letter suffixes
+ bogus residue values);
+ s = SINGLE_LUN (the device has only one
+ Logical Unit);
++ u = IGNORE_UAS (don't bind to the uas driver);
+ w = NO_WP_DETECT (don't test whether the
+ medium is write-protected).
+ Example: quirks=0419:aaf5:rl,0421:0433:rc
--- /dev/null
+From 604eac3c0c69e98f2fd0133305f9e777418f1d3b Mon Sep 17 00:00:00 2001
+From: Robert Baldyga <r.baldyga@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:13 +0200
+Subject: usb: dwc2/gadget: avoid disabling ep0
+
+From: Robert Baldyga <r.baldyga@samsung.com>
+
+commit 604eac3c0c69e98f2fd0133305f9e777418f1d3b upstream.
+
+Endpoint 0 should not be disabled, so we start loop counter from number 1.
+
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -2896,7 +2896,7 @@ static int s3c_hsotg_udc_stop(struct usb
+ return -ENODEV;
+
+ /* all endpoints should be shutdown */
+- for (ep = 0; ep < hsotg->num_of_eps; ep++)
++ for (ep = 1; ep < hsotg->num_of_eps; ep++)
+ s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
+
+ spin_lock_irqsave(&hsotg->lock, flags);
--- /dev/null
+From e0cbe595db72b037260bbda77106f6811a1ebb1d Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:10 +0200
+Subject: usb: dwc2/gadget: break infinite loop in endpoint disable code
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+commit e0cbe595db72b037260bbda77106f6811a1ebb1d upstream.
+
+This patch fixes possible freeze caused by infinite loop in interrupt
+context.
+
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -1650,6 +1650,7 @@ static void s3c_hsotg_txfifo_flush(struc
+ dev_err(hsotg->dev,
+ "%s: timeout flushing fifo (GRSTCTL=%08x)\n",
+ __func__, val);
++ break;
+ }
+
+ udelay(1);
--- /dev/null
+From eb3c56c5ccdd252940cb0ec0541fcdc94894bd8d Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:12 +0200
+Subject: usb: dwc2/gadget: delay enabling irq once hardware is configured properly
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+commit eb3c56c5ccdd252940cb0ec0541fcdc94894bd8d upstream.
+
+This patch fixes kernel panic/interrupt storm/etc issues if bootloader
+left s3c-hsotg module in enabled state. Now interrupt handler is enabled
+only after proper configuration of hardware registers.
+
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -3444,13 +3444,6 @@ static int s3c_hsotg_probe(struct platfo
+
+ hsotg->irq = ret;
+
+- ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0,
+- dev_name(dev), hsotg);
+- if (ret < 0) {
+- dev_err(dev, "cannot claim IRQ\n");
+- goto err_clk;
+- }
+-
+ dev_info(dev, "regs %p, irq %d\n", hsotg->regs, hsotg->irq);
+
+ hsotg->gadget.max_speed = USB_SPEED_HIGH;
+@@ -3498,6 +3491,17 @@ static int s3c_hsotg_probe(struct platfo
+ s3c_hsotg_init(hsotg);
+ s3c_hsotg_hw_cfg(hsotg);
+
++ ret = devm_request_irq(&pdev->dev, hsotg->irq, s3c_hsotg_irq, 0,
++ dev_name(dev), hsotg);
++ if (ret < 0) {
++ s3c_hsotg_phy_disable(hsotg);
++ clk_disable_unprepare(hsotg->clk);
++ regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies),
++ hsotg->supplies);
++ dev_err(dev, "cannot claim IRQ\n");
++ goto err_clk;
++ }
++
+ /* hsotg->num_of_eps holds number of EPs other than ep0 */
+
+ if (hsotg->num_of_eps == 0) {
--- /dev/null
+From b510df5a36c066da3a188f4ade3404118b63c6de Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:11 +0200
+Subject: usb: dwc2/gadget: do not call disconnect method in pullup
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+commit b510df5a36c066da3a188f4ade3404118b63c6de upstream.
+
+This leads to potential spinlock recursion in composite framework, other
+udc drivers also don't call it directly from pullup method.
+
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -2943,7 +2943,6 @@ static int s3c_hsotg_pullup(struct usb_g
+ s3c_hsotg_phy_enable(hsotg);
+ s3c_hsotg_core_init(hsotg);
+ } else {
+- s3c_hsotg_disconnect(hsotg);
+ s3c_hsotg_phy_disable(hsotg);
+ }
+
--- /dev/null
+From 0655314be0d9c54ad5f63500219485c6a9d9e5e2 Mon Sep 17 00:00:00 2001
+From: Kamil Debski <k.debski@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:08 +0200
+Subject: usb: dwc2/gadget: fix phy disable sequence
+
+From: Kamil Debski <k.debski@samsung.com>
+
+commit 0655314be0d9c54ad5f63500219485c6a9d9e5e2 upstream.
+
+When the driver is removed s3c_hsotg_phy_disable is called three times
+instead of once. This results in decreasing of the phy reference counter
+below zero and thus consecutive inserts of the module fails.
+
+This patch removes calls to s3c_hsotg_phy_disable from s3c_hsotg_remove
+and s3c_hsotg_udc_stop.
+
+s3c_hsotg_udc_stop is called from udc-core.c only after
+usb_gadget_disconnect, which in turn calls s3c_hsotg_pullup, which
+already calls s3c_hsotg_phy_disable.
+
+s3c_hsotg_remove must be called only after udc_stop, so there is no
+point in disabling phy once again there.
+
+Signed-off-by: Kamil Debski <k.debski@samsung.com>
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -2898,8 +2898,6 @@ static int s3c_hsotg_udc_stop(struct usb
+
+ spin_lock_irqsave(&hsotg->lock, flags);
+
+- s3c_hsotg_phy_disable(hsotg);
+-
+ if (!driver)
+ hsotg->driver = NULL;
+
+@@ -3586,7 +3584,6 @@ static int s3c_hsotg_remove(struct platf
+ usb_gadget_unregister_driver(hsotg->driver);
+ }
+
+- s3c_hsotg_phy_disable(hsotg);
+ if (hsotg->phy)
+ phy_exit(hsotg->phy);
+ clk_disable_unprepare(hsotg->clk);
--- /dev/null
+From ca2c5ba80f823a38c4aae506e2f03c1afb076b0a Mon Sep 17 00:00:00 2001
+From: Kamil Debski <k.debski@samsung.com>
+Date: Tue, 9 Sep 2014 10:44:09 +0200
+Subject: usb: dwc2/gadget: fix phy initialization sequence
+
+From: Kamil Debski <k.debski@samsung.com>
+
+commit ca2c5ba80f823a38c4aae506e2f03c1afb076b0a upstream.
+
+In the Generic PHY Framework a NULL phy is considered to be a valid phy
+thus the "if (hsotg->phy)" check does not give us the information whether
+the Generic PHY Framework is used.
+
+In addition to the above this patch also removes phy_init from probe and
+phy_exit from remove. This is not necessary when init/exit is done in the
+s3c_hsotg_phy_enable/disable functions.
+
+Signed-off-by: Kamil Debski <k.debski@samsung.com>
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc2/gadget.c | 27 ++++++++++++---------------
+ 1 file changed, 12 insertions(+), 15 deletions(-)
+
+--- a/drivers/usb/dwc2/gadget.c
++++ b/drivers/usb/dwc2/gadget.c
+@@ -2748,13 +2748,14 @@ static void s3c_hsotg_phy_enable(struct
+
+ dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
+
+- if (hsotg->phy) {
+- phy_init(hsotg->phy);
+- phy_power_on(hsotg->phy);
+- } else if (hsotg->uphy)
++ if (hsotg->uphy)
+ usb_phy_init(hsotg->uphy);
+- else if (hsotg->plat->phy_init)
++ else if (hsotg->plat && hsotg->plat->phy_init)
+ hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
++ else {
++ phy_init(hsotg->phy);
++ phy_power_on(hsotg->phy);
++ }
+ }
+
+ /**
+@@ -2768,13 +2769,14 @@ static void s3c_hsotg_phy_disable(struct
+ {
+ struct platform_device *pdev = to_platform_device(hsotg->dev);
+
+- if (hsotg->phy) {
+- phy_power_off(hsotg->phy);
+- phy_exit(hsotg->phy);
+- } else if (hsotg->uphy)
++ if (hsotg->uphy)
+ usb_phy_shutdown(hsotg->uphy);
+- else if (hsotg->plat->phy_exit)
++ else if (hsotg->plat && hsotg->plat->phy_exit)
+ hsotg->plat->phy_exit(pdev, hsotg->plat->phy_type);
++ else {
++ phy_power_off(hsotg->phy);
++ phy_exit(hsotg->phy);
++ }
+ }
+
+ /**
+@@ -3489,9 +3491,6 @@ static int s3c_hsotg_probe(struct platfo
+ if (hsotg->phy && (phy_get_bus_width(phy) == 8))
+ hsotg->phyif = GUSBCFG_PHYIF8;
+
+- if (hsotg->phy)
+- phy_init(hsotg->phy);
+-
+ /* usb phy enable */
+ s3c_hsotg_phy_enable(hsotg);
+
+@@ -3584,8 +3583,6 @@ static int s3c_hsotg_remove(struct platf
+ usb_gadget_unregister_driver(hsotg->driver);
+ }
+
+- if (hsotg->phy)
+- phy_exit(hsotg->phy);
+ clk_disable_unprepare(hsotg->clk);
+
+ return 0;
--- /dev/null
+From fed33afce0eda44a46ae24d93aec1b5198c0bac4 Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Tue, 2 Sep 2014 14:57:20 -0500
+Subject: usb: dwc3: core: fix order of PM runtime calls
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit fed33afce0eda44a46ae24d93aec1b5198c0bac4 upstream.
+
+Currently, we disable pm_runtime before all register
+accesses are done, this is dangerous and might lead
+to abort exceptions due to the driver trying to access
+a register which is clocked by a clock which was long
+gated.
+
+Fix that by moving pm_runtime_put_sync() and pm_runtime_disable()
+as the last thing we do before returning from our ->remove()
+method.
+
+Fixes: 72246da (usb: Introduce DesignWare USB3 DRD Driver)
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/core.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -791,15 +791,15 @@ static int dwc3_remove(struct platform_d
+ phy_power_off(dwc->usb2_generic_phy);
+ phy_power_off(dwc->usb3_generic_phy);
+
+- pm_runtime_put_sync(&pdev->dev);
+- pm_runtime_disable(&pdev->dev);
+-
+ dwc3_debugfs_exit(dwc);
+ dwc3_core_exit_mode(dwc);
+ dwc3_event_buffers_cleanup(dwc);
+ dwc3_free_event_buffers(dwc);
+ dwc3_core_exit(dwc);
+
++ pm_runtime_put_sync(&pdev->dev);
++ pm_runtime_disable(&pdev->dev);
++
+ return 0;
+ }
+
--- /dev/null
+From dc99f16f076559235c92d3eb66d03d1310faea08 Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Wed, 3 Sep 2014 16:13:37 -0500
+Subject: usb: dwc3: core: fix ordering for PHY suspend
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit dc99f16f076559235c92d3eb66d03d1310faea08 upstream.
+
+We can't suspend the PHYs before dwc3_core_exit_mode()
+has been called, that's because the host and/or device
+sides might still need to communicate with the far end
+link partner.
+
+Fixes: 8ba007a (usb: dwc3: core: enable the USB2 and USB3 phy in probe)
+Suggested-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/core.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+--- a/drivers/usb/dwc3/core.c
++++ b/drivers/usb/dwc3/core.c
+@@ -786,15 +786,16 @@ static int dwc3_remove(struct platform_d
+ {
+ struct dwc3 *dwc = platform_get_drvdata(pdev);
+
++ dwc3_debugfs_exit(dwc);
++ dwc3_core_exit_mode(dwc);
++ dwc3_event_buffers_cleanup(dwc);
++ dwc3_free_event_buffers(dwc);
++
+ usb_phy_set_suspend(dwc->usb2_phy, 1);
+ usb_phy_set_suspend(dwc->usb3_phy, 1);
+ phy_power_off(dwc->usb2_generic_phy);
+ phy_power_off(dwc->usb3_generic_phy);
+
+- dwc3_debugfs_exit(dwc);
+- dwc3_core_exit_mode(dwc);
+- dwc3_event_buffers_cleanup(dwc);
+- dwc3_free_event_buffers(dwc);
+ dwc3_core_exit(dwc);
+
+ pm_runtime_put_sync(&pdev->dev);
--- /dev/null
+From 81a60b7f5c143ab3cdcd9943c9b4b7c63c32fc31 Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Wed, 3 Sep 2014 16:42:57 -0500
+Subject: usb: dwc3: omap: fix ordering for runtime pm calls
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit 81a60b7f5c143ab3cdcd9943c9b4b7c63c32fc31 upstream.
+
+we don't to gate clocks until our children are
+done with their remove path.
+
+Fixes: af310e9 (usb: dwc3: omap: use runtime API's to enable clocks)
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/dwc3/dwc3-omap.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/dwc3/dwc3-omap.c
++++ b/drivers/usb/dwc3/dwc3-omap.c
+@@ -576,9 +576,9 @@ static int dwc3_omap_remove(struct platf
+ if (omap->extcon_id_dev.edev)
+ extcon_unregister_interest(&omap->extcon_id_dev);
+ dwc3_omap_disable_irqs(omap);
++ device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+- device_for_each_child(&pdev->dev, NULL, dwc3_omap_remove_core);
+
+ return 0;
+ }
--- /dev/null
+From 7312b5ddd47fee2356baa78c5516ef8e04eed452 Mon Sep 17 00:00:00 2001
+From: Alan Stern <stern@rowland.harvard.edu>
+Date: Wed, 17 Sep 2014 11:23:54 -0400
+Subject: USB: EHCI: unlink QHs even after the controller has stopped
+
+From: Alan Stern <stern@rowland.harvard.edu>
+
+commit 7312b5ddd47fee2356baa78c5516ef8e04eed452 upstream.
+
+Old code in ehci-hcd tries to expedite disabling endpoints after the
+controller has stopped, by destroying the endpoint's associated QH
+without first unlinking the QH. This was necessary back when the
+driver wasn't so careful about keeping track of the controller's
+state.
+
+But now we are careful about it, and the driver knows that when the
+controller isn't running, no unlinking delay is needed. Furthermore,
+skipping the unlink step will trigger a BUG() in qh_destroy() when the
+preceding QH is released, because the link pointer will be non-NULL.
+
+Removing the lines that skip the unlinking step and go directly to
+QH_STATE_IDLE fixes the problem.
+
+Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
+Reported-by: Joe Lawrence <joe.lawrence@stratus.com>
+Tested-by: Joe Lawrence <joe.lawrence@stratus.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/ehci-hcd.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+--- a/drivers/usb/host/ehci-hcd.c
++++ b/drivers/usb/host/ehci-hcd.c
+@@ -965,8 +965,6 @@ rescan:
+ }
+
+ qh->exception = 1;
+- if (ehci->rh_state < EHCI_RH_RUNNING)
+- qh->qh_state = QH_STATE_IDLE;
+ switch (qh->qh_state) {
+ case QH_STATE_LINKED:
+ WARN_ON(!list_empty(&qh->qtd_list));
--- /dev/null
+From 96908589a8b2584b1185f834d365f5cc360e8226 Mon Sep 17 00:00:00 2001
+From: Felipe Balbi <balbi@ti.com>
+Date: Wed, 27 Aug 2014 16:38:04 -0500
+Subject: usb: host: xhci: fix compliance mode workaround
+
+From: Felipe Balbi <balbi@ti.com>
+
+commit 96908589a8b2584b1185f834d365f5cc360e8226 upstream.
+
+Commit 71c731a (usb: host: xhci: Fix Compliance Mode
+on SN65LVP3502CP Hardware) implemented a workaround
+for a known issue with Texas Instruments' USB 3.0
+redriver IC but it left a condition where any xHCI
+host would be taken out of reset if port was placed
+in compliance mode and there was no device connected
+to the port.
+
+That condition would trigger a fake connection to a
+non-existent device so that usbcore would trigger a
+warm reset of the port, thus taking the link out of
+reset.
+
+This has the side-effect of preventing any xHCI host
+connected to a Linux machine from starting and running
+the USB 3.0 Electrical Compliance Suite because the
+port will mysteriously taken out of compliance mode
+and, thus, xHCI won't step through the necessary
+compliance patterns for link validation.
+
+This patch fixes the issue by just adding a missing
+check for XHCI_COMP_MODE_QUIRK inside
+xhci_hub_report_usb3_link_state() when PORT_CAS isn't
+set.
+
+This patch should be backported to all kernels containing
+commit 71c731a.
+
+Fixes: 71c731a (usb: host: xhci: Fix Compliance Mode on SN65LVP3502CP Hardware)
+Cc: Alexis R. Cortes <alexis.cortes@ti.com>
+Signed-off-by: Felipe Balbi <balbi@ti.com>
+Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-hub.c | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+--- a/drivers/usb/host/xhci-hub.c
++++ b/drivers/usb/host/xhci-hub.c
+@@ -468,7 +468,8 @@ static void xhci_hub_report_usb2_link_st
+ }
+
+ /* Updates Link Status for super Speed port */
+-static void xhci_hub_report_usb3_link_state(u32 *status, u32 status_reg)
++static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
++ u32 *status, u32 status_reg)
+ {
+ u32 pls = status_reg & PORT_PLS_MASK;
+
+@@ -507,7 +508,8 @@ static void xhci_hub_report_usb3_link_st
+ * in which sometimes the port enters compliance mode
+ * caused by a delay on the host-device negotiation.
+ */
+- if (pls == USB_SS_PORT_LS_COMP_MOD)
++ if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
++ (pls == USB_SS_PORT_LS_COMP_MOD))
+ pls |= USB_PORT_STAT_CONNECTION;
+ }
+
+@@ -666,7 +668,7 @@ static u32 xhci_get_port_status(struct u
+ }
+ /* Update Port Link State */
+ if (hcd->speed == HCD_USB3) {
+- xhci_hub_report_usb3_link_state(&status, raw_port_status);
++ xhci_hub_report_usb3_link_state(xhci, &status, raw_port_status);
+ /*
+ * Verify if all USB3 Ports Have entered U0 already.
+ * Delete Compliance Mode Timer if so.
--- /dev/null
+From c605f3cdff53a743f6d875b76956b239deca1272 Mon Sep 17 00:00:00 2001
+From: Joe Lawrence <joe.lawrence@stratus.com>
+Date: Wed, 10 Sep 2014 15:07:50 -0400
+Subject: usb: hub: take hub->hdev reference when processing from eventlist
+
+From: Joe Lawrence <joe.lawrence@stratus.com>
+
+commit c605f3cdff53a743f6d875b76956b239deca1272 upstream.
+
+During surprise device hotplug removal tests, it was observed that
+hub_events may try to call usb_lock_device on a device that has already
+been freed. Protect the usb_device by taking out a reference (under the
+hub_event_lock) when hub_events pulls it off the list, returning the
+reference after hub_events is finished using it.
+
+Signed-off-by: Joe Lawrence <joe.lawrence@stratus.com>
+Suggested-by: David Bulkow <david.bulkow@stratus.com> for using kref
+Suggested-by: Alan Stern <stern@rowland.harvard.edu> for placement
+Acked-by: Alan Stern <stern@rowland.harvard.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/core/hub.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/core/hub.c
++++ b/drivers/usb/core/hub.c
+@@ -5008,9 +5008,10 @@ static void hub_events(void)
+
+ hub = list_entry(tmp, struct usb_hub, event_list);
+ kref_get(&hub->kref);
++ hdev = hub->hdev;
++ usb_get_dev(hdev);
+ spin_unlock_irq(&hub_event_lock);
+
+- hdev = hub->hdev;
+ hub_dev = hub->intfdev;
+ intf = to_usb_interface(hub_dev);
+ dev_dbg(hub_dev, "state %d ports %d chg %04x evt %04x\n",
+@@ -5123,6 +5124,7 @@ static void hub_events(void)
+ usb_autopm_put_interface(intf);
+ loop_disconnected:
+ usb_unlock_device(hdev);
++ usb_put_dev(hdev);
+ kref_put(&hub->kref, hub_release);
+
+ } /* end while (1) */
--- /dev/null
+From 67d365a57a51fb9dece6a5ceb504aa381cae1e5b Mon Sep 17 00:00:00 2001
+From: Mark <markk@clara.co.uk>
+Date: Tue, 16 Sep 2014 16:22:50 +0100
+Subject: USB: storage: Add quirk for Adaptec USBConnect 2000 USB-to-SCSI Adapter
+
+From: Mark <markk@clara.co.uk>
+
+commit 67d365a57a51fb9dece6a5ceb504aa381cae1e5b upstream.
+
+The Adaptec USBConnect 2000 is another SCSI-USB converter which uses
+Shuttle Technology/SCM Microsystems chips. The US_FL_SCM_MULT_TARG quirk is
+required to use SCSI devices with ID other than 0.
+
+I don't have a USBConnect 2000, but based on the other entries for Shuttle/
+SCM-based converters this patch is very likely correct. I used 0x0000 and
+0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which
+bcdDevice value the product uses.
+
+Signed-off-by: Mark Knibbs <markk@clara.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/unusual_devs.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -101,6 +101,12 @@ UNUSUAL_DEV( 0x03f0, 0x4002, 0x0001, 0x
+ "PhotoSmart R707",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_FIX_CAPACITY),
+
++UNUSUAL_DEV( 0x03f3, 0x0001, 0x0000, 0x9999,
++ "Adaptec",
++ "USBConnect 2000",
++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
++ US_FL_SCM_MULT_TARG ),
++
+ /* Reported by Sebastian Kapfer <sebastian_kapfer@gmx.net>
+ * and Olaf Hering <olh@suse.de> (different bcd's, same vendor/product)
+ * for USB floppies that need the SINGLE_LUN enforcement.
--- /dev/null
+From b6a3ed677991558ce09046397a7c4d70530d15b3 Mon Sep 17 00:00:00 2001
+From: Mark <markk@clara.co.uk>
+Date: Tue, 16 Sep 2014 16:51:41 +0100
+Subject: USB: storage: Add quirk for Ariston Technologies iConnect USB to SCSI adapter
+
+From: Mark <markk@clara.co.uk>
+
+commit b6a3ed677991558ce09046397a7c4d70530d15b3 upstream.
+
+Hi,
+
+The Ariston Technologies iConnect 025 and iConnect 050 (also known as e.g.
+iSCSI-50) are SCSI-USB converters which use Shuttle Technology/SCM
+Microsystems chips. Only the connectors differ; both have the same USB ID.
+The US_FL_SCM_MULT_TARG quirk is required to use SCSI devices with ID other
+than 0.
+
+I don't have one of these, but based on the other entries for Shuttle/
+SCM-based converters this patch is very likely correct. I used 0x0000 and
+0x9999 for bcdDeviceMin and bcdDeviceMax because I'm not sure which
+bcdDevice value the products use.
+
+Signed-off-by: Mark Knibbs <markk@clara.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/unusual_devs.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1986,6 +1986,12 @@ UNUSUAL_DEV( 0x177f, 0x0400, 0x0000, 0x
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_BULK_IGNORE_TAG | US_FL_MAX_SECTORS_64 ),
+
++UNUSUAL_DEV( 0x1822, 0x0001, 0x0000, 0x9999,
++ "Ariston Technologies",
++ "iConnect USB to SCSI adapter",
++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
++ US_FL_SCM_MULT_TARG ),
++
+ /* Reported by Hans de Goede <hdegoede@redhat.com>
+ * These Appotech controllers are found in Picture Frames, they provide a
+ * (buggy) emulation of a cdrom drive which contains the windows software
--- /dev/null
+From c80b4495c61636edc58fe1ce300f09f24db28e10 Mon Sep 17 00:00:00 2001
+From: Mark <markk@clara.co.uk>
+Date: Wed, 17 Sep 2014 19:15:43 +0100
+Subject: USB: storage: Add quirks for Entrega/Xircom USB to SCSI converters
+
+From: Mark <markk@clara.co.uk>
+
+commit c80b4495c61636edc58fe1ce300f09f24db28e10 upstream.
+
+This patch adds quirks for Entrega Technologies (later Xircom PortGear) USB-
+SCSI converters. They use Shuttle Technology EUSB-01/EUSB-S1 chips. The
+US_FL_SCM_MULT_TARG quirk is needed to allow multiple devices on the SCSI
+chain to be accessed. Without it only the (single) device with SCSI ID 0
+can be used.
+
+The standalone converter sold by Entrega had model number U1-SC25. Xircom
+acquired Entrega and re-branded the product line PortGear. The PortGear USB
+to SCSI Converter (model PGSCSI) is internally identical to the Entrega
+product, but later models may use a different USB ID. The Entrega-branded
+units have USB ID 1645:0007, as does my Xircom PGSCSI, but the Windows and
+Macintosh drivers also support 085A:0028.
+
+Entrega also sold the "Mac USB Dock", which provides two USB ports, a Mac
+(8-pin mini-DIN) serial port and a SCSI port. It appears to the computer as
+a four-port hub, USB-serial, and USB-SCSI converters. The USB-SCSI part may
+have initially used the same ID as the standalone U1-SC25 (1645:0007), but
+later production used 085A:0026.
+
+My Xircom PortGear PGSCSI has bcdDevice=0x0100. Units with bcdDevice=0x0133
+probably also exist.
+
+This patch adds quirks for 1645:0007, 085A:0026 and 085A:0028. The Windows
+driver INF file also mentions 085A:0032 "PortStation SCSI Module", but I
+couldn't find any mention of that actually existing in the wild; perhaps it
+was cancelled before release?
+
+Signed-off-by: Mark Knibbs <markk@clara.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/storage/unusual_devs.h | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1125,6 +1125,18 @@ UNUSUAL_DEV( 0x0851, 0x1543, 0x0200, 0x
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NOT_LOCKABLE),
+
++UNUSUAL_DEV( 0x085a, 0x0026, 0x0100, 0x0133,
++ "Xircom",
++ "PortGear USB-SCSI (Mac USB Dock)",
++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
++ US_FL_SCM_MULT_TARG ),
++
++UNUSUAL_DEV( 0x085a, 0x0028, 0x0100, 0x0133,
++ "Xircom",
++ "PortGear USB to SCSI Converter",
++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
++ US_FL_SCM_MULT_TARG ),
++
+ /* Submitted by Jan De Luyck <lkml@kcore.org> */
+ UNUSUAL_DEV( 0x08bd, 0x1100, 0x0000, 0x0000,
+ "CITIZEN",
+@@ -1964,6 +1976,14 @@ UNUSUAL_DEV( 0x152d, 0x2329, 0x0100, 0x
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_IGNORE_RESIDUE | US_FL_SANE_SENSE ),
+
++/* Entrega Technologies U1-SC25 (later Xircom PortGear PGSCSI)
++ * and Mac USB Dock USB-SCSI */
++UNUSUAL_DEV( 0x1645, 0x0007, 0x0100, 0x0133,
++ "Entrega Technologies",
++ "USB to SCSI Converter",
++ USB_SC_DEVICE, USB_PR_DEVICE, usb_stor_euscsi_init,
++ US_FL_SCM_MULT_TARG ),
++
+ /* Reported by Robert Schedel <r.schedel@yahoo.de>
+ * Note: this is a 'super top' device like the above 14cd/6600 device */
+ UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
--- /dev/null
+From 0eda06c7c17ae48d7db69beef57f6e2b20bc3c72 Mon Sep 17 00:00:00 2001
+From: Al Cooper <alcooperx@gmail.com>
+Date: Thu, 11 Sep 2014 13:55:49 +0300
+Subject: usb: xhci: Fix OOPS in xhci error handling code
+
+From: Al Cooper <alcooperx@gmail.com>
+
+commit 0eda06c7c17ae48d7db69beef57f6e2b20bc3c72 upstream.
+
+The xhci driver will OOPS on resume from S2/S3 if dma_alloc_coherent()
+is out of memory. This is a result of two things:
+1. xhci_mem_cleanup() in xhci-mem.c free's xhci->lpm_command if
+it's not NULL, but doesn't set it to NULL after the free.
+2. xhci_mem_cleanup() is called twice on resume, once for normal
+restart and once from xhci_mem_init() if dma_alloc_coherent() fails,
+resulting in a free of xhci->lpm_command that has already been freed.
+The fix is to set xhci->lpm_command to NULL after freeing it.
+
+Signed-off-by: Al Cooper <alcooperx@gmail.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1812,6 +1812,7 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+
+ if (xhci->lpm_command)
+ xhci_free_command(xhci, xhci->lpm_command);
++ xhci->lpm_command = NULL;
+ if (xhci->cmd_ring)
+ xhci_ring_free(xhci, xhci->cmd_ring);
+ xhci->cmd_ring = NULL;
--- /dev/null
+From 3096691011d01cef56b243a5e65431405c07d574 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <johan@kernel.org>
+Date: Thu, 28 Aug 2014 12:46:54 +0200
+Subject: USB: zte_ev: fix removed PIDs
+
+From: Johan Hovold <johan@kernel.org>
+
+commit 3096691011d01cef56b243a5e65431405c07d574 upstream.
+
+Add back some PIDs that were mistakingly remove when reverting commit
+73228a0538a7 ("USB: option,zte_ev: move most ZTE CDMA devices to
+zte_ev"), which apparently did more than its commit message claimed in
+that it not only moved some PIDs from option to zte_ev but also added
+some new ones.
+
+Fixes: 63a901c06e3c ("Revert "USB: option,zte_ev: move most ZTE CDMA
+devices to zte_ev"")
+
+Reported-by: Lei Liu <lei35151@163.com>
+Signed-off-by: Johan Hovold <johan@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/serial/zte_ev.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/usb/serial/zte_ev.c
++++ b/drivers/usb/serial/zte_ev.c
+@@ -272,6 +272,14 @@ static void zte_ev_usb_serial_close(stru
+ }
+
+ static const struct usb_device_id id_table[] = {
++ { USB_DEVICE(0x19d2, 0xffec) },
++ { USB_DEVICE(0x19d2, 0xffee) },
++ { USB_DEVICE(0x19d2, 0xfff6) },
++ { USB_DEVICE(0x19d2, 0xfff7) },
++ { USB_DEVICE(0x19d2, 0xfff8) },
++ { USB_DEVICE(0x19d2, 0xfff9) },
++ { USB_DEVICE(0x19d2, 0xfffb) },
++ { USB_DEVICE(0x19d2, 0xfffc) },
+ /* MG880 */
+ { USB_DEVICE(0x19d2, 0xfffd) },
+ { },
--- /dev/null
+From 675f0ab2fe5a0f7325208e60b617a5f32b86d72c Mon Sep 17 00:00:00 2001
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+Date: Thu, 7 Aug 2014 15:45:35 -0500
+Subject: uwb: init beacon cache entry before registering uwb device
+
+From: Thomas Pugliese <thomas.pugliese@gmail.com>
+
+commit 675f0ab2fe5a0f7325208e60b617a5f32b86d72c upstream.
+
+Make sure the uwb_dev->bce entry is set before calling uwb_dev_add in
+uwbd_dev_onair so that usermode will only see the device after it is
+properly initialized. This fixes a kernel panic that can occur if
+usermode tries to access the IEs sysfs attribute of a UWB device before
+the driver has had a chance to set the beacon cache entry.
+
+Signed-off-by: Thomas Pugliese <thomas.pugliese@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/uwb/lc-dev.c | 13 +++++++++----
+ 1 file changed, 9 insertions(+), 4 deletions(-)
+
+--- a/drivers/uwb/lc-dev.c
++++ b/drivers/uwb/lc-dev.c
+@@ -431,16 +431,19 @@ void uwbd_dev_onair(struct uwb_rc *rc, s
+ uwb_dev->mac_addr = *bce->mac_addr;
+ uwb_dev->dev_addr = bce->dev_addr;
+ dev_set_name(&uwb_dev->dev, "%s", macbuf);
++
++ /* plug the beacon cache */
++ bce->uwb_dev = uwb_dev;
++ uwb_dev->bce = bce;
++ uwb_bce_get(bce); /* released in uwb_dev_sys_release() */
++
+ result = uwb_dev_add(uwb_dev, &rc->uwb_dev.dev, rc);
+ if (result < 0) {
+ dev_err(dev, "new device %s: cannot instantiate device\n",
+ macbuf);
+ goto error_dev_add;
+ }
+- /* plug the beacon cache */
+- bce->uwb_dev = uwb_dev;
+- uwb_dev->bce = bce;
+- uwb_bce_get(bce); /* released in uwb_dev_sys_release() */
++
+ dev_info(dev, "uwb device (mac %s dev %s) connected to %s %s\n",
+ macbuf, devbuf, rc->uwb_dev.dev.parent->bus->name,
+ dev_name(rc->uwb_dev.dev.parent));
+@@ -448,6 +451,8 @@ void uwbd_dev_onair(struct uwb_rc *rc, s
+ return;
+
+ error_dev_add:
++ bce->uwb_dev = NULL;
++ uwb_bce_put(bce);
+ kfree(uwb_dev);
+ return;
+ }
--- /dev/null
+From c207e7c50f31113c24a9f536fcab1e8a256985d7 Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Thu, 11 Sep 2014 13:55:48 +0300
+Subject: xhci: Fix null pointer dereference if xhci initialization fails
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit c207e7c50f31113c24a9f536fcab1e8a256985d7 upstream.
+
+If xhci initialization fails before the roothub bandwidth
+domains (xhci->rh_bw[i]) are allocated it will oops when
+trying to access rh_bw members in xhci_mem_cleanup().
+
+Reported-by: Manuel Reimer <manuel.reimer@gmx.de>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci-mem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/host/xhci-mem.c
++++ b/drivers/usb/host/xhci-mem.c
+@@ -1819,7 +1819,7 @@ void xhci_mem_cleanup(struct xhci_hcd *x
+ xhci_cleanup_command_queue(xhci);
+
+ num_ports = HCS_MAX_PORTS(xhci->hcs_params1);
+- for (i = 0; i < num_ports; i++) {
++ for (i = 0; i < num_ports && xhci->rh_bw; i++) {
+ struct xhci_interval_bw_table *bwt = &xhci->rh_bw[i].bw_table;
+ for (j = 0; j < XHCI_MAX_INTERVAL; j++) {
+ struct list_head *ep = &bwt->interval_bw[j].endpoints;
--- /dev/null
+From 96044694b8511bc2b04df0776b4ba295cfe005c0 Mon Sep 17 00:00:00 2001
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+Date: Thu, 11 Sep 2014 13:55:50 +0300
+Subject: xhci: fix oops when xhci resumes from hibernate with hw lpm capable devices
+
+From: Mathias Nyman <mathias.nyman@linux.intel.com>
+
+commit 96044694b8511bc2b04df0776b4ba295cfe005c0 upstream.
+
+Resuming from hibernate (S4) will restart and re-initialize xHC.
+The device contexts are freed and will be re-allocated later during device reset.
+
+Usb core will disable link pm in device resume before device reset, which will
+try to change the max exit latency, accessing the device contexts before they are re-allocated.
+
+There is no need to zero (disable) the max exit latency when disabling hw lpm
+for a freshly re-initialized xHC. So check that device context exists before
+doing anything. The max exit latency will be set again after device reset when usb core
+enables the link pm.
+
+Reported-by: Imre Deak <imre.deak@intel.com>
+Tested-by: Imre Deak <imre.deak@intel.com>
+Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/host/xhci.c | 12 ++++++++++--
+ 1 file changed, 10 insertions(+), 2 deletions(-)
+
+--- a/drivers/usb/host/xhci.c
++++ b/drivers/usb/host/xhci.c
+@@ -3982,13 +3982,21 @@ static int __maybe_unused xhci_change_ma
+ int ret;
+
+ spin_lock_irqsave(&xhci->lock, flags);
+- if (max_exit_latency == xhci->devs[udev->slot_id]->current_mel) {
++
++ virt_dev = xhci->devs[udev->slot_id];
++
++ /*
++ * virt_dev might not exists yet if xHC resumed from hibernate (S4) and
++ * xHC was re-initialized. Exit latency will be set later after
++ * hub_port_finish_reset() is done and xhci->devs[] are re-allocated
++ */
++
++ if (!virt_dev || max_exit_latency == virt_dev->current_mel) {
+ spin_unlock_irqrestore(&xhci->lock, flags);
+ return 0;
+ }
+
+ /* Attempt to issue an Evaluate Context command to change the MEL. */
+- virt_dev = xhci->devs[udev->slot_id];
+ command = xhci->lpm_command;
+ ctrl_ctx = xhci_get_input_control_ctx(xhci, command->in_ctx);
+ if (!ctrl_ctx) {