phy: remove phy-supply related code
authorEugen Hristev <eugen.hristev@collabora.com>
Mon, 15 May 2023 09:59:48 +0000 (12:59 +0300)
committerKever Yang <kever.yang@rock-chips.com>
Wed, 17 May 2023 09:36:18 +0000 (17:36 +0800)
phy-supply is now handled at uclass level. Remove it from the drivers that
implement it at the driver level.

Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Suggested-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
drivers/phy/meson-g12a-usb2.c
drivers/phy/meson-gxbb-usb2.c
drivers/phy/meson-gxl-usb2.c

index 2fbba7f..650b88b 100644 (file)
 
 struct phy_meson_g12a_usb2_priv {
        struct regmap           *regmap;
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice          *phy_supply;
-#endif
 #if CONFIG_IS_ENABLED(CLK)
        struct clk              clk;
 #endif
        struct reset_ctl        reset;
 };
 
-
-static int phy_meson_g12a_usb2_power_on(struct phy *phy)
-{
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice *dev = phy->dev;
-       struct phy_meson_g12a_usb2_priv *priv = dev_get_priv(dev);
-
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, true);
-               if (ret)
-                       return ret;
-       }
-#endif
-
-       return 0;
-}
-
-static int phy_meson_g12a_usb2_power_off(struct phy *phy)
-{
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice *dev = phy->dev;
-       struct phy_meson_g12a_usb2_priv *priv = dev_get_priv(dev);
-
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, false);
-               if (ret) {
-                       pr_err("Error disabling PHY supply\n");
-                       return ret;
-               }
-       }
-#endif
-
-       return 0;
-}
-
 static int phy_meson_g12a_usb2_init(struct phy *phy)
 {
        struct udevice *dev = phy->dev;
@@ -155,8 +117,6 @@ static int phy_meson_g12a_usb2_exit(struct phy *phy)
 struct phy_ops meson_g12a_usb2_phy_ops = {
        .init = phy_meson_g12a_usb2_init,
        .exit = phy_meson_g12a_usb2_exit,
-       .power_on = phy_meson_g12a_usb2_power_on,
-       .power_off = phy_meson_g12a_usb2_power_off,
 };
 
 int meson_g12a_usb2_phy_probe(struct udevice *dev)
@@ -193,14 +153,6 @@ int meson_g12a_usb2_phy_probe(struct udevice *dev)
        }
 #endif
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       ret = device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply);
-       if (ret && ret != -ENOENT) {
-               pr_err("Failed to get PHY regulator\n");
-               return ret;
-       }
-#endif
-
        return 0;
 }
 
index 7a2e3d2..70a80b8 100644 (file)
@@ -12,7 +12,6 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
-#include <power/regulator.h>
 #include <regmap.h>
 #include <reset.h>
 #include <linux/bitops.h>
@@ -81,9 +80,6 @@
 struct phy_meson_gxbb_usb2_priv {
        struct regmap *regmap;
        struct reset_ctl_bulk resets;
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice *phy_supply;
-#endif
 };
 
 static int phy_meson_gxbb_usb2_power_on(struct phy *phy)
@@ -92,15 +88,6 @@ static int phy_meson_gxbb_usb2_power_on(struct phy *phy)
        struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
        uint val;
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, true);
-
-               if (ret)
-                       return ret;
-       }
-#endif
-
        regmap_update_bits(priv->regmap, REG_CONFIG,
                           REG_CONFIG_CLK_32k_ALTSEL,
                           REG_CONFIG_CLK_32k_ALTSEL);
@@ -140,26 +127,8 @@ static int phy_meson_gxbb_usb2_power_on(struct phy *phy)
        return 0;
 }
 
-static int phy_meson_gxbb_usb2_power_off(struct phy *phy)
-{
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice *dev = phy->dev;
-       struct phy_meson_gxbb_usb2_priv *priv = dev_get_priv(dev);
-
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, false);
-
-               if (ret)
-                       return ret;
-       }
-#endif
-
-       return 0;
-}
-
 static struct phy_ops meson_gxbb_usb2_phy_ops = {
        .power_on = phy_meson_gxbb_usb2_power_on,
-       .power_off = phy_meson_gxbb_usb2_power_off,
 };
 
 static int meson_gxbb_usb2_phy_probe(struct udevice *dev)
@@ -192,13 +161,6 @@ static int meson_gxbb_usb2_phy_probe(struct udevice *dev)
                return ret;
        }
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       ret = device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply);
-       if (ret && ret != -ENOENT) {
-               pr_err("Failed to get PHY regulator\n");
-               return ret;
-       }
-#endif
        ret = reset_get_bulk(dev, &priv->resets);
        if (!ret) {
                ret = reset_deassert_bulk(&priv->resets);
index 9fb376c..4c63131 100644 (file)
@@ -16,7 +16,6 @@
 #include <generic-phy.h>
 #include <regmap.h>
 #include <linux/delay.h>
-#include <power/regulator.h>
 #include <clk.h>
 #include <linux/usb/otg.h>
 
 
 struct phy_meson_gxl_usb2_priv {
        struct regmap           *regmap;
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       struct udevice          *phy_supply;
-#endif
 #if CONFIG_IS_ENABLED(CLK)
        struct clk              clk;
 #endif
@@ -167,14 +163,6 @@ static int phy_meson_gxl_usb2_power_on(struct phy *phy)
 
        phy_meson_gxl_usb2_set_mode(phy, USB_DR_MODE_HOST);
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, true);
-               if (ret)
-                       return ret;
-       }
-#endif
-
        return 0;
 }
 
@@ -189,16 +177,6 @@ static int phy_meson_gxl_usb2_power_off(struct phy *phy)
        val |= U2P_R0_POWER_ON_RESET;
        regmap_write(priv->regmap, U2P_R0, val);
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       if (priv->phy_supply) {
-               int ret = regulator_set_enable(priv->phy_supply, false);
-               if (ret) {
-                       pr_err("Error disabling PHY supply\n");
-                       return ret;
-               }
-       }
-#endif
-
        return 0;
 }
 
@@ -229,14 +207,6 @@ int meson_gxl_usb2_phy_probe(struct udevice *dev)
        }
 #endif
 
-#if CONFIG_IS_ENABLED(DM_REGULATOR)
-       ret = device_get_supply_regulator(dev, "phy-supply", &priv->phy_supply);
-       if (ret && ret != -ENOENT) {
-               pr_err("Failed to get PHY regulator\n");
-               return ret;
-       }
-#endif
-
        return 0;
 }