17501815fSThierry Reding# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 27501815fSThierry Reding%YAML 1.2 37501815fSThierry Reding--- 47501815fSThierry Reding$id: http://devicetree.org/schemas/gpio/nvidia,tegra186-gpio.yaml# 57501815fSThierry Reding$schema: http://devicetree.org/meta-schemas/core.yaml# 67501815fSThierry Reding 77501815fSThierry Redingtitle: NVIDIA Tegra GPIO Controller (Tegra186 and later) 87501815fSThierry Reding 97501815fSThierry Redingmaintainers: 107501815fSThierry Reding - Thierry Reding <thierry.reding@gmail.com> 117501815fSThierry Reding - Jon Hunter <jonathanh@nvidia.com> 127501815fSThierry Reding 137501815fSThierry Redingdescription: | 147501815fSThierry Reding Tegra186 contains two GPIO controllers; a main controller and an "AON" 157501815fSThierry Reding controller. This binding document applies to both controllers. The register 167501815fSThierry Reding layouts for the controllers share many similarities, but also some 177501815fSThierry Reding significant differences. Hence, this document describes closely related but 187501815fSThierry Reding different bindings and compatible values. 197501815fSThierry Reding 207501815fSThierry Reding The Tegra186 GPIO controller allows software to set the IO direction of, 217501815fSThierry Reding and read/write the value of, numerous GPIO signals. Routing of GPIO signals 227501815fSThierry Reding to package balls is under the control of a separate pin controller hardware 237501815fSThierry Reding block. Two major sets of registers exist: 247501815fSThierry Reding 257501815fSThierry Reding a) Security registers, which allow configuration of allowed access to the 267501815fSThierry Reding GPIO register set. These registers exist in a single contiguous block 277501815fSThierry Reding of physical address space. The size of this block, and the security 287501815fSThierry Reding features available, varies between the different GPIO controllers. 297501815fSThierry Reding 307501815fSThierry Reding Access to this set of registers is not necessary in all circumstances. 317501815fSThierry Reding Code that wishes to configure access to the GPIO registers needs access 327501815fSThierry Reding to these registers to do so. Code which simply wishes to read or write 337501815fSThierry Reding GPIO data does not need access to these registers. 347501815fSThierry Reding 357501815fSThierry Reding b) GPIO registers, which allow manipulation of the GPIO signals. In some 367501815fSThierry Reding GPIO controllers, these registers are exposed via multiple "physical 377501815fSThierry Reding aliases" in address space, each of which access the same underlying 387501815fSThierry Reding state. See the hardware documentation for rationale. Any particular 397501815fSThierry Reding GPIO client is expected to access just one of these physical aliases. 407501815fSThierry Reding 417501815fSThierry Reding Tegra HW documentation describes a unified naming convention for all GPIOs 427501815fSThierry Reding implemented by the SoC. Each GPIO is assigned to a port, and a port may 437501815fSThierry Reding control a number of GPIOs. Thus, each GPIO is named according to an 447501815fSThierry Reding alphabetical port name and an integer GPIO name within the port. For 457501815fSThierry Reding example, GPIO_PA0, GPIO_PN6, or GPIO_PCC3. 467501815fSThierry Reding 477501815fSThierry Reding The number of ports implemented by each GPIO controller varies. The number 487501815fSThierry Reding of implemented GPIOs within each port varies. GPIO registers within a 497501815fSThierry Reding controller are grouped and laid out according to the port they affect. 507501815fSThierry Reding 517501815fSThierry Reding The mapping from port name to the GPIO controller that implements that 527501815fSThierry Reding port, and the mapping from port name to register offset within a 537501815fSThierry Reding controller, are both extremely non-linear. The header file 547501815fSThierry Reding <dt-bindings/gpio/tegra186-gpio.h> describes the port-level mapping. In 557501815fSThierry Reding that file, the naming convention for ports matches the HW documentation. 567501815fSThierry Reding The values chosen for the names are alphabetically sorted within a 577501815fSThierry Reding particular controller. Drivers need to map between the DT GPIO IDs and HW 587501815fSThierry Reding register offsets using a lookup table. 597501815fSThierry Reding 607501815fSThierry Reding Each GPIO controller can generate a number of interrupt signals. Each 617501815fSThierry Reding signal represents the aggregate status for all GPIOs within a set of 627501815fSThierry Reding ports. Thus, the number of interrupt signals generated by a controller 637501815fSThierry Reding varies as a rough function of the number of ports it implements. Note 647501815fSThierry Reding that the HW documentation refers to both the overall controller HW 657501815fSThierry Reding module and the sets-of-ports as "controllers". 667501815fSThierry Reding 677501815fSThierry Reding Each GPIO controller in fact generates multiple interrupts signals for 687501815fSThierry Reding each set of ports. Each GPIO may be configured to feed into a specific 697501815fSThierry Reding one of the interrupt signals generated by a set-of-ports. The intent is 707501815fSThierry Reding for each generated signal to be routed to a different CPU, thus allowing 717501815fSThierry Reding different CPUs to each handle subsets of the interrupts within a port. 727501815fSThierry Reding The status of each of these per-port-set signals is reported via a 737501815fSThierry Reding separate register. Thus, a driver needs to know which status register to 747501815fSThierry Reding observe. This binding currently defines no configuration mechanism for 757501815fSThierry Reding this. By default, drivers should use register 767501815fSThierry Reding GPIO_${port}_INTERRUPT_STATUS_G1_0. Future revisions to the binding could 777501815fSThierry Reding define a property to configure this. 787501815fSThierry Reding 797501815fSThierry Redingproperties: 807501815fSThierry Reding compatible: 817501815fSThierry Reding enum: 827501815fSThierry Reding - nvidia,tegra186-gpio 837501815fSThierry Reding - nvidia,tegra186-gpio-aon 847501815fSThierry Reding - nvidia,tegra194-gpio 857501815fSThierry Reding - nvidia,tegra194-gpio-aon 86*a8b10f3dSPrathamesh Shete - nvidia,tegra234-gpio 87*a8b10f3dSPrathamesh Shete - nvidia,tegra234-gpio-aon 887501815fSThierry Reding 897501815fSThierry Reding reg-names: 907501815fSThierry Reding items: 917501815fSThierry Reding - const: security 927501815fSThierry Reding - const: gpio 937501815fSThierry Reding minItems: 1 947501815fSThierry Reding 957501815fSThierry Reding reg: 967501815fSThierry Reding items: 977501815fSThierry Reding - description: Security configuration registers. 987501815fSThierry Reding - description: | 997501815fSThierry Reding GPIO control registers. This may cover either: 1007501815fSThierry Reding 1017501815fSThierry Reding a) The single physical alias that this OS should use. 1027501815fSThierry Reding b) All physical aliases that exist in the controller. This is 1037501815fSThierry Reding appropriate when the OS is responsible for managing assignment 1047501815fSThierry Reding of the physical aliases. 1057501815fSThierry Reding minItems: 1 1067501815fSThierry Reding 1077501815fSThierry Reding interrupts: 1087501815fSThierry Reding description: The interrupt outputs from the HW block, one per set of 1097501815fSThierry Reding ports, in the order the HW manual describes them. The number of entries 1107501815fSThierry Reding required varies depending on compatible value. 1117501815fSThierry Reding 1127501815fSThierry Reding gpio-controller: true 1137501815fSThierry Reding 1147501815fSThierry Reding "#gpio-cells": 1157501815fSThierry Reding description: | 1167501815fSThierry Reding Indicates how many cells are used in a consumer's GPIO specifier. In the 1177501815fSThierry Reding specifier: 1187501815fSThierry Reding 1197501815fSThierry Reding - The first cell is the pin number. 1207501815fSThierry Reding See <dt-bindings/gpio/tegra186-gpio.h>. 1217501815fSThierry Reding - The second cell contains flags: 1227501815fSThierry Reding - Bit 0 specifies polarity 1237501815fSThierry Reding - 0: Active-high (normal). 1247501815fSThierry Reding - 1: Active-low (inverted). 1257501815fSThierry Reding const: 2 1267501815fSThierry Reding 1277501815fSThierry Reding interrupt-controller: true 1287501815fSThierry Reding 1297501815fSThierry Reding "#interrupt-cells": 1307501815fSThierry Reding description: | 1317501815fSThierry Reding Indicates how many cells are used in a consumer's interrupt specifier. 1327501815fSThierry Reding In the specifier: 1337501815fSThierry Reding 1347501815fSThierry Reding - The first cell is the GPIO number. 1357501815fSThierry Reding See <dt-bindings/gpio/tegra186-gpio.h>. 1367501815fSThierry Reding - The second cell is contains flags: 1377501815fSThierry Reding - Bits [3:0] indicate trigger type and level: 1387501815fSThierry Reding - 1: Low-to-high edge triggered. 1397501815fSThierry Reding - 2: High-to-low edge triggered. 1407501815fSThierry Reding - 4: Active high level-sensitive. 1417501815fSThierry Reding - 8: Active low level-sensitive. 1427501815fSThierry Reding 1437501815fSThierry Reding Valid combinations are 1, 2, 3, 4, 8. 1447501815fSThierry Reding const: 2 1457501815fSThierry Reding 1467501815fSThierry RedingallOf: 1477501815fSThierry Reding - if: 1487501815fSThierry Reding properties: 1497501815fSThierry Reding compatible: 1507501815fSThierry Reding contains: 1517501815fSThierry Reding enum: 1527501815fSThierry Reding - nvidia,tegra186-gpio 1537501815fSThierry Reding - nvidia,tegra194-gpio 154*a8b10f3dSPrathamesh Shete - nvidia,tegra234-gpio 1557501815fSThierry Reding then: 1567501815fSThierry Reding properties: 1577501815fSThierry Reding interrupts: 1587501815fSThierry Reding minItems: 6 1597501815fSThierry Reding maxItems: 48 1607501815fSThierry Reding 1617501815fSThierry Reding - if: 1627501815fSThierry Reding properties: 1637501815fSThierry Reding compatible: 1647501815fSThierry Reding contains: 1657501815fSThierry Reding enum: 1667501815fSThierry Reding - nvidia,tegra186-gpio-aon 1677501815fSThierry Reding - nvidia,tegra194-gpio-aon 168*a8b10f3dSPrathamesh Shete - nvidia,tegra234-gpio-aon 1697501815fSThierry Reding then: 1707501815fSThierry Reding properties: 1717501815fSThierry Reding interrupts: 1727501815fSThierry Reding minItems: 1 1737501815fSThierry Reding maxItems: 4 1747501815fSThierry Reding 1757501815fSThierry Redingrequired: 1767501815fSThierry Reding - compatible 1777501815fSThierry Reding - reg 1787501815fSThierry Reding - reg-names 1797501815fSThierry Reding - interrupts 1807501815fSThierry Reding 1817501815fSThierry RedingadditionalProperties: false 1827501815fSThierry Reding 1837501815fSThierry Redingexamples: 1847501815fSThierry Reding - | 1857501815fSThierry Reding #include <dt-bindings/interrupt-controller/irq.h> 1867501815fSThierry Reding 1877501815fSThierry Reding gpio@2200000 { 1887501815fSThierry Reding compatible = "nvidia,tegra186-gpio"; 1897501815fSThierry Reding reg-names = "security", "gpio"; 1907501815fSThierry Reding reg = <0x2200000 0x10000>, 1917501815fSThierry Reding <0x2210000 0x10000>; 1927501815fSThierry Reding interrupts = <0 47 IRQ_TYPE_LEVEL_HIGH>, 1937501815fSThierry Reding <0 50 IRQ_TYPE_LEVEL_HIGH>, 1947501815fSThierry Reding <0 53 IRQ_TYPE_LEVEL_HIGH>, 1957501815fSThierry Reding <0 56 IRQ_TYPE_LEVEL_HIGH>, 1967501815fSThierry Reding <0 59 IRQ_TYPE_LEVEL_HIGH>, 1977501815fSThierry Reding <0 180 IRQ_TYPE_LEVEL_HIGH>; 1987501815fSThierry Reding gpio-controller; 1997501815fSThierry Reding #gpio-cells = <2>; 2007501815fSThierry Reding interrupt-controller; 2017501815fSThierry Reding #interrupt-cells = <2>; 2027501815fSThierry Reding }; 2037501815fSThierry Reding 2047501815fSThierry Reding gpio@c2f0000 { 2057501815fSThierry Reding compatible = "nvidia,tegra186-gpio-aon"; 2067501815fSThierry Reding reg-names = "security", "gpio"; 2077501815fSThierry Reding reg = <0xc2f0000 0x1000>, 2087501815fSThierry Reding <0xc2f1000 0x1000>; 2097501815fSThierry Reding interrupts = <0 60 IRQ_TYPE_LEVEL_HIGH>; 2107501815fSThierry Reding gpio-controller; 2117501815fSThierry Reding #gpio-cells = <2>; 2127501815fSThierry Reding interrupt-controller; 2137501815fSThierry Reding #interrupt-cells = <2>; 2147501815fSThierry Reding }; 215