linux/drivers/usb/core
Hans de Goede a82b76f7fa usb: Reset USB-3 devices on USB-3 link bounce
On disconnect USB3 protocol ports transit from U0 to SS.Inactive to Rx.Detect,
on a recoverable error, the port stays in SS.Inactive and we recover from it by
doing a warm-reset (through usb_device_reset if we have a udev for the port).

If this really is a disconnect we may end up trying the warm-reset anyways,
since khubd may run before the SS.Inactive to Rx.Detect transition, or it
may get skipped if the transition to Rx.Detect happens before khubd gets run.

With a loose connector, or in the case which actually led me to debugging this
bad ACPI firmware toggling Vbus off and on in quick succession, the port
may transition from Rx.Detect to U0 again before khubd gets run. In this case
the device state is unknown really, but khubd happily goes into the resuscitate
an existing device path, and the device driver never gets notified about the
device state being messed up.

If the above scenario happens with a streams using device, as soon as an urb
is submitted to an endpoint with streams, the following appears in dmesg:

ERROR Transfer event for disabled endpoint or incorrect stream ring
@0000000036807420 00000000 00000000 04000000 04078000

Notice how the TRB address is all zeros. I've seen this both on Intel
Pantherpoint and Nec xhci hosts.

Luckily we can detect the U0 to SS.Inactive to Rx.Detect to U0 all having
happened before khubd runs case since the C_LINK_STATE bit gets set in the
portchange bits on the U0 -> SS.Inactive change. This bit will also be set on
suspend / resume, but then it gets cleared by port_hub_init before khubd runs.

So if the C_LINK_STATE bit is set and a warm-reset is not needed, iow the port
is not still in SS.Inactive, and the port still has a connection, then the
device needs to be reset to put it back in a known state.

I've verified that doing the device reset also fixes the transfer event with
all zeros address issue.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
2014-03-04 15:38:15 -08:00
..
buffer.c USB: core: correct spelling mistakes in comments and warning 2014-01-07 16:17:40 -08:00
config.c usb-core: Move USB_MAXENDPOINTS definitions to usb.h 2014-03-04 15:38:03 -08:00
devices.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-02-26 20:16:07 -08:00
devio.c usbfs: Add support for allocating / freeing streams 2014-03-04 15:38:05 -08:00
driver.c usb-core: Free bulk streams on interface release 2014-03-04 15:38:03 -08:00
endpoint.c USB: core: be specific about attribute permissions 2013-08-25 15:12:03 -07:00
file.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
generic.c USB: avoid error messages when a device is disconnected 2013-03-28 11:05:52 -07:00
hcd-pci.c usb: hcd: move controller wakeup setting initialization to individual driver 2013-12-08 18:06:46 -08:00
hcd.c usb-core: Track if an endpoint has streams 2014-03-04 15:38:03 -08:00
hub.c usb: Reset USB-3 devices on USB-3 link bounce 2014-03-04 15:38:15 -08:00
hub.h USB: core: correct spelling mistakes in comments and warning 2014-01-07 16:17:40 -08:00
Kconfig treewide: Fix typo in Kconfig 2013-10-14 15:23:02 +02:00
Makefile USB: core: remove CONFIG_USB_DEBUG usage 2013-12-21 16:01:00 -08:00
message.c usb: Clear host_endpoint->streams when implicitly freeing streams 2014-03-04 15:38:15 -08:00
notify.c usb: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:25 -04:00
otg_whitelist.h
port.c USB: core: be specific about attribute permissions 2013-08-25 15:12:03 -07:00
quirks.c Revert "USB: quirks: add touchscreen that is dazzeled by remote wakeup" 2013-12-08 18:07:38 -08:00
sysfs.c USB: core: correct spelling mistakes in comments and warning 2014-01-07 16:17:40 -08:00
urb.c usb: delete non-required instances of include <linux/init.h> 2014-01-08 15:01:39 -08:00
usb-acpi.c ACPI and power management updates for 3.14-rc1 2014-01-24 15:51:02 -08:00
usb.c drivers: usb: core: {file,hub,sysfs,usb}.c: Whitespace fixes 2013-10-11 17:02:37 -07:00
usb.h Revert "usbcore: set lpm_capable field for LPM capable root hubs" 2014-01-22 13:59:35 -08:00