nvidia,tegra186-gpio.txt 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. NVIDIA Tegra186 GPIO controllers
  2. Tegra186 contains two GPIO controllers; a main controller and an "AON"
  3. controller. This binding document applies to both controllers. The register
  4. layouts for the controllers share many similarities, but also some significant
  5. differences. Hence, this document describes closely related but different
  6. bindings and compatible values.
  7. The Tegra186 GPIO controller allows software to set the IO direction of, and
  8. read/write the value of, numerous GPIO signals. Routing of GPIO signals to
  9. package balls is under the control of a separate pin controller HW block. Two
  10. major sets of registers exist:
  11. a) Security registers, which allow configuration of allowed access to the GPIO
  12. register set. These registers exist in a single contiguous block of physical
  13. address space. The size of this block, and the security features available,
  14. varies between the different GPIO controllers.
  15. Access to this set of registers is not necessary in all circumstances. Code
  16. that wishes to configure access to the GPIO registers needs access to these
  17. registers to do so. Code which simply wishes to read or write GPIO data does not
  18. need access to these registers.
  19. b) GPIO registers, which allow manipulation of the GPIO signals. In some GPIO
  20. controllers, these registers are exposed via multiple "physical aliases" in
  21. address space, each of which access the same underlying state. See the hardware
  22. documentation for rationale. Any particular GPIO client is expected to access
  23. just one of these physical aliases.
  24. Tegra HW documentation describes a unified naming convention for all GPIOs
  25. implemented by the SoC. Each GPIO is assigned to a port, and a port may control
  26. a number of GPIOs. Thus, each GPIO is named according to an alphabetical port
  27. name and an integer GPIO name within the port. For example, GPIO_PA0, GPIO_PN6,
  28. or GPIO_PCC3.
  29. The number of ports implemented by each GPIO controller varies. The number of
  30. implemented GPIOs within each port varies. GPIO registers within a controller
  31. are grouped and laid out according to the port they affect.
  32. The mapping from port name to the GPIO controller that implements that port, and
  33. the mapping from port name to register offset within a controller, are both
  34. extremely non-linear. The header file <dt-bindings/gpio/tegra186-gpio.h>
  35. describes the port-level mapping. In that file, the naming convention for ports
  36. matches the HW documentation. The values chosen for the names are alphabetically
  37. sorted within a particular controller. Drivers need to map between the DT GPIO
  38. IDs and HW register offsets using a lookup table.
  39. Each GPIO controller can generate a number of interrupt signals. Each signal
  40. represents the aggregate status for all GPIOs within a set of ports. Thus, the
  41. number of interrupt signals generated by a controller varies as a rough function
  42. of the number of ports it implements. Note that the HW documentation refers to
  43. both the overall controller HW module and the sets-of-ports as "controllers".
  44. Each GPIO controller in fact generates multiple interrupts signals for each set
  45. of ports. Each GPIO may be configured to feed into a specific one of the
  46. interrupt signals generated by a set-of-ports. The intent is for each generated
  47. signal to be routed to a different CPU, thus allowing different CPUs to each
  48. handle subsets of the interrupts within a port. The status of each of these
  49. per-port-set signals is reported via a separate register. Thus, a driver needs
  50. to know which status register to observe. This binding currently defines no
  51. configuration mechanism for this. By default, drivers should use register
  52. GPIO_${port}_INTERRUPT_STATUS_G1_0. Future revisions to the binding could
  53. define a property to configure this.
  54. Required properties:
  55. - compatible
  56. Array of strings.
  57. One of:
  58. - "nvidia,tegra186-gpio".
  59. - "nvidia,tegra186-gpio-aon".
  60. - reg-names
  61. Array of strings.
  62. Contains a list of names for the register spaces described by the reg
  63. property. May contain the following entries, in any order:
  64. - "gpio": Mandatory. GPIO control registers. This may cover either:
  65. a) The single physical alias that this OS should use.
  66. b) All physical aliases that exist in the controller. This is
  67. appropriate when the OS is responsible for managing assignment of
  68. the physical aliases.
  69. - "security": Optional. Security configuration registers.
  70. Users of this binding MUST look up entries in the reg property by name,
  71. using this reg-names property to do so.
  72. - reg
  73. Array of (physical base address, length) tuples.
  74. Must contain one entry per entry in the reg-names property, in a matching
  75. order.
  76. - interrupts
  77. Array of interrupt specifiers.
  78. The interrupt outputs from the HW block, one per set of ports, in the
  79. order the HW manual describes them. The number of entries required varies
  80. depending on compatible value:
  81. - "nvidia,tegra186-gpio": 6 entries.
  82. - "nvidia,tegra186-gpio-aon": 1 entry.
  83. - gpio-controller
  84. Boolean.
  85. Marks the device node as a GPIO controller/provider.
  86. - #gpio-cells
  87. Single-cell integer.
  88. Must be <2>.
  89. Indicates how many cells are used in a consumer's GPIO specifier.
  90. In the specifier:
  91. - The first cell is the pin number.
  92. See <dt-bindings/gpio/tegra186-gpio.h>.
  93. - The second cell contains flags:
  94. - Bit 0 specifies polarity
  95. - 0: Active-high (normal).
  96. - 1: Active-low (inverted).
  97. - interrupt-controller
  98. Boolean.
  99. Marks the device node as an interrupt controller/provider.
  100. - #interrupt-cells
  101. Single-cell integer.
  102. Must be <2>.
  103. Indicates how many cells are used in a consumer's interrupt specifier.
  104. In the specifier:
  105. - The first cell is the GPIO number.
  106. See <dt-bindings/gpio/tegra186-gpio.h>.
  107. - The second cell is contains flags:
  108. - Bits [3:0] indicate trigger type and level:
  109. - 1: Low-to-high edge triggered.
  110. - 2: High-to-low edge triggered.
  111. - 4: Active high level-sensitive.
  112. - 8: Active low level-sensitive.
  113. Valid combinations are 1, 2, 3, 4, 8.
  114. Example:
  115. #include <dt-bindings/interrupt-controller/irq.h>
  116. gpio@2200000 {
  117. compatible = "nvidia,tegra186-gpio";
  118. reg-names = "security", "gpio";
  119. reg =
  120. <0x0 0x2200000 0x0 0x10000>,
  121. <0x0 0x2210000 0x0 0x10000>;
  122. interrupts =
  123. <0 47 IRQ_TYPE_LEVEL_HIGH>,
  124. <0 50 IRQ_TYPE_LEVEL_HIGH>,
  125. <0 53 IRQ_TYPE_LEVEL_HIGH>,
  126. <0 56 IRQ_TYPE_LEVEL_HIGH>,
  127. <0 59 IRQ_TYPE_LEVEL_HIGH>,
  128. <0 180 IRQ_TYPE_LEVEL_HIGH>;
  129. gpio-controller;
  130. #gpio-cells = <2>;
  131. interrupt-controller;
  132. #interrupt-cells = <2>;
  133. };
  134. gpio@c2f0000 {
  135. compatible = "nvidia,tegra186-gpio-aon";
  136. reg-names = "security", "gpio";
  137. reg =
  138. <0x0 0xc2f0000 0x0 0x1000>,
  139. <0x0 0xc2f1000 0x0 0x1000>;
  140. interrupts =
  141. <0 60 IRQ_TYPE_LEVEL_HIGH>;
  142. gpio-controller;
  143. #gpio-cells = <2>;
  144. interrupt-controller;
  145. #interrupt-cells = <2>;
  146. };