| 1 |
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) |
| 2 |
%YAML 1.2 |
| 3 |
--- |
| 4 |
$id: http://devicetree.org/schemas/gpio/nvidia,tegra186-gpio.yaml# |
| 5 |
$schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 |
|
| 7 |
title: NVIDIA Tegra GPIO Controller (Tegra186 and later) |
| 8 |
|
| 9 |
maintainers: |
| 10 |
- Thierry Reding <[email protected]> |
| 11 |
- Jon Hunter <[email protected]> |
| 12 |
|
| 13 |
description: | |
| 14 |
Tegra186 contains two GPIO controllers; a main controller and an "AON" |
| 15 |
controller. This binding document applies to both controllers. The register |
| 16 |
layouts for the controllers share many similarities, but also some |
| 17 |
significant differences. Hence, this document describes closely related but |
| 18 |
different bindings and compatible values. |
| 19 |
|
| 20 |
The Tegra186 GPIO controller allows software to set the IO direction of, |
| 21 |
and read/write the value of, numerous GPIO signals. Routing of GPIO signals |
| 22 |
to package balls is under the control of a separate pin controller hardware |
| 23 |
block. Two major sets of registers exist: |
| 24 |
|
| 25 |
a) Security registers, which allow configuration of allowed access to the |
| 26 |
GPIO register set. These registers exist in a single contiguous block |
| 27 |
of physical address space. The size of this block, and the security |
| 28 |
features available, varies between the different GPIO controllers. |
| 29 |
|
| 30 |
Access to this set of registers is not necessary in all circumstances. |
| 31 |
Code that wishes to configure access to the GPIO registers needs access |
| 32 |
to these registers to do so. Code which simply wishes to read or write |
| 33 |
GPIO data does not need access to these registers. |
| 34 |
|
| 35 |
b) GPIO registers, which allow manipulation of the GPIO signals. In some |
| 36 |
GPIO controllers, these registers are exposed via multiple "physical |
| 37 |
aliases" in address space, each of which access the same underlying |
| 38 |
state. See the hardware documentation for rationale. Any particular |
| 39 |
GPIO client is expected to access just one of these physical aliases. |
| 40 |
|
| 41 |
Tegra HW documentation describes a unified naming convention for all GPIOs |
| 42 |
implemented by the SoC. Each GPIO is assigned to a port, and a port may |
| 43 |
control a number of GPIOs. Thus, each GPIO is named according to an |
| 44 |
alphabetical port name and an integer GPIO name within the port. For |
| 45 |
example, GPIO_PA0, GPIO_PN6, or GPIO_PCC3. |
| 46 |
|
| 47 |
The number of ports implemented by each GPIO controller varies. The number |
| 48 |
of implemented GPIOs within each port varies. GPIO registers within a |
| 49 |
controller are grouped and laid out according to the port they affect. |
| 50 |
|
| 51 |
The mapping from port name to the GPIO controller that implements that |
| 52 |
port, and the mapping from port name to register offset within a |
| 53 |
controller, are both extremely non-linear. The header file |
| 54 |
<dt-bindings/gpio/tegra186-gpio.h> describes the port-level mapping. In |
| 55 |
that file, the naming convention for ports matches the HW documentation. |
| 56 |
The values chosen for the names are alphabetically sorted within a |
| 57 |
particular controller. Drivers need to map between the DT GPIO IDs and HW |
| 58 |
register offsets using a lookup table. |
| 59 |
|
| 60 |
Each GPIO controller can generate a number of interrupt signals. Each |
| 61 |
signal represents the aggregate status for all GPIOs within a set of |
| 62 |
ports. Thus, the number of interrupt signals generated by a controller |
| 63 |
varies as a rough function of the number of ports it implements. Note |
| 64 |
that the HW documentation refers to both the overall controller HW |
| 65 |
module and the sets-of-ports as "controllers". |
| 66 |
|
| 67 |
Each GPIO controller in fact generates multiple interrupts signals for |
| 68 |
each set of ports. Each GPIO may be configured to feed into a specific |
| 69 |
one of the interrupt signals generated by a set-of-ports. The intent is |
| 70 |
for each generated signal to be routed to a different CPU, thus allowing |
| 71 |
different CPUs to each handle subsets of the interrupts within a port. |
| 72 |
The status of each of these per-port-set signals is reported via a |
| 73 |
separate register. Thus, a driver needs to know which status register to |
| 74 |
observe. This binding currently defines no configuration mechanism for |
| 75 |
this. By default, drivers should use register |
| 76 |
GPIO_${port}_INTERRUPT_STATUS_G1_0. Future revisions to the binding could |
| 77 |
define a property to configure this. |
| 78 |
|
| 79 |
properties: |
| 80 |
compatible: |
| 81 |
enum: |
| 82 |
- nvidia,tegra186-gpio |
| 83 |
- nvidia,tegra186-gpio-aon |
| 84 |
- nvidia,tegra194-gpio |
| 85 |
- nvidia,tegra194-gpio-aon |
| 86 |
- nvidia,tegra234-gpio |
| 87 |
- nvidia,tegra234-gpio-aon |
| 88 |
- nvidia,tegra256-gpio |
| 89 |
- nvidia,tegra264-gpio |
| 90 |
- nvidia,tegra264-gpio-uphy |
| 91 |
- nvidia,tegra264-gpio-aon |
| 92 |
|
| 93 |
reg-names: |
| 94 |
items: |
| 95 |
- const: security |
| 96 |
- const: gpio |
| 97 |
minItems: 1 |
| 98 |
|
| 99 |
reg: |
| 100 |
items: |
| 101 |
- description: Security configuration registers. |
| 102 |
- description: | |
| 103 |
GPIO control registers. This may cover either: |
| 104 |
|
| 105 |
a) The single physical alias that this OS should use. |
| 106 |
b) All physical aliases that exist in the controller. This is |
| 107 |
appropriate when the OS is responsible for managing assignment |
| 108 |
of the physical aliases. |
| 109 |
minItems: 1 |
| 110 |
|
| 111 |
interrupts: |
| 112 |
description: The interrupt outputs from the HW block, one per set of |
| 113 |
ports, in the order the HW manual describes them. The number of entries |
| 114 |
required varies depending on compatible value. |
| 115 |
|
| 116 |
wakeup-parent: |
| 117 |
description: Phandle to the parent interrupt controller used for wake-up. On |
| 118 |
Tegra, this typically references the PMC interrupt controller. |
| 119 |
|
| 120 |
gpio-controller: true |
| 121 |
|
| 122 |
gpio-ranges: |
| 123 |
maxItems: 1 |
| 124 |
|
| 125 |
"#gpio-cells": |
| 126 |
description: | |
| 127 |
Indicates how many cells are used in a consumer's GPIO specifier. In the |
| 128 |
specifier: |
| 129 |
|
| 130 |
- The first cell is the pin number. |
| 131 |
See <dt-bindings/gpio/tegra186-gpio.h>. |
| 132 |
- The second cell contains flags: |
| 133 |
- Bit 0 specifies polarity |
| 134 |
- 0: Active-high (normal). |
| 135 |
- 1: Active-low (inverted). |
| 136 |
const: 2 |
| 137 |
|
| 138 |
interrupt-controller: true |
| 139 |
|
| 140 |
"#interrupt-cells": |
| 141 |
description: | |
| 142 |
Indicates how many cells are used in a consumer's interrupt specifier. |
| 143 |
In the specifier: |
| 144 |
|
| 145 |
- The first cell is the GPIO number. |
| 146 |
See <dt-bindings/gpio/tegra186-gpio.h>. |
| 147 |
- The second cell is contains flags: |
| 148 |
- Bits [3:0] indicate trigger type and level: |
| 149 |
- 1: Low-to-high edge triggered. |
| 150 |
- 2: High-to-low edge triggered. |
| 151 |
- 4: Active high level-sensitive. |
| 152 |
- 8: Active low level-sensitive. |
| 153 |
|
| 154 |
Valid combinations are 1, 2, 3, 4, 8. |
| 155 |
const: 2 |
| 156 |
|
| 157 |
allOf: |
| 158 |
- if: |
| 159 |
properties: |
| 160 |
compatible: |
| 161 |
contains: |
| 162 |
enum: |
| 163 |
- nvidia,tegra186-gpio |
| 164 |
- nvidia,tegra194-gpio |
| 165 |
- nvidia,tegra234-gpio |
| 166 |
- nvidia,tegra256-gpio |
| 167 |
- nvidia,tegra264-gpio |
| 168 |
- nvidia,tegra264-gpio-uphy |
| 169 |
then: |
| 170 |
properties: |
| 171 |
interrupts: |
| 172 |
minItems: 6 |
| 173 |
maxItems: 48 |
| 174 |
|
| 175 |
- if: |
| 176 |
properties: |
| 177 |
compatible: |
| 178 |
contains: |
| 179 |
enum: |
| 180 |
- nvidia,tegra186-gpio-aon |
| 181 |
- nvidia,tegra194-gpio-aon |
| 182 |
- nvidia,tegra234-gpio-aon |
| 183 |
- nvidia,tegra264-gpio-aon |
| 184 |
then: |
| 185 |
properties: |
| 186 |
interrupts: |
| 187 |
minItems: 1 |
| 188 |
maxItems: 4 |
| 189 |
|
| 190 |
- if: |
| 191 |
properties: |
| 192 |
compatible: |
| 193 |
contains: |
| 194 |
enum: |
| 195 |
- nvidia,tegra264-gpio |
| 196 |
- nvidia,tegra264-gpio-uphy |
| 197 |
- nvidia,tegra264-gpio-aon |
| 198 |
then: |
| 199 |
required: |
| 200 |
- wakeup-parent |
| 201 |
|
| 202 |
required: |
| 203 |
- compatible |
| 204 |
- reg |
| 205 |
- reg-names |
| 206 |
- interrupts |
| 207 |
|
| 208 |
additionalProperties: false |
| 209 |
|
| 210 |
examples: |
| 211 |
- | |
| 212 |
#include <dt-bindings/interrupt-controller/irq.h> |
| 213 |
|
| 214 |
gpio@2200000 { |
| 215 |
compatible = "nvidia,tegra186-gpio"; |
| 216 |
reg-names = "security", "gpio"; |
| 217 |
reg = <0x2200000 0x10000>, |
| 218 |
<0x2210000 0x10000>; |
| 219 |
interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>, |
| 220 |
<0 50 IRQ_TYPE_LEVEL_HIGH>, |
| 221 |
<0 53 IRQ_TYPE_LEVEL_HIGH>, |
| 222 |
<0 56 IRQ_TYPE_LEVEL_HIGH>, |
| 223 |
<0 59 IRQ_TYPE_LEVEL_HIGH>, |
| 224 |
<0 180 IRQ_TYPE_LEVEL_HIGH>; |
| 225 |
gpio-controller; |
| 226 |
#gpio-cells = <2>; |
| 227 |
interrupt-controller; |
| 228 |
#interrupt-cells = <2>; |
| 229 |
}; |
| 230 |
|
| 231 |
gpio@c2f0000 { |
| 232 |
compatible = "nvidia,tegra186-gpio-aon"; |
| 233 |
reg-names = "security", "gpio"; |
| 234 |
reg = <0xc2f0000 0x1000>, |
| 235 |
<0xc2f1000 0x1000>; |
| 236 |
interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>; |
| 237 |
gpio-controller; |
| 238 |
#gpio-cells = <2>; |
| 239 |
interrupt-controller; |
| 240 |
#interrupt-cells = <2>; |
| 241 |
}; |