Advertisement
Guest User

Untitled

a guest
Mar 9th, 2015
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. Index: sys/dev/usb/controller/dwc_otg_fdt.c
  2. ===================================================================
  3. --- sys/dev/usb/controller/dwc_otg_fdt.c (revision 279788)
  4. +++ sys/dev/usb/controller/dwc_otg_fdt.c (working copy)
  5. @@ -30,6 +30,7 @@
  6. #include <sys/systm.h>
  7. #include <sys/bus.h>
  8. #include <sys/condvar.h>
  9. +#include <sys/gpio.h>
  10. #include <sys/kernel.h>
  11. #include <sys/lock.h>
  12. #include <sys/malloc.h>
  13. @@ -37,6 +38,7 @@
  14. #include <sys/mutex.h>
  15. #include <sys/rman.h>
  16.  
  17. +#include <dev/gpio/gpiobusvar.h>
  18. #include <dev/ofw/openfirm.h>
  19. #include <dev/ofw/ofw_bus.h>
  20. #include <dev/ofw/ofw_bus_subr.h>
  21. @@ -78,8 +80,8 @@
  22. {
  23. struct dwc_otg_fdt_softc *sc = device_get_softc(dev);
  24. char usb_mode[24];
  25. - int err;
  26. - int rid;
  27. + int err, i, npins, rid;
  28. + struct gpiobus_pin *pins;
  29.  
  30. /* initialise some bus fields */
  31. sc->sc_otg.sc_bus.parent = dev;
  32. @@ -103,7 +105,21 @@
  33. usb_mode);
  34. }
  35. }
  36. -
  37. + /* Get GPIO power pins, if any. */
  38. + npins = -1;
  39. + if (OF_hasprop(ofw_bus_get_node(dev), "gpios"))
  40. + npins = ofw_gpiobus_parse_gpios(dev, "gpios", &pins);
  41. + if (npins > 0) {
  42. + for (i = 0; i < npins; i++) {
  43. + device_printf(dev,
  44. + "USB power using %s pin %d.\n",
  45. + device_get_nameunit(pins[i].dev), pins[i].pin);
  46. + GPIO_PIN_SETFLAGS(pins[i].dev, pins[i].pin,
  47. + GPIO_PIN_OUTPUT);
  48. + GPIO_PIN_SET(pins[i].dev, pins[i].pin, GPIO_PIN_HIGH);
  49. + }
  50. + free(pins, M_DEVBUF);
  51. + }
  52. /* get all DMA memory */
  53. if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus,
  54. USB_GET_DMA_TAG(dev), NULL)) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement