On Wed, Nov 29, 2017 at 11:32:24AM +0200, Artturi Alm wrote:
> 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

Yes, but I don't see how this can work with the current dtbs.

sxie only matches "allwinner,sun4i-a10-emac" so you have one
of the following?

sun4i-a10-a1000.dtb "Mele A1000"
sun4i-a10-hackberry.dtb "Miniand Hackberry"
sun4i-a10-jesurun-q5.dtb "Jesurun Q5"

        ethernet@1c0b000 {
            compatible = "allwinner,sun4i-a10-emac";
            reg = <0x01c0b000 0x00001000>;
            interrupts = <0x00000037>;
            clocks = <0x00000002 0x0000002a>;
            allwinner,sram = <0x0000000b 0x00000001>;
            pinctrl-names = "default";
            pinctrl-0 = <0x0000000c>;
            status = "okay";
            phy = <0x0000000d>;
        };
        mdio@1c0b080 {
            compatible = "allwinner,sun4i-a10-mdio";
            reg = <0x01c0b080 0x00000014>;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            phy-supply = <0x0000000e>;
            ethernet-phy@0 {
                reg = <0x00000000>;
                linux,phandle = <0x0000000d>;
                phandle = <0x0000000d>;
            };
        };

compared to the a20 gmac dwge(4) use

        ethernet@1c50000 {
            compatible = "allwinner,sun7i-a20-gmac";
            reg = <0x01c50000 0x00010000>;
            interrupts = <0x00000000 0x00000055 0x00000004>;
            interrupt-names = "macirq";
            clocks = <0x00000002 0x00000042 0x00000026>;
            clock-names = "stmmaceth", "allwinner_gmac_tx";
            snps,pbl = <0x00000002>;
            snps,fixed-burst;
            snps,force_sf_dma_mode;
            status = "okay";
            #address-cells = <0x00000001>;
            #size-cells = <0x00000000>;
            pinctrl-names = "default";
            pinctrl-0 = <0x00000027>;
            phy = <0x00000028>;
            phy-mode = "rgmii";
            phy-supply = <0x00000029>;
            ethernet-phy@1 {
                reg = <0x00000001>;
                linux,phandle = <0x00000028>;
                phandle = <0x00000028>;
            };
        };

> 
> 
> 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;
>  
> 

Reply via email to