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