Skip to content
Snippets Groups Projects
Commit a800a679 authored by Patrice Chotard's avatar Patrice Chotard Committed by Marek Vasut
Browse files

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: default avatarChristophe Kerello <christophe.kerello@st.com>
Signed-off-by: default avatarPatrice Chotard <patrice.chotard@st.com>
parent 2715e32c
No related branches found
No related tags found
No related merge requests found
...@@ -106,6 +106,12 @@ static int ehci_usb_probe(struct udevice *dev) ...@@ -106,6 +106,12 @@ static int ehci_usb_probe(struct udevice *dev)
pr_err("failed to init usb phy\n"); pr_err("failed to init usb phy\n");
goto reset_err; 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); hccr = map_physmem(dev_read_addr(dev), 0x100, MAP_NOCACHE);
...@@ -119,6 +125,13 @@ static int ehci_usb_probe(struct udevice *dev) ...@@ -119,6 +125,13 @@ static int ehci_usb_probe(struct udevice *dev)
return 0; return 0;
phy_err: 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)) { if (generic_phy_valid(&priv->phy)) {
ret = generic_phy_exit(&priv->phy); ret = generic_phy_exit(&priv->phy);
if (ret) if (ret)
...@@ -147,6 +160,10 @@ static int ehci_usb_remove(struct udevice *dev) ...@@ -147,6 +160,10 @@ static int ehci_usb_remove(struct udevice *dev)
return ret; return ret;
if (generic_phy_valid(&priv->phy)) { if (generic_phy_valid(&priv->phy)) {
ret = generic_phy_power_off(&priv->phy);
if (ret)
return ret;
ret = generic_phy_exit(&priv->phy); ret = generic_phy_exit(&priv->phy);
if (ret) if (ret)
return ret; return ret;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment