aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-19 14:03:44 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-19 14:03:44 -0700
commit9afcdb10ade4c3f5bedb1c7de9dd37f7061819eb (patch)
tree907326c69cd913364da38e7e7fb7b30559cc1063 /drivers/usb/core/hub.c
parent5584cfbafc1a4c2a465f4423d351bb918c64cad0 (diff)
parenta2cdc3432c361bb885476d1c625e22b518e0bc07 (diff)
Merge tag 'for-usb-next-2013-10-17' of git://git.kernel.org/pub/scm/linux/kernel/git/sarah/xhci into usb-next
Sarah writes: xhci: Final patches for 3.13 Hi Greg, Here's my pull request for usb-next and 3.13. My xHCI tree is closed after this point, since I won't be able to run my full tests while I'm in Scotland. After Kernel Summit, I'll be on vacation with access to email from Oct 26th to Nov 6th. Here's what's in this request: - Patches to fix USB 2.0 Link PM issues that cause USB 3.0 devices to not enumerate or misbehave when plugged into a USB 2.0 port. Those are marked for stable. - A msec vs jiffies bug fix by xiao jin, which results in fairly harmless behavior, and thus isn't marked for stable. - Xenia's patches to refactor the xHCI command handling code, which makes it much more readable and consistent. - Misc cleanup patches, one by Sachin Kamat and three from Dan Williams. Here's what's not in this request: - Dan's two patches to allow the xHCI host to use the "Windows" or "new" enumeration scheme. I did not have time to test those, and I want to run them with as many USB devices as I can get a hold of. That will have to wait for 3.14. - Xenia's patches to remove xhci_readl in favor of readl. I'll queue those for 3.14 after I test them. - The xHCI streams update, UAS fixes, and usbfs streams support. I'm not comfortable with changes and fixes to that patchset coming in this late. I would rather wait for 3.14 and be really sure the streams support is stable before we add new userspace API and remove CONFIG_BROKEN from the uas driver. - Julius' patch to clear the port reset bit on hub resume that came in a couple days ago. It looks harmless, but I would rather take the time to test and queue it for usb-linus and the stable trees once 3.13-rc1 is out. Sarah Sharp
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c45
1 files changed, 38 insertions, 7 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 92dde941fdbe..06cec635e703 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1112,16 +1112,13 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
/*
* USB3 protocol ports will automatically transition
* to Enabled state when detect an USB3.0 device attach.
- * Do not disable USB3 protocol ports.
+ * Do not disable USB3 protocol ports, just pretend
+ * power was lost
*/
- if (!hub_is_superspeed(hdev)) {
+ portstatus &= ~USB_PORT_STAT_ENABLE;
+ if (!hub_is_superspeed(hdev))
usb_clear_port_feature(hdev, port1,
USB_PORT_FEAT_ENABLE);
- portstatus &= ~USB_PORT_STAT_ENABLE;
- } else {
- /* Pretend that power was lost for USB3 devs */
- portstatus &= ~USB_PORT_STAT_ENABLE;
- }
}
/* Clear status-change flags; we'll debounce later */
@@ -3958,6 +3955,32 @@ static int hub_set_address(struct usb_device *udev, int devnum)
return retval;
}
+/*
+ * There are reports of USB 3.0 devices that say they support USB 2.0 Link PM
+ * when they're plugged into a USB 2.0 port, but they don't work when LPM is
+ * enabled.
+ *
+ * Only enable USB 2.0 Link PM if the port is internal (hardwired), or the
+ * device says it supports the new USB 2.0 Link PM errata by setting the BESL
+ * support bit in the BOS descriptor.
+ */
+static void hub_set_initial_usb2_lpm_policy(struct usb_device *udev)
+{
+ int connect_type;
+
+ if (!udev->usb2_hw_lpm_capable)
+ return;
+
+ connect_type = usb_get_hub_port_connect_type(udev->parent,
+ udev->portnum);
+
+ if ((udev->bos->ext_cap->bmAttributes & USB_BESL_SUPPORT) ||
+ connect_type == USB_PORT_CONNECT_TYPE_HARD_WIRED) {
+ udev->usb2_hw_lpm_allowed = 1;
+ usb_set_usb2_hardware_lpm(udev, 1);
+ }
+}
+
/* Reset device, (re)assign address, get device descriptor.
* Device connection must be stable, no more debouncing needed.
* Returns device in USB_STATE_ADDRESS, except on error.
@@ -4251,6 +4274,7 @@ hub_port_init (struct usb_hub *hub, struct usb_device *udev, int port1,
/* notify HCD that we have a device connected and addressed */
if (hcd->driver->update_device)
hcd->driver->update_device(hcd, udev);
+ hub_set_initial_usb2_lpm_policy(udev);
fail:
if (retval) {
hub_port_disable(hub, port1, 0);
@@ -5095,6 +5119,12 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
}
parent_hub = usb_hub_to_struct_hub(parent_hdev);
+ /* Disable USB2 hardware LPM.
+ * It will be re-enabled by the enumeration process.
+ */
+ if (udev->usb2_hw_lpm_enabled == 1)
+ usb_set_usb2_hardware_lpm(udev, 0);
+
bos = udev->bos;
udev->bos = NULL;
@@ -5202,6 +5232,7 @@ static int usb_reset_and_verify_device(struct usb_device *udev)
done:
/* Now that the alt settings are re-installed, enable LTM and LPM. */
+ usb_set_usb2_hardware_lpm(udev, 1);
usb_unlocked_enable_lpm(udev);
usb_enable_ltm(udev);
usb_release_bos_descriptor(udev);