[U-Boot] [PATCH 2/2] net: gmac_rockchip: Add phy supply support

Joe Hershberger joe.hershberger at gmail.com
Tue Mar 21 18:56:13 UTC 2017


On Wed, Mar 15, 2017 at 4:28 AM, Jacob Chen <jacob2.chen at rock-chips.com> wrote:
> Some board need a regulator for gmac phy, so add this code to handle it.
>
> Signed-off-by: Jacob Chen <jacob2.chen at rock-chips.com>
> ---
>
>  drivers/net/gmac_rockchip.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
> index e9b202a..63cccc9 100644
> --- a/drivers/net/gmac_rockchip.c
> +++ b/drivers/net/gmac_rockchip.c
> @@ -17,6 +17,7 @@
>  #include <asm/arch/grf_rk3288.h>
>  #include <dm/pinctrl.h>
>  #include <dt-bindings/clock/rk3288-cru.h>
> +#include <power/regulator.h>
>  #include "designware.h"
>
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -79,6 +80,22 @@ static int gmac_rockchip_probe(struct udevice *dev)
>         struct clk clk;
>         int ret;
>
> +#if defined(CONFIG_DM_REGULATOR)
> +       struct udevice *phy_supply;
> +
> +       ret = device_get_supply_regulator(dev, "phy-supply",
> +                                         &phy_supply);
> +       if (ret) {
> +               debug("%s: No phy supply\n", dev->name);
> +       } else {
> +               ret = regulator_set_enable(phy_supply, true);
> +               if (ret) {
> +                       puts("Error enabling phy supply\n");
> +                       return ret;
> +               }
> +       }
> +#endif
> +

This seems pretty generic. Is there maybe a more common place this
could live? Or is the phy-supply binding in DT only defined for
rockchip?

>         ret = clk_get_by_index(dev, 0, &clk);
>         if (ret)
>                 return ret;
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot


More information about the U-Boot mailing list