# NVIDIA Tegra GPIO Controller (Tegra186 and later)

_Peios Kernel / Hardware and drivers / Device-tree binding reference / Gpio bindings_

> Device-tree binding reference for NVIDIA Tegra GPIO Controller (Tegra186 and later).

<!-- SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) -->


<a id="dt-root"></a>

**Schema identifier (<code>&#36;id</code>):** <span id="dt-09f478f44eb202ea573e"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;schemas&#47;gpio&#47;nvidia&#44;tegra186&#45;gpio&#46;yaml&#35;&#34;</code></span>

**Schema dialect (<code>&#36;schema</code>):** <span id="dt-dcb375baab6014763a68"><code>&#34;http&#58;&#47;&#47;devicetree&#46;org&#47;meta&#45;schemas&#47;core&#46;yaml&#35;&#34;</code></span>

<a id="dt-e46b5a5dd81dbd751c9f"></a>

**Maintainers (<code>maintainers</code>):** <a id="dt-fbc39820abb8bb999095"></a> <span id="dt-fb78ddfc22abfc6fe56d"><code>&#34;Thierry Reding &#60;thierry&#46;reding&#64;gmail&#46;com&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Jon Hunter &#60;jonathanh&#64;nvidia&#46;com&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Tegra186 contains two GPIO controllers; a main controller and an "AON"
controller. This binding document applies to both controllers. The register
layouts for the controllers share many similarities, but also some
significant differences. Hence, this document describes closely related but
different bindings and compatible values.</p>
<p style="white-space: pre-wrap">The Tegra186 GPIO controller allows software to set the IO direction of,
and read/write the value of, numerous GPIO signals. Routing of GPIO signals
to package balls is under the control of a separate pin controller hardware
block. Two major sets of registers exist:</p>
<pre><code>  a) Security registers, which allow configuration of allowed access to the
     GPIO register set. These registers exist in a single contiguous block
     of physical address space. The size of this block, and the security
     features available, varies between the different GPIO controllers.</code></pre>
<pre><code>     Access to this set of registers is not necessary in all circumstances.
     Code that wishes to configure access to the GPIO registers needs access
     to these registers to do so. Code which simply wishes to read or write
     GPIO data does not need access to these registers.</code></pre>
<pre><code>  b) GPIO registers, which allow manipulation of the GPIO signals. In some
     GPIO controllers, these registers are exposed via multiple "physical
     aliases" in address space, each of which access the same underlying
     state. See the hardware documentation for rationale. Any particular
     GPIO client is expected to access just one of these physical aliases.</code></pre>
<pre><code>  Tegra HW documentation describes a unified naming convention for all GPIOs
  implemented by the SoC. Each GPIO is assigned to a port, and a port may
  control a number of GPIOs. Thus, each GPIO is named according to an
  alphabetical port name and an integer GPIO name within the port. For
  example, GPIO_PA0, GPIO_PN6, or GPIO_PCC3.</code></pre>
<pre><code>  The number of ports implemented by each GPIO controller varies. The number
  of implemented GPIOs within each port varies. GPIO registers within a
  controller are grouped and laid out according to the port they affect.</code></pre>
<pre><code>  The mapping from port name to the GPIO controller that implements that
  port, and the mapping from port name to register offset within a
  controller, are both extremely non-linear. The header file
  &lt;dt-bindings/gpio/tegra186-gpio.h&gt; describes the port-level mapping. In
  that file, the naming convention for ports matches the HW documentation.
  The values chosen for the names are alphabetically sorted within a
  particular controller. Drivers need to map between the DT GPIO IDs and HW
  register offsets using a lookup table.</code></pre>
<pre><code>  Each GPIO controller can generate a number of interrupt signals. Each
  signal represents the aggregate status for all GPIOs within a set of
  ports. Thus, the number of interrupt signals generated by a controller
  varies as a rough function of the number of ports it implements. Note
  that the HW documentation refers to both the overall controller HW
  module and the sets-of-ports as "controllers".</code></pre>
<pre><code>  Each GPIO controller in fact generates multiple interrupts signals for
  each set of ports. Each GPIO may be configured to feed into a specific
  one of the interrupt signals generated by a set-of-ports. The intent is
  for each generated signal to be routed to a different CPU, thus allowing
  different CPUs to each handle subsets of the interrupts within a port.
  The status of each of these per-port-set signals is reported via a
  separate register. Thus, a driver needs to know which status register to
  observe. This binding currently defines no configuration mechanism for
  this. By default, drivers should use register
  GPIO_${port}_INTERRUPT_STATUS_G1_0. Future revisions to the binding could
  define a property to configure this.</code></pre>
