Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: sys/dev/usb/controller/dwc_otg_fdt.c
- ===================================================================
- --- sys/dev/usb/controller/dwc_otg_fdt.c (revision 279788)
- +++ sys/dev/usb/controller/dwc_otg_fdt.c (working copy)
- @@ -30,6 +30,7 @@
- #include <sys/systm.h>
- #include <sys/bus.h>
- #include <sys/condvar.h>
- +#include <sys/gpio.h>
- #include <sys/kernel.h>
- #include <sys/lock.h>
- #include <sys/malloc.h>
- @@ -37,6 +38,7 @@
- #include <sys/mutex.h>
- #include <sys/rman.h>
- +#include <dev/gpio/gpiobusvar.h>
- #include <dev/ofw/openfirm.h>
- #include <dev/ofw/ofw_bus.h>
- #include <dev/ofw/ofw_bus_subr.h>
- @@ -78,8 +80,8 @@
- {
- struct dwc_otg_fdt_softc *sc = device_get_softc(dev);
- char usb_mode[24];
- - int err;
- - int rid;
- + int err, i, npins, rid;
- + struct gpiobus_pin *pins;
- /* initialise some bus fields */
- sc->sc_otg.sc_bus.parent = dev;
- @@ -103,7 +105,21 @@
- usb_mode);
- }
- }
- -
- + /* Get GPIO power pins, if any. */
- + npins = -1;
- + if (OF_hasprop(ofw_bus_get_node(dev), "gpios"))
- + npins = ofw_gpiobus_parse_gpios(dev, "gpios", &pins);
- + if (npins > 0) {
- + for (i = 0; i < npins; i++) {
- + device_printf(dev,
- + "USB power using %s pin %d.\n",
- + device_get_nameunit(pins[i].dev), pins[i].pin);
- + GPIO_PIN_SETFLAGS(pins[i].dev, pins[i].pin,
- + GPIO_PIN_OUTPUT);
- + GPIO_PIN_SET(pins[i].dev, pins[i].pin, GPIO_PIN_HIGH);
- + }
- + free(pins, M_DEVBUF);
- + }
- /* get all DMA memory */
- if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
- USB_GET_DMA_TAG(dev), NULL)) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement