diff options
author | Marek Vasut <marek.vasut+renesas@gmail.com> | 2018-08-08 14:29:55 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2018-08-28 11:00:18 +0200 |
commit | b43cdf9b3fe246a8920d2b62ee41fc1722315ef0 (patch) | |
tree | cbfbf01c76cc8c26f51489ed219f18ae4901204a /drivers/usb/host/ehci-generic.c | |
parent | a265e5ef426ed224bfd2ee3d05535e6c573a16ba (diff) |
usb: ehci: Make the PHY handling generic
Pull out the EHCI PHY functions into the ehci-hcd.c to let other
EHCI drivers use them.
Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com>
Diffstat (limited to 'drivers/usb/host/ehci-generic.c')
-rw-r--r-- | drivers/usb/host/ehci-generic.c | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index 5a56f66cfa..cc2f33826a 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -26,56 +26,6 @@ struct generic_ehci { int reset_count; }; -static int ehci_setup_phy(struct udevice *dev, int index) -{ - struct generic_ehci *priv = dev_get_priv(dev); - int ret; - - ret = generic_phy_get_by_index(dev, index, &priv->phy); - if (ret) { - if (ret != -ENOENT) { - dev_err(dev, "failed to get usb phy\n"); - return ret; - } - } else { - ret = generic_phy_init(&priv->phy); - if (ret) { - dev_err(dev, "failed to init usb phy\n"); - return ret; - } - - ret = generic_phy_power_on(&priv->phy); - if (ret) { - dev_err(dev, "failed to power on usb phy\n"); - return generic_phy_exit(&priv->phy); - } - } - - return 0; -} - -static int ehci_shutdown_phy(struct udevice *dev) -{ - struct generic_ehci *priv = dev_get_priv(dev); - int ret = 0; - - 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"); - return ret; - } - - ret = generic_phy_exit(&priv->phy); - if (ret) { - dev_err(dev, "failed to power off usb phy\n"); - return ret; - } - } - - return 0; -} - static int ehci_usb_probe(struct udevice *dev) { struct generic_ehci *priv = dev_get_priv(dev); @@ -145,7 +95,7 @@ static int ehci_usb_probe(struct udevice *dev) } } - err = ehci_setup_phy(dev, 0); + err = ehci_setup_phy(dev, &priv->phy, 0); if (err) goto reset_err; @@ -160,7 +110,7 @@ static int ehci_usb_probe(struct udevice *dev) return 0; phy_err: - ret = ehci_shutdown_phy(dev); + ret = ehci_shutdown_phy(dev, &priv->phy); if (ret) dev_err(dev, "failed to shutdown usb phy\n"); @@ -185,7 +135,7 @@ static int ehci_usb_remove(struct udevice *dev) if (ret) return ret; - ret = ehci_shutdown_phy(dev); + ret = ehci_shutdown_phy(dev, &priv->phy); if (ret) return ret; |