</div>

<a id="dt-e1f655ed0ff4d595dadc"></a>

## Properties and child nodes (<code>properties</code>)

<a id="dt-5c1d81699dcbe840de83"></a>

### <code>compatible</code> — required here

**Allowed values (<code>enum</code>):** <a id="dt-207128c21dbd6355c894"></a> <span id="dt-bd234eb96375d77ca611"><code>&#34;nvidia&#44;tegra186&#45;gpio&#34;</code></span>, <span id="dt-0d17ba1dd2e75413f7d4"><code>&#34;nvidia&#44;tegra186&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-88ff8a31b3bd20d1ddec"><code>&#34;nvidia&#44;tegra194&#45;gpio&#34;</code></span>, <span id="dt-76b67e65b51f033b1109"><code>&#34;nvidia&#44;tegra194&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-498d24c42855e222b0fd"><code>&#34;nvidia&#44;tegra234&#45;gpio&#34;</code></span>, <span id="dt-216696827b315708886c"><code>&#34;nvidia&#44;tegra234&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-5708aa713f48e19e156f"><code>&#34;nvidia&#44;tegra256&#45;gpio&#34;</code></span>, <span id="dt-3edbd20dc5b59e47edf5"><code>&#34;nvidia&#44;tegra264&#45;gpio&#34;</code></span>, <span id="dt-07feb33463d5c114ab05"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;uphy&#34;</code></span>, <span id="dt-1e634b71c3167df349bb"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;aon&#34;</code></span>

<a id="dt-a25ee402afa562132bc5"></a>

### <code>reg&#45;names</code> — required here

<a id="dt-cb45e4d562022f44522c"></a>

#### Array item rules (<code>items</code>)

<a id="dt-ad0326e242afa18bd21a"></a>

**Item 1**

> **Exact value (<code>const</code>):** <span id="dt-69afd9f8af3b0c5757d2"><code>&#34;security&#34;</code></span>

<a id="dt-12013039402717d72b48"></a>

**Item 2**

> **Exact value (<code>const</code>):** <span id="dt-8472c6e17fb2491b6ba3"><code>&#34;gpio&#34;</code></span>

**Minimum number of items (<code>minItems</code>):** <span id="dt-3f2820449161ca72af98"><code>1</code></span>

<a id="dt-9c1635fdb65d87e33d77"></a>

### <code>reg</code> — required here

<a id="dt-b6190d107f3246c9804f"></a>

#### Array item rules (<code>items</code>)

<a id="dt-c90b61e446f8f3080e3c"></a>

**Item 1**

> <div id="dt-e773fec0b410a1422253">
> <p style="white-space: pre-wrap">Security configuration registers.</p>
> </div>

<a id="dt-302751dd79bfd514b9d7"></a>

**Item 2**

> <div id="dt-b729cb065b03c20c0e01">
> <p style="white-space: pre-wrap">GPIO control registers. This may cover either:</p>
> <pre><code>  a) The single physical alias that this OS should use.
>   b) All physical aliases that exist in the controller. This is
>      appropriate when the OS is responsible for managing assignment
>      of the physical aliases.</code></pre>
> </div>

**Minimum number of items (<code>minItems</code>):** <span id="dt-4b3e7791b11b96c3db87"><code>1</code></span>

<a id="dt-c2de09e7f7fd211b679d"></a>

### <code>interrupts</code> — required here

<div id="dt-b3ddec0f69e9f0c0dc40">
<p style="white-space: pre-wrap">The interrupt outputs from the HW block, one per set of ports, in the order the HW manual describes them. The number of entries required varies depending on compatible value.</p>
</div>

<a id="dt-9a5b7a796098ff99219e"></a>

### <code>wakeup&#45;parent</code> — not listed as required here

<div id="dt-f29d3f12fdd64be56d95">
<p style="white-space: pre-wrap">Phandle to the parent interrupt controller used for wake-up. On Tegra, this typically references the PMC interrupt controller.</p>
</div>

<a id="dt-f5d51cae76398cdb9d95"></a>

### <code>gpio&#45;controller</code> — not listed as required here

<code>true</code> — No constraints added by this property rule.

<a id="dt-e90ed33ab740dccb72d7"></a>

### <code>gpio&#45;ranges</code> — not listed as required here

**Maximum number of items (<code>maxItems</code>):** <span id="dt-74b20707a956c3d42e77"><code>1</code></span>

<a id="dt-cfb238e0b7cdb276d83f"></a>

### <code>&#35;gpio&#45;cells</code> — not listed as required here

