linux/drivers/usb/host
Mathias Nyman e058b2438f xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices
commit dad67d5f3d upstream.

Clear device initiated resume variables once device is fully up and running
in U0 state.

Resume needs to be signaled for 20ms for usb2 devices before they can be
moved to U0 state.

An interrupt is triggered if a device initiates resume. As we handle the
event in interrupt context we can not sleep for 20ms, so we instead set
a resume flag, a timestamp, and start the roothub polling.

The roothub code will later move the port to U0 when it finds a port in
resume state with the resume flag set, and timestamp passed by 20ms.

A host initiated resume is however not done in interrupt context, and
host initiated resume code will directly signal resume, wait 20ms and then
move the port to U0.

These two codepaths can race, if we are in the middle of a host initated
resume, while sleeping for 20ms, we may handle a port event and find the
port in resume state. The port event handling code will assume the resume
was device initiated and set the resume flag and timestamp.

Root hub code will however not catch the port in resume state again as the
host initated resume code has already moved the port to U0.
The resume flag and timestamp will remain set for this port preventing port
from suspending again  (LPM setting port to U3)

Fix this for now by always clearing the device initated resume parameters
once port is in U0

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ luis: backported to 3.16: adjusted context ]
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
History 2015-12-14 10:17:10 +00:00
..
whci usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
bcma-hcd.c DMA-API: usb: bcma: replace dma_set_mask()+dma_set_coherent_mask() with new helper 2013-10-31 14:48:34 +00:00
ehci-atmel.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-dbg.c usb: Use dev_is_pci() to check whether it is pci device 2013-12-08 18:01:56 -08:00
ehci-exynos.c usb: host: ehci-exynos: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ehci-fsl.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-10-28 10:33:15 +00:00
ehci-fsl.h powerpc/usb: fix bug of CPU hang when missing USB PHY clock 2012-09-05 16:52:08 -07:00
ehci-grlib.c USB: ehci-grlib: use dev_err() instead of printk() 2013-12-18 16:32:41 -08:00
ehci-hcd.c usb: host: ehci: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:45 +01:00
ehci-hub.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-10-28 10:33:15 +00:00
ehci-mem.c USB: EHCI: fix sparse errors 2013-10-19 14:08:04 -07:00
ehci-msm.c usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ehci-mv.c usb: host: ehci-mv: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ehci-mxc.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-octeon.c USB: ehci-octeon: Use devm_ioremap_resource() 2013-12-18 16:34:20 -08:00
ehci-omap.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-orion.c usb: ehci-orion: fix probe for !GENERIC_PHY 2015-12-13 17:49:29 +00:00
ehci-pci.c USB: ehci-pci: USB host controller support for Intel Quark X1000 2014-09-05 16:36:25 -07:00
ehci-platform.c usb: ehci-platform: add optional reset controller retrieval 2014-05-27 15:53:01 -07:00
ehci-pmcmsp.c MIPS: MSP71xx: Remove checks for two macros 2014-05-23 15:12:39 +02:00
ehci-ppc-of.c USB: ehci-ppc-of: use dev_err() instead of printk() 2013-12-18 16:32:41 -08:00
ehci-ps3.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-q.c usb: kill DEBUG compile option 2013-12-03 10:34:33 -08:00
ehci-sched.c USB: EHCI: fix initialization bug in iso_stream_schedule() 2015-01-22 16:33:19 +00:00
ehci-sead3.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-sh.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ehci-spear.c usb: host: ehci-spear: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ehci-sysfs.c usb: host: ehci-sys: delete useless bus_to_hcd conversion 2015-09-28 10:21:43 +01:00
ehci-tegra.c usb: host: ehci-tegra: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ehci-tilegx.c tile: usb: Use irq_alloc/free_hwirq 2014-05-16 14:05:20 +02:00
ehci-timer.c USB: EHCI: improve interrupt qh unlink 2013-08-12 11:43:48 -07:00
ehci-w90x900.c USB: ehci-w90x900: Use devm_ioremap_resource() 2013-12-18 16:35:11 -08:00
ehci-xilinx-of.c USB: ehci-xilinx-of: use dev_err() instead of printk() 2013-12-18 16:32:41 -08:00
ehci.h drivers: usb: fsl: Workaround for USB erratum-A005275 2015-10-28 10:33:15 +00:00
fhci-dbg.c USB: FHCI: Reusing QUICC Engine USB Controller registers from immap_qe.h 2012-06-26 19:42:11 -07:00
fhci-hcd.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
fhci-hub.c USB: FHCI: Reusing QUICC Engine USB Controller registers from immap_qe.h 2012-06-26 19:42:11 -07:00
fhci-mem.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-q.c USB: make hcd.h public (drivers dependency) 2010-05-20 13:21:30 -07:00
fhci-sched.c USB: FHCI: upgrade the isochronous API 2013-05-30 21:34:31 +09:00
fhci-tds.c USB: FHCI: Reusing QUICC Engine USB Controller registers from immap_qe.h 2012-06-26 19:42:11 -07:00
fhci.h USB: FHCI: upgrade the isochronous API 2013-05-30 21:34:31 +09:00
fotg210-hcd.c usb: host: fotg210: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:47 +01:00
fotg210.h fotg210: remove conditional compilation 2013-12-03 10:28:39 -08:00
fsl-mph-dr-of.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-10-28 10:33:15 +00:00
fusbh200-hcd.c usb: host: fusbh200: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:47 +01:00
fusbh200.h fusb200h: always compile in debugfs support 2013-12-03 10:31:21 -08:00
hwa-hc.c usb: wusbcore: disable transfer notifications for Alereon HWAs 2014-03-07 12:52:04 -08:00
imx21-dbg.c usb: kill DEBUG compile option 2013-12-03 10:34:33 -08:00
imx21-hcd.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
imx21-hcd.h usb: kill DEBUG compile option 2013-12-03 10:34:33 -08:00
isp116x-hcd.c usb: host: isp116x: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:46 +01:00
isp116x.h USB: isp116x: remove dependency on CONFIG_USB_DEBUG 2013-07-23 16:35:17 -07:00
isp1362-hcd.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
isp1362.h USB: isp1362: move debug files from proc to debugfs 2013-07-24 14:43:05 -07:00
isp1760-hcd.c usb: isp1760: hcd: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:50 +01:00
isp1760-hcd.h usb/isp1760: Allow to optionally trigger low-level chip reset via GPIOLIB. 2011-10-19 13:29:06 -07:00
isp1760-if.c USB: host: use dev_get_platdata() 2013-07-31 17:53:50 -07:00
Kconfig usb: Kconfig: make EHCI_MSM selectable for QCOM SOCs 2014-06-30 22:47:18 -07:00
Makefile usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers 2014-05-27 15:40:40 -07:00
max3421-hcd.c usb: host: max3421-hcd: Use module_spi_driver 2014-05-29 11:19:30 -07:00
octeon2-common.c usb: Configure octeon2 glue logic for proper uSOF cycle period. 2011-05-03 10:09:32 -07:00
ohci-at91.c USB: OHCI: Export the OHCI hub control and status_data functions 2014-04-24 13:05:32 -07:00
ohci-da8xx.c USB: ohci-da8xx: Use devm_*() functions 2013-12-18 16:35:11 -08:00
ohci-dbg.c USB: OHCI: fix bugs in debug routines 2014-09-05 16:36:24 -07:00
ohci-exynos.c usb: host: ohci-exynos: Use devm_ioremap_resource instead of devm_ioremap 2014-05-27 14:52:29 -07:00
ohci-hcd.c USB: OHCI: fix bugs in debug routines 2014-09-05 16:36:24 -07:00
ohci-hub.c Merge 3.15-rc5 into usb-next 2014-05-20 09:49:41 +09:00
ohci-jz4740.c USB: ohci-jz4740: FEAT_POWER is a port feature, not a hub feature 2014-04-16 13:59:41 -07:00
ohci-mem.c USB: OHCI handles more ZFMicro quirks 2007-10-12 14:54:59 -07:00
ohci-nxp.c USB: ohci-nxp: Use devm_clk_get() 2013-12-18 16:36:10 -08:00
ohci-octeon.c USB: ohci-octeon: Use devm_ioremap_resource() 2013-12-18 16:36:11 -08:00
ohci-omap.c USB: ohci-omap: use dev_err() instead of printk() 2013-12-18 16:32:41 -08:00
ohci-omap3.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ohci-pci.c USB: OHCI: fix problem with global suspend on ATI controllers 2014-05-03 17:58:46 -04:00
ohci-platform.c usb: ohci-platform: Enable optional use of reset controller 2014-05-27 15:53:00 -07:00
ohci-ppc-of.c USB: ohci-ppc-of: Use devm_ioremap_resource() 2013-12-18 16:36:10 -08:00
ohci-ps3.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ohci-pxa27x.c USB: ohci-pxa27x: Add support for external vbus regulators 2014-04-24 13:05:32 -07:00
ohci-q.c USB: OHCI: Fix race between ED unlink and URB submission 2015-08-11 09:57:42 +01:00
ohci-s3c2410.c USB: OHCI: Export the OHCI hub control and status_data functions 2014-04-24 13:05:32 -07:00
ohci-sa1111.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ohci-sm501.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
ohci-spear.c USB: ohci-spear: Use devm_ioremap_resource() 2013-12-18 16:36:11 -08:00
ohci-tilegx.c tile: usb: Use irq_alloc/free_hwirq 2014-05-16 14:05:20 +02:00
ohci-tmio.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
ohci.h Merge 3.15-rc5 into usb-next 2014-05-20 09:49:41 +09:00
oxu210hp-hcd.c usb: host: oxu210hp: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:48 +01:00
oxu210hp.h USB: replace uses of __constant_{endian} 2009-03-24 16:20:33 -07:00
pci-quirks.c OHCI: add a quirk for ULi M5237 blocking on reset 2015-01-22 16:33:23 +00:00
pci-quirks.h usb: pci_quirks: fix sparse 'symbol not declared' warning 2014-05-27 16:25:32 -07:00
r8a66597-hcd.c usb: host: r8a66597: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:48 +01:00
r8a66597.h usb/host/r8a66597: remove conditional compilation of clk code 2012-07-30 17:25:12 -07:00
sl811-hcd.c usb: host: sl811: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:49 +01:00
sl811.h USB: sl811: move debug files from proc to debugfs 2013-07-24 14:43:05 -07:00
sl811_cs.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
ssb-hcd.c DMA-API: usb: ssb-hcd: replace dma_set_mask()+dma_set_coherent_mask() with new helper 2013-10-31 14:48:36 +00:00
u132-hcd.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
uhci-debug.c usb: kill DEBUG compile option 2013-12-03 10:34:33 -08:00
uhci-grlib.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
uhci-hcd.c usb: kill DEBUG compile option 2013-12-03 10:34:33 -08:00
uhci-hcd.h USB: UHCI: remove unused definition 2013-01-24 13:42:09 -08:00
uhci-hub.c usb: host: uhci: use new USB_RESUME_TIMEOUT 2015-05-05 11:09:45 +01:00
uhci-pci.c USB: remove DEFINE_PCI_DEVICE_TABLE macro 2013-12-04 16:58:47 -08:00
uhci-platform.c uhci-platform: Change compatible string from platform-uhci to generic-uhci 2014-02-15 12:25:51 -08:00
uhci-q.c USB: UHCI: accept very late isochronous URBs 2013-09-25 17:05:34 -07:00
xhci-dbg.c Revert "xhci: replace xhci_read_64() with readq()" 2014-01-30 13:27:49 -08:00
xhci-ext-caps.h xhci: fix port BESL LPM capability checking 2013-08-27 08:54:42 -07:00
xhci-hub.c xhci: Fix a race in usb2 LPM resume, blocking U3 for usb2 devices 2015-12-14 10:17:10 +00:00
xhci-mem.c xhci: init command timeout timer earlier to avoid deleting it uninitialized 2015-10-19 10:54:29 +01:00
xhci-mvebu.c usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers 2014-05-27 15:40:40 -07:00
xhci-mvebu.h usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers 2014-05-27 15:40:40 -07:00
xhci-pci.c xhci: Add spurious wakeup quirk for LynxPoint-LP controllers 2015-11-16 11:27:03 +00:00
xhci-plat.c usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks 2015-03-18 14:41:56 +00:00
xhci-ring.c xhci: handle no ping response error properly 2015-11-16 11:27:02 +00:00
xhci-trace.c xhci: add traces for debug messages in xhci_address_device() 2013-08-13 16:05:38 -07:00
xhci-trace.h xhci: fix sparse warning in xhci-trace.h 2013-12-02 12:59:45 -08:00
xhci.c xhci: Workaround to get Intel xHCI reset working more reliably 2015-12-14 10:17:10 +00:00
xhci.h xhci: prevent bus_suspend if SS port resuming in phase 1 2015-08-11 09:57:40 +01:00