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