Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/allwinner support for phy power gpio pins



details:   https://anonhg.NetBSD.org/src/rev/573e342ef600
branches:  trunk
changeset: 333093:573e342ef600
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Oct 18 12:36:08 2014 +0000

description:
support for phy power gpio pins

diffstat:

 sys/arch/arm/allwinner/awin_gige.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (45 lines):

diff -r 7d41ea37b371 -r 573e342ef600 sys/arch/arm/allwinner/awin_gige.c
--- a/sys/arch/arm/allwinner/awin_gige.c        Sat Oct 18 11:39:54 2014 +0000
+++ b/sys/arch/arm/allwinner/awin_gige.c        Sat Oct 18 12:36:08 2014 +0000
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.11 2014/10/18 11:23:17 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: awin_gige.c,v 1.12 2014/10/18 12:36:08 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -57,6 +57,7 @@
 struct awin_gige_softc {
        struct dwc_gmac_softc sc_core;
        void *sc_ih;
+       struct awin_gpio_pindata sc_power_pin;
 };
 
 static const struct awin_gpio_pinset awin_gige_gpio_pinset = {
@@ -94,7 +95,7 @@
        const struct awin_locators * const loc = &aio->aio_loc;
        prop_dictionary_t cfg = device_properties(self);
        uint32_t clkreg;
-       const char *phy_type;
+       const char *phy_type, *pin_name;
 
        sc->sc_core.sc_dev = self;
 
@@ -121,6 +122,15 @@
        aprint_normal_dev(self, "interrupting on irq %d\n",
             loc->loc_intr);
 
+       if (prop_dictionary_get_cstring_nocopy(cfg, "phy-power", &pin_name)) {
+               if (awin_gpio_pin_reserve(pin_name, &sc->sc_power_pin)) {
+                       awin_gpio_pindata_write(&sc->sc_power_pin, 1);
+               } else {
+                       aprint_error_dev(self,
+                           "failed to reserve GPIO \"%s\"\n", pin_name);
+               }
+       }
+
        /*
         * Enable GMAC clock
         */



Home | Main Index | Thread Index | Old Index