usb: xhci-dwc3: Power on USB PHY before using
authorVignesh R <vigneshr@ti.com>
Wed, 7 Mar 2018 09:20:08 +0000 (14:50 +0530)
committerMarek Vasut <marex@denx.de>
Sat, 17 Mar 2018 02:19:08 +0000 (03:19 +0100)
It is wrong that expect .phy_init() to also power on the PHY. Therefore,
explicitly, call generic_phy_power_on() after generic_phy_power_init() in
order to power on PHY before using it.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
drivers/usb/host/xhci-dwc3.c

index 258d1cd00a085adaa9cf1c613947eaf43c3767aa..cf1986bebd07cc8cb047d8c1ff48024f3934f6f0 100644 (file)
@@ -137,6 +137,12 @@ static int xhci_dwc3_probe(struct udevice *dev)
                        pr_err("Can't init USB PHY for %s\n", dev->name);
                        return ret;
                }
+
+               ret = generic_phy_power_on(&plat->usb_phy);
+               if (ret) {
+                       pr_err("Can't power on USB PHY for %s\n", dev->name);
+                       return ret;
+               }
        }
 
        dwc3_reg = (struct dwc3 *)((char *)(hccr) + DWC3_REG_OFFSET);
@@ -159,6 +165,12 @@ static int xhci_dwc3_remove(struct udevice *dev)
        int ret;
 
        if (generic_phy_valid(&plat->usb_phy)) {
+               ret = generic_phy_power_off(&plat->usb_phy);
+               if (ret) {
+                       pr_err("Can't poweroff USB PHY for %s\n", dev->name);
+                       return ret;
+               }
+
                ret = generic_phy_exit(&plat->usb_phy);
                if (ret) {
                        pr_err("Can't deinit USB PHY for %s\n", dev->name);