From: Chen-Yu Tsai Date: Fri, 22 Mar 2019 08:51:07 +0000 (+0800) Subject: phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs X-Git-Tag: Ubuntu-4.15.0-61.68~2542 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8d20c3dffaf90a30c89e17f4eb4f4ad1ef13c1d8;p=mirror_ubuntu-bionic-kernel.git phy: sun4i-usb: Support set_mode to USB_HOST for non-OTG PHYs BugLink: https://bugs.launchpad.net/bugs/1838116 commit 1396929e8a903db80425343cacca766a18ad6409 upstream. While only the first PHY supports mode switching, the remaining PHYs work in USB host mode. They should support set_mode with mode=USB_HOST instead of failing. This is especially needed now that the USB core does set_mode for all USB ports, which was added in commit b97a31348379 ("usb: core: comply to PHY framework"). Make set_mode with mode=USB_HOST a no-op instead of failing for the non-OTG USB PHYs. Fixes: 6ba43c291961 ("phy-sun4i-usb: Add support for phy_set_mode") Signed-off-by: Chen-Yu Tsai Cc: stable Signed-off-by: Greg Kroah-Hartman Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index e49fd0de34b1..e5e4827e71f3 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -480,8 +480,11 @@ static int sun4i_usb_phy_set_mode(struct phy *_phy, enum phy_mode mode) struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); int new_mode; - if (phy->index != 0) + if (phy->index != 0) { + if (mode == PHY_MODE_USB_HOST) + return 0; return -EINVAL; + } switch (mode) { case PHY_MODE_USB_HOST: