bindings-gpio.txt 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. $FreeBSD$
  2. GPIO configuration.
  3. ===================
  4. 1. Properties for GPIO Controllers
  5. 1.1 #gpio-cells
  6. Property: #gpio-cells
  7. Value type: <u32>
  8. Description: The #gpio-cells property defines the number of cells required
  9. to encode a gpio specifier.
  10. 1.2 gpio-controller
  11. Property: gpio-controller
  12. Value type: <empty>
  13. Description: The presence of a gpio-controller property defines a node as a
  14. GPIO controller node.
  15. 1.3 pin-count
  16. Property: pin-count
  17. Value type: <u32>
  18. Description: The pin-count property defines the number of GPIO pins.
  19. 1.4 Example
  20. GPIO: gpio@10100 {
  21. #gpio-cells = <3>;
  22. compatible = "mrvl,gpio";
  23. reg = <0x10100 0x20>;
  24. gpio-controller;
  25. interrupts = <6 7 8 9>;
  26. interrupt-parent = <&PIC>;
  27. pin-count = <50>
  28. };
  29. 2. Properties for GPIO consumer nodes.
  30. 2.1 gpios
  31. Property: gpios
  32. Value type: <prop-encoded-array> encoded as arbitrary number of GPIO
  33. specifiers.
  34. Description: The gpios property of a device node defines the GPIO or GPIOs
  35. that are used by the device. The value of the gpios property
  36. consists of an arbitrary number of GPIO specifiers.
  37. The first cell of the GPIO specifier is phandle of the node's
  38. parent GPIO controller and remaining cells are defined by the
  39. binding describing the GPIO parent, typically include
  40. information like pin number, direction and various flags.
  41. Example:
  42. gpios = <&GPIO 0 1 /* GPIO[0]: FLAGS */
  43. &GPIO 1 2>; /* GPIO[1]: FLAGS */
  44. 3. GPIO controller specifier
  45. <phandle pin dir flags>
  46. pin: 0-MAX GPIO pin number.
  47. flags:
  48. Available flags are listed in sys/conf.h. Following combination
  49. can be supported by the controller. For details please refer
  50. to controller's GPIO reference manual.
  51. GPIO_PIN_INPUT 0x0001 Input direction
  52. GPIO_PIN_OUTPUT 0x0002 Output direction
  53. GPIO_PIN_OPENDRAIN 0x0004 Open-drain output
  54. GPIO_PIN_OPENSOURCE 0x0008 Open-source output
  55. GPIO_PIN_PUSHPULL 0x0010 Push-pull output
  56. GPIO_PIN_TRISTATE 0x0020 Output disabled
  57. GPIO_PIN_PULLUP 0x0040 Internal pull-up enabled
  58. GPIO_PIN_PULLDOWN 0x0080 Internal pull-down enabled
  59. GPIO_PIN_INVIN 0x0100 Invert input
  60. GPIO_PIN_INVOUT 0x0200 Invert output
  61. GPIO_PIN_PULSATE 0x0400 Pulsate in hardware
  62. GPIO_PIN_IRQ_POL_EDG 0x0800 IRQ active single edge
  63. GPIO_PIN_IRQ_POL_DBL 0x1000 IRQ active double edge
  64. GPIO_PIN_IRQ_POL_LVL 0x2000 IRQ active level
  65. GPIO_PIN_IRQ_DEBOUNCE 0x4000 Debounce on IRQ pin
  66. Example:
  67. gpios = <&GPIO 0 0x00000001 /* GPIO[0]: IN */
  68. &GPIO 1 0x00000002 /* GPIO[1]: OUT */
  69. &GPIO 2 0x00000801 /* GPIO[2]: IN, IRQ (edge) */
  70. &GPIO 3 0x00004001 /* GPIO[3]: IN, IRQ (level) */
  71. ...
  72. &GPIO 10 0x00000401>; /* GPIO[10]: OUT, blink */