]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: ohci-generic: handle phy power on/off
authorPatrice Chotard <patrice.chotard@st.com>
Wed, 14 Mar 2018 16:48:56 +0000 (17:48 +0100)
committerMarek Vasut <marex@denx.de>
Sat, 17 Mar 2018 02:20:53 +0000 (03:20 +0100)
Add generic_phy_power_on() and generic_phy_power_off()
calls to switch ON/OFF phy during probe and remove functions.

Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
drivers/usb/host/ohci-generic.c

index bf55a71d66c22fb09ea5bd7ac5a15664d51b5b57..4843b4ac859f81e9f5d546f17c8b32215fe3977b 100644 (file)
@@ -98,6 +98,12 @@ static int ohci_usb_probe(struct udevice *dev)
                        pr_err("failed to init usb phy\n");
                        goto reset_err;
                }
+
+               err = generic_phy_power_on(&priv->phy);
+               if (err) {
+                       dev_err(dev, "failed to power on usb phy\n");
+                       goto phy_power_err;
+               }
        }
 
        err = ohci_register(dev, regs);
@@ -107,6 +113,13 @@ static int ohci_usb_probe(struct udevice *dev)
        return 0;
 
 phy_err:
+       if (generic_phy_valid(&priv->phy)) {
+               ret = generic_phy_power_off(&priv->phy);
+               if (ret)
+                       dev_err(dev, "failed to power off usb phy\n");
+       }
+
+phy_power_err:
        if (generic_phy_valid(&priv->phy)) {
                ret = generic_phy_exit(&priv->phy);
                if (ret)
@@ -135,6 +148,10 @@ static int ohci_usb_remove(struct udevice *dev)
                return ret;
 
        if (generic_phy_valid(&priv->phy)) {
+               ret = generic_phy_power_off(&priv->phy);
+               if (ret)
+                       return ret;
+
                ret = generic_phy_exit(&priv->phy);
                if (ret)
                        return ret;