# Microchip I/O expander with serial interface (I2C/SPI)

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

> Device-tree binding reference for Microchip I/O expander with serial interface (I2C/SPI).

<!-- SPDX-License-Identifier: GPL-2.0-only -->


<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;pinctrl&#47;microchip&#44;mcp23s08&#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;Himanshu Bhavani &#60;himanshu&#46;bhavani&#64;siliconsignals&#46;io&#62;&#34;</code></span>

<div id="dt-6d1c5ef59f0239d38c02">
<p style="white-space: pre-wrap">Microchip MCP23008, MCP23017, MCP23S08, MCP23S17, MCP23S18 GPIO expander chips.These chips provide 8 or 16 GPIO pins with either I2C or SPI interface.</p>
</div>

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

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

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

### Rule 1

> **Shared schema rule (<code>&#36;ref</code>):** <span id="dt-95c8874f25311f4b1ab1">[<code>&#47;schemas&#47;spi&#47;spi&#45;peripheral&#45;props&#46;yaml&#35;</code>](</kernel/hardware/devicetree-bindings/dt-spi/spi-peripheral-props.md#dt-root>)</span>

<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;microchip&#44;mcp23s08&#34;</code></span>, <span id="dt-0d17ba1dd2e75413f7d4"><code>&#34;microchip&#44;mcp23s17&#34;</code></span>, <span id="dt-88ff8a31b3bd20d1ddec"><code>&#34;microchip&#44;mcp23s18&#34;</code></span>, <span id="dt-76b67e65b51f033b1109"><code>&#34;microchip&#44;mcp23008&#34;</code></span>, <span id="dt-498d24c42855e222b0fd"><code>&#34;microchip&#44;mcp23017&#34;</code></span>, <span id="dt-216696827b315708886c"><code>&#34;microchip&#44;mcp23018&#34;</code></span>

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

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

**Maximum number of items (<code>maxItems</code>):** <span id="dt-71421d35675d9a533ad2"><code>1</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-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-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

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

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

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

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

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

### <code>reset&#45;gpios</code> — not listed as required here

<div id="dt-451564af2b6998692dea">
<p style="white-space: pre-wrap">GPIO specifier for active-low reset pin.</p>
</div>

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

<a id="dt-2a8309e88ed0a88f407d"></a>

### <code>microchip&#44;spi&#45;present&#45;mask</code> — not listed as required here

<div id="dt-c71d3f9afb78fe1d682d">
<p style="white-space: pre-wrap">Multiple SPI chips can share the same SPI chipselect. Set a bit in bit0-7 in this mask to 1 if there is a chip connected with the corresponding spi address set. For example if you have a chip with address 3 connected, you have to set bit3 to 1, which is 0x08. mcp23s08 chip variant only supports bits 0-3. It is not possible to mix mcp23s08 and mcp23s17 on the same chipselect. Set at least one bit to 1 for SPI chips.</p>
</div>

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

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

### <code>microchip&#44;irq&#45;mirror</code> — not listed as required here

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

<div id="dt-10d112700e62eb8c5c4e">
<p style="white-space: pre-wrap">Sets the mirror flag in the IOCON register. Devices with two interrupt outputs (these are the devices ending with 17 and those that have 16 IOs) have two IO banks IO 0-7 form bank 1 and IO 8-15 are bank 2. These chips have two different interrupt outputs One for bank 1 and another for bank 2. If irq-mirror is set, both interrupts are generated regardless of the bank that an input change occurred on. If it is not set,the interrupt are only generated for the bank they belong to.</p>
</div>

<a id="dt-958cab8c1c7f7232d607"></a>

### <code>microchip&#44;irq&#45;active&#45;high</code> — not listed as required here

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

<div id="dt-a32b4b0833be58cce564">
<p style="white-space: pre-wrap">Sets the INTPOL flag in the IOCON register.This configures the IRQ output polarity as active high.</p>
</div>

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

### <code>drive&#45;open&#45;drain</code> — not listed as required here

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

<div id="dt-82b424370ad6c5b2e023">
<p style="white-space: pre-wrap">Sets the ODR flag in the IOCON register. This configures the IRQ output as open drain active low.</p>
</div>

<a id="dt-075f3f0ae5eec63808da"></a>

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

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

<a id="dt-2e5214f4376987296aee"></a>

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

<a id="dt-103068f3653a3cb68aac"></a>

**<code>pins</code> — required here**

<div id="dt-f0140a12997aa2917d18">
<p style="white-space: pre-wrap">The list of GPIO pins controlled by this node. Each pin name corresponds to a physical pin on the GPIO expander.</p>
</div>

<a id="dt-1994842c22e2a35d1863"></a>

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

> **String pattern (<code>pattern</code>):** <span id="dt-c03861a48faa2eae6534"><code>&#34;&#94;gpio&#40;&#91;0&#45;9&#93;&#124;&#91;1&#93;&#91;0&#45;5&#93;&#41;&#36;&#34;</code></span>

**Maximum number of items (<code>maxItems</code>):** <span id="dt-04c36265050d4ef6e9a4"><code>16</code></span>

<a id="dt-34b9dc81afb83349996f"></a>

**<code>bias&#45;pull&#45;up</code> — not listed as required here**

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

<div id="dt-8373c580db6df51f43d1">
<p style="white-space: pre-wrap">Configures pull-up resistors for the GPIO pins. Absence of this property will leave the configuration in its default state.</p>
</div>

**Required in this object (<code>required</code>):** <a id="dt-8afdbd1a98bc51044700"></a> <span id="dt-15996a2f172e9c3b3580"><code>&#34;pins&#34;</code></span>

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

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

<code>false</code>

Not allowed by this rule.

**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;gpio&#45;controller&#34;</code></span>, <span id="dt-329d9b3604d5b98bc19d"><code>&#34;&#35;gpio&#45;cells&#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">#include &lt;dt-bindings/interrupt-controller/irq.h&gt;
#include &lt;dt-bindings/gpio/gpio.h&gt;

i2c {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;

    gpio@21 {
        compatible = "microchip,mcp23017";
        reg = &lt;0x21&gt;;
        gpio-controller;
        #gpio-cells = &lt;2&gt;;

        interrupt-parent = &lt;&amp;gpio1&gt;;
        interrupts = &lt;17 IRQ_TYPE_LEVEL_LOW&gt;;
        interrupt-controller;
        #interrupt-cells = &lt;2&gt;;

        microchip,irq-mirror;
        pinctrl-names = "default";
        pinctrl-0 = &lt;&amp;pinctrl_i2c_gpio0&gt;, &lt;&amp;gpiopullups&gt;;
        reset-gpios = &lt;&amp;gpio6 15 GPIO_ACTIVE_LOW&gt;;

        gpiopullups: pinmux {
            pins = "gpio0", "gpio1", "gpio2", "gpio3",
                   "gpio4", "gpio5", "gpio6", "gpio7",
                   "gpio8", "gpio9", "gpio10", "gpio11",
                   "gpio12", "gpio13", "gpio14", "gpio15";
            bias-pull-up;
        };
    };
};
</code></pre>

<pre id="dt-bae0d43ea48e35208b4a"><code class="language-dts">spi {
    #address-cells = &lt;1&gt;;
    #size-cells = &lt;0&gt;;

    gpio@0 {
        compatible = "microchip,mcp23s17";
        reg = &lt;0&gt;;
        gpio-controller;
        #gpio-cells = &lt;2&gt;;
        spi-max-frequency = &lt;1000000&gt;;
        microchip,spi-present-mask = /bits/ 8 &lt;0x01&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</span></p>

</details>
