Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/nvidia if vbus gpio pin is provided, use it to ...



details:   https://anonhg.NetBSD.org/src/rev/8c2c90b806b7
branches:  trunk
changeset: 808177:8c2c90b806b7
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat May 09 12:07:52 2015 +0000

description:
if vbus gpio pin is provided, use it to enable vdd

diffstat:

 sys/arch/arm/nvidia/tegra_ehci.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (50 lines):

diff -r 898d3a2536f9 -r 8c2c90b806b7 sys/arch/arm/nvidia/tegra_ehci.c
--- a/sys/arch/arm/nvidia/tegra_ehci.c  Sat May 09 12:07:11 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_ehci.c  Sat May 09 12:07:52 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_ehci.c,v 1.2 2015/04/26 17:14:24 jmcneill Exp $ */
+/* $NetBSD: tegra_ehci.c,v 1.3 2015/05/09 12:07:52 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.2 2015/04/26 17:14:24 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_ehci.c,v 1.3 2015/05/09 12:07:52 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -55,6 +55,8 @@
 struct tegra_ehci_softc {
        struct ehci_softc       sc;
        void                    *sc_ih;
+
+       struct tegra_gpio_pin   *sc_pin_vbus;
 };
 
 CFATTACH_DECL2_NEW(tegra_ehci, sizeof(struct tegra_ehci_softc),
@@ -73,6 +75,8 @@
        struct tegra_ehci_softc * const sc = device_private(self);
        struct tegraio_attach_args * const tio = aux;
        const struct tegra_locators * const loc = &tio->tio_loc;
+       prop_dictionary_t prop = device_properties(self);
+       const char *pin;
        int error;
 
        sc->sc.sc_dev = self;
@@ -91,6 +95,13 @@
        aprint_naive("\n");
        aprint_normal(": USB%d\n", loc->loc_port + 1);
 
+       if (prop_dictionary_get_cstring_nocopy(prop, "vbus-gpio", &pin)) {
+               sc->sc_pin_vbus = tegra_gpio_acquire(pin,
+                   GPIO_PIN_OUTPUT | GPIO_PIN_OPENDRAIN);
+               if (sc->sc_pin_vbus)
+                       tegra_gpio_write(sc->sc_pin_vbus, 1);
+        }
+
        sc->sc.sc_offs = EREAD1(&sc->sc, EHCI_CAPLENGTH);
 
        sc->sc_ih = intr_establish(loc->loc_intr, IPL_USB, IST_LEVEL,



Home | Main Index | Thread Index | Old Index