gpio-mmio.yaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/gpio/gpio-mmio.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: Generic MMIO GPIO
  7. maintainers:
  8. - Linus Walleij <linusw@kernel.org>
  9. - Bartosz Golaszewski <brgl@bgdev.pl>
  10. description:
  11. Some simple GPIO controllers may consist of a single data register or a pair
  12. of set/clear-bit registers. Such controllers are common for glue logic in
  13. FPGAs or ASICs. Commonly, these controllers are accessed over memory-mapped
  14. NAND-style parallel busses.
  15. properties:
  16. compatible:
  17. enum:
  18. - brcm,bcm6345-gpio
  19. - intel,ixp4xx-expansion-bus-mmio-gpio
  20. - ni,169445-nand-gpio
  21. - opencores,gpio
  22. - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller
  23. big-endian: true
  24. '#gpio-cells':
  25. const: 2
  26. gpio-controller: true
  27. little-endian: true
  28. reg:
  29. minItems: 1
  30. description:
  31. A list of registers in the controller. The width of each register is
  32. determined by its size. All registers must have the same width. The number
  33. of GPIOs is set by the width, with bit 0 corresponding to GPIO 0, unless
  34. the ngpios property further restricts the number of used lines.
  35. items:
  36. - description:
  37. Register to READ the value of the GPIO lines. If GPIO line is high,
  38. the bit will be set. If the GPIO line is low, the bit will be cleared.
  39. This register may also be used to drive GPIOs if the SET register is
  40. omitted.
  41. - description:
  42. Register to SET the value of the GPIO lines. Setting a bit in this
  43. register will drive the GPIO line high.
  44. - description:
  45. Register to CLEAR the value of the GPIO lines. Setting a bit in this
  46. register will drive the GPIO line low. If this register is omitted,
  47. the SET register will be used to clear the GPIO lines as well, by
  48. actively writing the line with 0.
  49. - description:
  50. Register to set the line as OUTPUT. Setting a bit in this register
  51. will turn that line into an output line. Conversely, clearing a bit
  52. will turn that line into an input.
  53. - description:
  54. Register to set this line as INPUT. Setting a bit in this register
  55. will turn that line into an input line. Conversely, clearing a bit
  56. will turn that line into an output.
  57. reg-names:
  58. minItems: 1
  59. maxItems: 5
  60. items:
  61. enum:
  62. - dat
  63. - set
  64. - clr
  65. - dirout
  66. - dirin
  67. native-endian: true
  68. ngpios:
  69. minimum: 1
  70. maximum: 63
  71. description:
  72. If this property is present the number of usable GPIO lines are restricted
  73. to the first 0 .. ngpios lines. This is useful when the GPIO MMIO register
  74. has 32 bits for GPIO but only the first 12 are actually connected to
  75. real electronics, and then we set ngpios to 12.
  76. no-output:
  77. $ref: /schemas/types.yaml#/definitions/flag
  78. description:
  79. If this property is present, the controller cannot drive the GPIO lines.
  80. if:
  81. properties:
  82. compatible:
  83. contains:
  84. const: intel,ixp4xx-expansion-bus-mmio-gpio
  85. then:
  86. $ref: /schemas/memory-controllers/intel,ixp4xx-expansion-peripheral-props.yaml#
  87. patternProperties:
  88. "^.+-hog(-[0-9]+)?$":
  89. type: object
  90. required:
  91. - gpio-hog
  92. required:
  93. - compatible
  94. - reg
  95. - reg-names
  96. - '#gpio-cells'
  97. - gpio-controller
  98. unevaluatedProperties: false
  99. examples:
  100. - |
  101. gpio@1f300010 {
  102. compatible = "ni,169445-nand-gpio";
  103. reg = <0x1f300010 0x4>;
  104. reg-names = "dat";
  105. gpio-controller;
  106. #gpio-cells = <2>;
  107. };
  108. gpio@e0100000 {
  109. compatible = "wd,mbl-gpio";
  110. reg-names = "dat";
  111. reg = <0xe0100000 0x1>;
  112. #gpio-cells = <2>;
  113. gpio-controller;
  114. no-output;
  115. };
  116. gpio@fffe0406 {
  117. compatible = "brcm,bcm6345-gpio";
  118. reg-names = "dirout", "dat";
  119. reg = <0xfffe0406 2>, <0xfffe040a 2>;
  120. ngpios = <15>;
  121. native-endian;
  122. gpio-controller;
  123. #gpio-cells = <2>;
  124. };
  125. bus@c4000000 {
  126. compatible = "intel,ixp42x-expansion-bus-controller", "syscon";
  127. reg = <0xc4000000 0x30>;
  128. native-endian;
  129. #address-cells = <2>;
  130. #size-cells = <1>;
  131. ranges = <0 0x0 0x50000000 0x01000000>;
  132. dma-ranges = <0 0x0 0x50000000 0x01000000>;
  133. gpio@1,0 {
  134. compatible = "intel,ixp4xx-expansion-bus-mmio-gpio";
  135. gpio-controller;
  136. #gpio-cells = <2>;
  137. big-endian;
  138. reg = <1 0x00000000 0x2>;
  139. reg-names = "dat";
  140. intel,ixp4xx-eb-write-enable = <1>;
  141. };
  142. };