<div id="dt-70b20397c3c73794f833">
<p style="white-space: pre-wrap">Indicates how many cells are used in a consumer's GPIO specifier. In the
specifier:</p>
<pre><code>  - The first cell is the pin number.
    See &lt;dt-bindings/gpio/tegra186-gpio.h&gt;.
  - The second cell contains flags:
    - Bit 0 specifies polarity
      - 0: Active-high (normal).
      - 1: Active-low (inverted).</code></pre>
</div>

**Exact value (<code>const</code>):** <span id="dt-8950f722147d2cd640b8"><code>2</code></span>

<a id="dt-b98252f9c39642b1db8f"></a>

### <code>interrupt&#45;controller</code> — not listed as required here

<code>true</code> — No constraints added by this property rule.

<a id="dt-8586fac2d9a71adf4795"></a>

### <code>&#35;interrupt&#45;cells</code> — not listed as required here

<div id="dt-0cc2c51365b6879fba3b">
<p style="white-space: pre-wrap">Indicates how many cells are used in a consumer's interrupt specifier.
In the specifier:</p>
<pre><code>  - The first cell is the GPIO number.
    See &lt;dt-bindings/gpio/tegra186-gpio.h&gt;.
  - The second cell is contains flags:
    - Bits [3:0] indicate trigger type and level:
      - 1: Low-to-high edge triggered.
      - 2: High-to-low edge triggered.
      - 4: Active high level-sensitive.
      - 8: Active low level-sensitive.</code></pre>
<pre><code>      Valid combinations are 1, 2, 3, 4, 8.</code></pre>
</div>

**Exact value (<code>const</code>):** <span id="dt-317bbf786489389e8233"><code>2</code></span>

<a id="dt-935ee547587f3e75de61"></a>

## All of these rules must match (<code>allOf</code>)

<a id="dt-d33de94ac1d3652cd22a"></a>

### Rule 1

> <a id="dt-3bbb54dfa1f05dfb4d25"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-97f47e9dc804c839f86d"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-bbadeeb73dfaefabae79"></a>
> >
> > **<code>compatible</code> — not listed as required here**
> >
> > <a id="dt-ebe43a424f4497a78746"></a>
> >
> > **Rule for matching array elements (<code>contains</code>)**
> >
> > > **Allowed values (<code>enum</code>):** <a id="dt-b5c9dbe70762f9ad7bb5"></a> <span id="dt-d017b1b1b5a0bb01c549"><code>&#34;nvidia&#44;tegra186&#45;gpio&#34;</code></span>, <span id="dt-b1891799a94ae03bda89"><code>&#34;nvidia&#44;tegra194&#45;gpio&#34;</code></span>, <span id="dt-f7ddd2674cdadacec733"><code>&#34;nvidia&#44;tegra234&#45;gpio&#34;</code></span>, <span id="dt-1afa9c359b113daf77e4"><code>&#34;nvidia&#44;tegra256&#45;gpio&#34;</code></span>, <span id="dt-f4184526859cd3d4f83a"><code>&#34;nvidia&#44;tegra264&#45;gpio&#34;</code></span>, <span id="dt-5781a391973aa6c79186"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;uphy&#34;</code></span>
>
> <a id="dt-1ba25143802b75b74702"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > <a id="dt-b212c2ef78c22fab2e20"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-7787b28725c144fbfc92"></a>
> >
> > **<code>interrupts</code> — not listed as required here**
> >
> > **Minimum number of items (<code>minItems</code>):** <span id="dt-434103e5dab0dc9821c6"><code>6</code></span>
> >
> > **Maximum number of items (<code>maxItems</code>):** <span id="dt-f83fd3bbdeba05802410"><code>48</code></span>

<a id="dt-22ca5ec5b89308748ecc"></a>

### Rule 2

> <a id="dt-ffbf5afb799d5f07b3e1"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-05d9c37a1275e72a170e"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-e9866824361c1aee7933"></a>
> >
> > **<code>compatible</code> — not listed as required here**
> >
> > <a id="dt-d1402748b5f4caf0b18a"></a>
> >
> > **Rule for matching array elements (<code>contains</code>)**
> >
> > > **Allowed values (<code>enum</code>):** <a id="dt-61039da0155527cc02ba"></a> <span id="dt-20f8a813aab744ff239a"><code>&#34;nvidia&#44;tegra186&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-97636aa7a2139f7622b5"><code>&#34;nvidia&#44;tegra194&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-d29379bd469379c8aac7"><code>&#34;nvidia&#44;tegra234&#45;gpio&#45;aon&#34;</code></span>, <span id="dt-4d46427daeb4d8de3150"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;aon&#34;</code></span>
>
> <a id="dt-0971d01a730acc20e97a"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > <a id="dt-26d1c84fcc55a7d91dea"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-46e318450db8639361ba"></a>
> >
> > **<code>interrupts</code> — not listed as required here**
> >
> > **Minimum number of items (<code>minItems</code>):** <span id="dt-4e9b8776c0efa8e9014c"><code>1</code></span>
> >
> > **Maximum number of items (<code>maxItems</code>):** <span id="dt-5826f726e17db7a38ebe"><code>4</code></span>

