# Generic MMIO GPIO

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

> Device-tree binding reference for Generic MMIO GPIO.

<!-- 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;gpio&#45;mmio&#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;Linus Walleij &#60;linusw&#64;kernel&#46;org&#62;&#34;</code></span>, <span id="dt-0f999bb9185dbf6b58d8"><code>&#34;Bartosz Golaszewski &#60;brgl&#64;bgdev&#46;pl&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Some simple GPIO controllers may consist of a single data register or a pair of set/clear-bit registers. Such controllers are common for glue logic in FPGAs or ASICs. Commonly, these controllers are accessed over memory-mapped NAND-style parallel busses.</p>
</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;brcm&#44;bcm6345&#45;gpio&#34;</code></span>, <span id="dt-0d17ba1dd2e75413f7d4"><code>&#34;intel&#44;ixp4xx&#45;expansion&#45;bus&#45;mmio&#45;gpio&#34;</code></span>, <span id="dt-88ff8a31b3bd20d1ddec"><code>&#34;ni&#44;169445&#45;nand&#45;gpio&#34;</code></span>, <span id="dt-76b67e65b51f033b1109"><code>&#34;opencores&#44;gpio&#34;</code></span>, <span id="dt-498d24c42855e222b0fd"><code>&#34;wd&#44;mbl&#45;gpio&#34;</code></span>

<a id="dt-319a1197721d8cd4e338"></a>

### <code>big&#45;endian</code> — not listed as required here

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

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

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

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

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

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

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

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

### <code>little&#45;endian</code> — not listed as required here

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

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

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

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

<div id="dt-571d87f60678ead6c5ff">
<p style="white-space: pre-wrap">A list of registers in the controller. The width of each register is determined by its size. All registers must have the same width. The number of GPIOs is set by the width, with bit 0 corresponding to GPIO 0, unless the ngpios property further restricts the number of used lines.</p>
</div>

<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">Register to READ the value of the GPIO lines. If GPIO line is high, the bit will be set. If the GPIO line is low, the bit will be cleared. This register may also be used to drive GPIOs if the SET register is omitted.</p>
> </div>

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

**Item 2**

> <div id="dt-b729cb065b03c20c0e01">
> <p style="white-space: pre-wrap">Register to SET the value of the GPIO lines. Setting a bit in this register will drive the GPIO line high.</p>
> </div>

<a id="dt-80d36cb915ffeff5364a"></a>

**Item 3**

> <div id="dt-5151e97c331b693ee0dd">
> <p style="white-space: pre-wrap">Register to CLEAR the value of the GPIO lines. Setting a bit in this register will drive the GPIO line low. If this register is omitted, the SET register will be used to clear the GPIO lines as well, by actively writing the line with 0.</p>
> </div>

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

**Item 4**

> <div id="dt-e7b71b4619e949c538b1">
> <p style="white-space: pre-wrap">Register to set the line as OUTPUT. Setting a bit in this register will turn that line into an output line. Conversely, clearing a bit will turn that line into an input.</p>
> </div>

<a id="dt-55b482bd3ef74ad8e49c"></a>

**Item 5**

> <div id="dt-9034b08616e8a84a1200">
> <p style="white-space: pre-wrap">Register to set this line as INPUT. Setting a bit in this register will turn that line into an input line. Conversely, clearing a bit will turn that line into an output.</p>
> </div>

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

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

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

**Maximum number of items (<code>maxItems</code>):** <span id="dt-58a7d566e1c7a6b0e414"><code>5</code></span>

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

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

> **Allowed values (<code>enum</code>):** <a id="dt-ac696420caa6496e1958"></a> <span id="dt-4e7351f724ec96f3fd6e"><code>&#34;dat&#34;</code></span>, <span id="dt-804ff64a0e610fe7b5a6"><code>&#34;set&#34;</code></span>, <span id="dt-3a931cbdb4213571ebde"><code>&#34;clr&#34;</code></span>, <span id="dt-efefb5dfabb6b4a258f0"><code>&#34;dirout&#34;</code></span>, <span id="dt-f1db535c0f128459383d"><code>&#34;dirin&#34;</code></span>

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

### <code>native&#45;endian</code> — not listed as required here

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

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

### <code>ngpios</code> — not listed as required here

**Minimum value (<code>minimum</code>):** <span id="dt-4ef4898ec8b764d69b54"><code>1</code></span>

**Maximum value (<code>maximum</code>):** <span id="dt-36d4cd2652ecdcb61809"><code>63</code></span>

<div id="dt-4e60045f2efa1256c93d">
<p style="white-space: pre-wrap">If this property is present the number of usable GPIO lines are restricted to the first 0 .. ngpios lines. This is useful when the GPIO MMIO register has 32 bits for GPIO but only the first 12 are actually connected to real electronics, and then we set ngpios to 12.</p>
</div>

