On Sun, Nov 26, 2017 at 06:52:42PM +0200, Artturi Alm wrote:
> Hi,
> 
> unless i failed w/grep, only 4 boards with dts in u-boot/linux need this,
> but i've got one of those, so this would be much appreciated:)
> 
> -Artturi

This seems reasonable and there is no non-panic error path
there currently to add a regulator_disable() call to.

Changing the variable name to phy_supply would match the existing
code in sys/dev/fdt.

> 
> 
> diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c
> index 116fda5f8d7..b5edab31a09 100644
> --- a/sys/arch/armv7/sunxi/sxie.c
> +++ b/sys/arch/armv7/sunxi/sxie.c
> @@ -51,6 +51,7 @@
>  #include <dev/ofw/openfirm.h>
>  #include <dev/ofw/ofw_clock.h>
>  #include <dev/ofw/ofw_pinctrl.h>
> +#include <dev/ofw/ofw_regulator.h>
>  #include <dev/ofw/fdt.h>
>  
>  /* configuration registers */
> @@ -212,6 +213,7 @@ sxie_attach(struct device *parent, struct device *self, 
> void *aux)
>       struct fdt_attach_args *faa = aux;
>       struct mii_data *mii;
>       struct ifnet *ifp;
> +     int physupply;
>       int s;
>  
>       if (faa->fa_nreg < 1)
> @@ -233,6 +235,11 @@ sxie_attach(struct device *parent, struct device *self, 
> void *aux)
>       sxie_socware_init(sc);
>       sc->txf_inuse = 0;
>  
> +     /* Power up PHY. */
> +     physupply = OF_getpropint(faa->fa_node, "phy-supply", 0);
> +     if (physupply)
> +             regulator_enable(physupply);
> +
>       sc->sc_ih = arm_intr_establish_fdt(faa->fa_node, IPL_NET,
>           sxie_intr, sc, sc->sc_dev.dv_xname);
>  
> 

Reply via email to