<a id="dt-317510ea5c8bf789ca60"></a>

### Rule 3

> <a id="dt-15ef78abba37234c7e3a"></a>
>
> #### Condition (<code>if</code>)
>
> > <a id="dt-81c13bb46c56768b42c8"></a>
> >
> > **Properties and child nodes (<code>properties</code>)**
> >
> > <a id="dt-676f6e45d3a322ea7096"></a>
> >
> > **<code>compatible</code> — not listed as required here**
> >
> > <a id="dt-c8f14712d9ed2dde9441"></a>
> >
> > **Rule for matching array elements (<code>contains</code>)**
> >
> > > **Allowed values (<code>enum</code>):** <a id="dt-7838023cb1ac8ba1fc13"></a> <span id="dt-2698b34438b1aced3e06"><code>&#34;nvidia&#44;tegra264&#45;gpio&#34;</code></span>, <span id="dt-dde728fd212bd16cfbc3"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;uphy&#34;</code></span>, <span id="dt-d1d620265d00d6403d17"><code>&#34;nvidia&#44;tegra264&#45;gpio&#45;aon&#34;</code></span>
>
> <a id="dt-86c371e5831ff1f84ce5"></a>
>
> #### When the condition matches (<code>then</code>)
>
> > **Required in this object (<code>required</code>):** <a id="dt-caec4da91c2837148d80"></a> <span id="dt-aa785038ee05bfb1e067"><code>&#34;wakeup&#45;parent&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-8313173ff1c9b300d560"></a> <span id="dt-048b70ee865d6847aa3d"><code>&#34;compatible&#34;</code></span>, <span id="dt-ee7433925c1528c16b99"><code>&#34;reg&#34;</code></span>, <span id="dt-f3765998c4e103e45f2f"><code>&#34;reg&#45;names&#34;</code></span>, <span id="dt-329d9b3604d5b98bc19d"><code>&#34;interrupts&#34;</code></span>

<a id="dt-738c4b4f9e483441138b"></a>

## Properties not matched by properties or patternProperties in this schema (<code>additionalProperties</code>)

<code>false</code>

Not allowed by this rule.

<a id="dt-1a130cabaa8a47b058bf"></a>

## Examples (<code>examples</code>)

<pre id="dt-0bd6510295af0c95ff2d"><code class="language-dts">#include &lt;dt-bindings/interrupt-controller/irq.h&gt;

gpio@2200000 {
    compatible = "nvidia,tegra186-gpio";
    reg-names = "security", "gpio";
    reg = &lt;0x2200000 0x10000&gt;,
          &lt;0x2210000 0x10000&gt;;
    interrupts = &lt;0  47 IRQ_TYPE_LEVEL_HIGH&gt;,
                 &lt;0  50 IRQ_TYPE_LEVEL_HIGH&gt;,
                 &lt;0  53 IRQ_TYPE_LEVEL_HIGH&gt;,
                 &lt;0  56 IRQ_TYPE_LEVEL_HIGH&gt;,
                 &lt;0  59 IRQ_TYPE_LEVEL_HIGH&gt;,
                 &lt;0 180 IRQ_TYPE_LEVEL_HIGH&gt;;
    gpio-controller;
    #gpio-cells = &lt;2&gt;;
    interrupt-controller;
    #interrupt-cells = &lt;2&gt;;
};

gpio@c2f0000 {
    compatible = "nvidia,tegra186-gpio-aon";
    reg-names = "security", "gpio";
    reg = &lt;0xc2f0000 0x1000&gt;,
          &lt;0xc2f1000 0x1000&gt;;
    interrupts = &lt;0 60 IRQ_TYPE_LEVEL_HIGH&gt;;
    gpio-controller;
    #gpio-cells = &lt;2&gt;;
    interrupt-controller;
    #interrupt-cells = &lt;2&gt;;
};
</code></pre>

## Source notes

<details>
<summary>Annotations retained from the schema source</summary>

<p id="dt-comment-0"><strong>Line 1:</strong> <span> SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)</span></p>

</details>