<a id="dt-820ba792da11f9d95bb4"></a>

### <code>no&#45;output</code> — not listed as required here

**Shared schema rule (<code>&#36;ref</code>):** <span id="dt-ea9e0ae83971eb70ba7d">[<code>&#47;schemas&#47;types&#46;yaml&#35;&#47;definitions&#47;flag</code>](</kernel/hardware/devicetree-bindings/dt-shared/types.md#dt-4496aa5cdf2440415eba>)</span>

<div id="dt-ee8cb4c7839603050ff3">
<p style="white-space: pre-wrap">If this property is present, the controller cannot drive the GPIO lines.</p>
</div>

<a id="dt-158e3f6339df9dc0e448"></a>

## Condition (<code>if</code>)

> <a id="dt-0c7b6d12024f922c1b96"></a>
>
> ### Properties and child nodes (<code>properties</code>)
>
> <a id="dt-824fdc441f7c94ae56ca"></a>
>
> #### <code>compatible</code> — not listed as required here
>
> <a id="dt-8239149d6c8b0a5dabbe"></a>
>
> **Rule for matching array elements (<code>contains</code>)**
>
> > **Exact value (<code>const</code>):** <span id="dt-0259836b095562054cc8"><code>&#34;intel&#44;ixp4xx&#45;expansion&#45;bus&#45;mmio&#45;gpio&#34;</code></span>

<a id="dt-94d3067a06aec87aad7f"></a>

## When the condition matches (<code>then</code>)

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-fc757682b7974f847c53">[<code>&#47;schemas&#47;memory&#45;controllers&#47;intel&#44;ixp4xx&#45;expansion&#45;peripheral&#45;props&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-memory-controllers/intel-ixp4xx-expansion-peripheral-props.md#dt-root>)</span>

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

## Properties matching a name pattern (<code>patternProperties</code>)

<a id="dt-7b738beac91712b0cebe"></a>

### <code>&#94;&#46;&#43;&#45;hog&#40;&#45;&#91;0&#45;9&#93;&#43;&#41;&#63;&#36;</code> — name matches this regular expression

**Value type (<code>type</code>):** <span id="dt-d56645a30d9b849ee403"><code>&#34;object&#34;</code></span>

**Required in this object (<code>required</code>):** <a id="dt-46360908e21a7be6fd22"></a> <span id="dt-42adc5f4a97d7358bd2b"><code>&#34;gpio&#45;hog&#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;&#35;gpio&#45;cells&#34;</code></span>, <span id="dt-391b1d2b563ec12ed437"><code>&#34;gpio&#45;controller&#34;</code></span>

<a id="dt-63ab525a9812ac23c446"></a>

## Properties not evaluated by applicable rules (<code>unevaluatedProperties</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">gpio@1f300010 {
  compatible = "ni,169445-nand-gpio";
  reg = &lt;0x1f300010 0x4&gt;;
  reg-names = "dat";
  gpio-controller;
  #gpio-cells = &lt;2&gt;;
};

gpio@e0100000 {
  compatible = "wd,mbl-gpio";
  reg-names = "dat";
  reg = &lt;0xe0100000 0x1&gt;;
  #gpio-cells = &lt;2&gt;;
  gpio-controller;
  no-output;
};

gpio@fffe0406 {
  compatible = "brcm,bcm6345-gpio";
  reg-names = "dirout", "dat";
  reg = &lt;0xfffe0406 2&gt;, &lt;0xfffe040a 2&gt;;
  ngpios = &lt;15&gt;;
  native-endian;
  gpio-controller;
  #gpio-cells = &lt;2&gt;;
};

bus@c4000000 {
    compatible = "intel,ixp42x-expansion-bus-controller", "syscon";
    reg = &lt;0xc4000000 0x30&gt;;
    native-endian;
    #address-cells = &lt;2&gt;;
    #size-cells = &lt;1&gt;;
    ranges = &lt;0 0x0 0x50000000 0x01000000&gt;;
    dma-ranges = &lt;0 0x0 0x50000000 0x01000000&gt;;
    gpio@1,0 {
        compatible = "intel,ixp4xx-expansion-bus-mmio-gpio";
        gpio-controller;
        #gpio-cells = &lt;2&gt;;
        big-endian;
        reg = &lt;1 0x00000000 0x2&gt;;
        reg-names = "dat";
        intel,ixp4xx-eb-write-enable = &lt;1&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>

<p id="dt-comment-1"><strong>Line 26:</strong> <span> Western Digital MyBook Live memory-mapped GPIO controller</span></p>

</details>
