summaryrefslogtreecommitdiff
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorPatrice Chotard <patrice.chotard@st.com>2018-03-14 17:48:53 +0100
committerMarek Vasut <marex@denx.de>2018-03-17 03:20:53 +0100
commita800a6793f095746173834ead6b3663bc3c0542c (patch)
tree3e4f9fa8b8bc2a084634bea96a1604eaf64709de /drivers/usb/host
parent2715e32ce117f596053d3a133d465cbb3d16531c (diff)
usb: ehci-generic: handle phy power on/off
Add generic_phy_power_on() and generic_phy_power_off() calls to switch ON/OFF phy during probe and remove functions. Signed-off-by: Christophe Kerello <christophe.kerello@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/ehci-generic.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 1cb92c0338..2edd6d7433 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -106,6 +106,12 @@ static int ehci_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;
+ }
}
hccr = map_physmem(dev_read_addr(dev), 0x100, MAP_NOCACHE);
@@ -120,6 +126,13 @@ static int ehci_usb_probe(struct udevice *dev)
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)
pr_err("failed to release phy\n");
@@ -147,6 +160,10 @@ static int ehci_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;