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