Revert "Revert "usb: core: lpm: set lpm_capable for root hub device"" 15/125315/11 accepted/tizen/unified/20170807.152205 submit/tizen/20170807.013143
authorDongwoo Lee <dwoo08.lee@samsung.com>
Fri, 14 Apr 2017 03:36:30 +0000 (12:36 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Wed, 2 Aug 2017 00:46:02 +0000 (09:46 +0900)
This reverts commit 'dc463ecea9d0 ("Revert "usb: core: lpm: set lpm_capable
for root hub device"")'

The original commit was reverted because it makes the USB port is not
working on Odroid-XU4. But now PHY tuning resolves this problem, so it
will be restored.

Change-Id: I59cdd3a6bf2f0fce06dce88a4f7844a82ed1eab5
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
drivers/usb/core/hcd.c
drivers/usb/core/hub.c
drivers/usb/core/usb.h

index 04a96309bffb91e53b764ed71127d84fd460b3f7..3a49ba2910dfe87ef72ff3d5ef0b64885842f9ab 100644 (file)
@@ -1022,9 +1022,12 @@ static int register_root_hub(struct usb_hcd *hcd)
                                dev_name(&usb_dev->dev), retval);
                return (retval < 0) ? retval : -EMSGSIZE;
        }
-       if (usb_dev->speed == USB_SPEED_SUPER) {
+
+       if (le16_to_cpu(usb_dev->descriptor.bcdUSB) >= 0x0201) {
                retval = usb_get_bos_descriptor(usb_dev);
-               if (retval < 0) {
+               if (!retval) {
+                       usb_dev->lpm_capable = usb_device_supports_lpm(usb_dev);
+               } else if (usb_dev->speed == USB_SPEED_SUPER) {
                        mutex_unlock(&usb_bus_list_lock);
                        dev_dbg(parent_dev, "can't read %s bos descriptor %d\n",
                                        dev_name(&usb_dev->dev), retval);
index ab49999fb2f642e6d89cfd8a9a379d5c5c11b669..c98f78b0bf1126731b69fc62ff7807609f40dea4 100644 (file)
@@ -122,7 +122,7 @@ struct usb_hub *usb_hub_to_struct_hub(struct usb_device *hdev)
        return usb_get_intfdata(hdev->actconfig->interface[0]);
 }
 
-static int usb_device_supports_lpm(struct usb_device *udev)
+int usb_device_supports_lpm(struct usb_device *udev)
 {
        /* Some devices have trouble with LPM */
        if (udev->quirks & USB_QUIRK_NO_LPM)
index 7eb1e26798e5f293a3f2bc508dd268bbecdb63f1..457255a3306a3c2837674d22aa9560bf30842220 100644 (file)
@@ -65,6 +65,7 @@ extern int  usb_hub_init(void);
 extern void usb_hub_cleanup(void);
 extern int usb_major_init(void);
 extern void usb_major_cleanup(void);
+extern int usb_device_supports_lpm(struct usb_device *udev);
 
 #ifdef CONFIG_PM