usb: core: Try generic PHY_MODE_USB_HOST if usb_phy_roothub_set_mode fails
authorChen-Yu Tsai <wens@csie.org>
Fri, 22 Mar 2019 08:51:08 +0000 (16:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Mar 2019 07:48:55 +0000 (16:48 +0900)
Some PHYs do not support PHY_MODE_USB_HOST_SS, i.e. USB 3.0 or higher.
Fall back and try the more generic PHY_MODE_USB_HOST if it fails.

Fixes: b97a31348379 ("usb: core: comply to PHY framework")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Tested-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hcd.c

index 3189181..975d7c1 100644 (file)
@@ -2742,6 +2742,9 @@ int usb_add_hcd(struct usb_hcd *hcd,
                retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
                                                  PHY_MODE_USB_HOST_SS);
                if (retval)
+                       retval = usb_phy_roothub_set_mode(hcd->phy_roothub,
+                                                         PHY_MODE_USB_HOST);
+               if (retval)
                        goto err_usb_phy_roothub_power_on;
 
                retval = usb_phy_roothub_power_on(hcd->phy_roothub);