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