On Wed, Nov 29, 2017 at 12:37:23AM +1100, Jonathan Gray wrote:
> 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.
>
Like this?
-Artturi
diff --git a/sys/arch/armv7/sunxi/sxie.c b/sys/arch/armv7/sunxi/sxie.c
index 116fda5f8d7..41c378a7ef7 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 phy_supply;
int s;
if (faa->fa_nreg < 1)
@@ -230,6 +232,11 @@ sxie_attach(struct device *parent, struct device *self,
void *aux)
clock_enable_all(faa->fa_node);
+ /* Power up PHY. */
+ phy_supply = OF_getpropint(faa->fa_node, "phy-supply", 0);
+ if (phy_supply)
+ regulator_enable(phy_supply);
+
sxie_socware_init(sc);
sc->txf_inuse = 0;