1*5f62a964SEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only 2*5f62a964SEmmanuel Vadot%YAML 1.2 3*5f62a964SEmmanuel Vadot--- 4*5f62a964SEmmanuel Vadot$id: http://devicetree.org/schemas/pinctrl/microchip,mcp23s08.yaml# 5*5f62a964SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6*5f62a964SEmmanuel Vadot 7*5f62a964SEmmanuel Vadottitle: Microchip I/O expander with serial interface (I2C/SPI) 8*5f62a964SEmmanuel Vadot 9*5f62a964SEmmanuel Vadotmaintainers: 10*5f62a964SEmmanuel Vadot - Himanshu Bhavani <himanshu.bhavani@siliconsignals.io> 11*5f62a964SEmmanuel Vadot 12*5f62a964SEmmanuel Vadotdescription: 13*5f62a964SEmmanuel Vadot Microchip MCP23008, MCP23017, MCP23S08, MCP23S17, MCP23S18 GPIO expander 14*5f62a964SEmmanuel Vadot chips.These chips provide 8 or 16 GPIO pins with either I2C or SPI interface. 15*5f62a964SEmmanuel Vadot 16*5f62a964SEmmanuel VadotallOf: 17*5f62a964SEmmanuel Vadot - $ref: /schemas/spi/spi-peripheral-props.yaml# 18*5f62a964SEmmanuel Vadot 19*5f62a964SEmmanuel Vadotproperties: 20*5f62a964SEmmanuel Vadot compatible: 21*5f62a964SEmmanuel Vadot enum: 22*5f62a964SEmmanuel Vadot - microchip,mcp23s08 23*5f62a964SEmmanuel Vadot - microchip,mcp23s17 24*5f62a964SEmmanuel Vadot - microchip,mcp23s18 25*5f62a964SEmmanuel Vadot - microchip,mcp23008 26*5f62a964SEmmanuel Vadot - microchip,mcp23017 27*5f62a964SEmmanuel Vadot - microchip,mcp23018 28*5f62a964SEmmanuel Vadot 29*5f62a964SEmmanuel Vadot reg: 30*5f62a964SEmmanuel Vadot maxItems: 1 31*5f62a964SEmmanuel Vadot 32*5f62a964SEmmanuel Vadot gpio-controller: true 33*5f62a964SEmmanuel Vadot 34*5f62a964SEmmanuel Vadot '#gpio-cells': 35*5f62a964SEmmanuel Vadot const: 2 36*5f62a964SEmmanuel Vadot 37*5f62a964SEmmanuel Vadot interrupt-controller: true 38*5f62a964SEmmanuel Vadot 39*5f62a964SEmmanuel Vadot '#interrupt-cells': 40*5f62a964SEmmanuel Vadot const: 2 41*5f62a964SEmmanuel Vadot 42*5f62a964SEmmanuel Vadot interrupts: 43*5f62a964SEmmanuel Vadot maxItems: 1 44*5f62a964SEmmanuel Vadot 45*5f62a964SEmmanuel Vadot reset-gpios: 46*5f62a964SEmmanuel Vadot description: GPIO specifier for active-low reset pin. 47*5f62a964SEmmanuel Vadot maxItems: 1 48*5f62a964SEmmanuel Vadot 49*5f62a964SEmmanuel Vadot microchip,spi-present-mask: 50*5f62a964SEmmanuel Vadot description: 51*5f62a964SEmmanuel Vadot Multiple SPI chips can share the same SPI chipselect. Set a bit in 52*5f62a964SEmmanuel Vadot bit0-7 in this mask to 1 if there is a chip connected with the 53*5f62a964SEmmanuel Vadot corresponding spi address set. For example if you have a chip with 54*5f62a964SEmmanuel Vadot address 3 connected, you have to set bit3 to 1, which is 0x08. mcp23s08 55*5f62a964SEmmanuel Vadot chip variant only supports bits 0-3. It is not possible to mix mcp23s08 56*5f62a964SEmmanuel Vadot and mcp23s17 on the same chipselect. Set at least one bit to 1 for SPI 57*5f62a964SEmmanuel Vadot chips. 58*5f62a964SEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/uint8 59*5f62a964SEmmanuel Vadot 60*5f62a964SEmmanuel Vadot microchip,irq-mirror: 61*5f62a964SEmmanuel Vadot type: boolean 62*5f62a964SEmmanuel Vadot description: 63*5f62a964SEmmanuel Vadot Sets the mirror flag in the IOCON register. Devices with two interrupt 64*5f62a964SEmmanuel Vadot outputs (these are the devices ending with 17 and those that have 16 IOs) 65*5f62a964SEmmanuel Vadot have two IO banks IO 0-7 form bank 1 and IO 8-15 are bank 2. These chips 66*5f62a964SEmmanuel Vadot have two different interrupt outputs One for bank 1 and another for 67*5f62a964SEmmanuel Vadot bank 2. If irq-mirror is set, both interrupts are generated regardless of 68*5f62a964SEmmanuel Vadot the bank that an input change occurred on. If it is not set,the interrupt 69*5f62a964SEmmanuel Vadot are only generated for the bank they belong to. 70*5f62a964SEmmanuel Vadot 71*5f62a964SEmmanuel Vadot microchip,irq-active-high: 72*5f62a964SEmmanuel Vadot type: boolean 73*5f62a964SEmmanuel Vadot description: 74*5f62a964SEmmanuel Vadot Sets the INTPOL flag in the IOCON register.This configures the IRQ output 75*5f62a964SEmmanuel Vadot polarity as active high. 76*5f62a964SEmmanuel Vadot 77*5f62a964SEmmanuel Vadot drive-open-drain: 78*5f62a964SEmmanuel Vadot type: boolean 79*5f62a964SEmmanuel Vadot description: 80*5f62a964SEmmanuel Vadot Sets the ODR flag in the IOCON register. This configures the IRQ output as 81*5f62a964SEmmanuel Vadot open drain active low. 82*5f62a964SEmmanuel Vadot 83*5f62a964SEmmanuel Vadot pinmux: 84*5f62a964SEmmanuel Vadot type: object 85*5f62a964SEmmanuel Vadot properties: 86*5f62a964SEmmanuel Vadot pins: 87*5f62a964SEmmanuel Vadot description: 88*5f62a964SEmmanuel Vadot The list of GPIO pins controlled by this node. Each pin name 89*5f62a964SEmmanuel Vadot corresponds to a physical pin on the GPIO expander. 90*5f62a964SEmmanuel Vadot items: 91*5f62a964SEmmanuel Vadot pattern: '^gpio([0-9]|[1][0-5])$' 92*5f62a964SEmmanuel Vadot maxItems: 16 93*5f62a964SEmmanuel Vadot 94*5f62a964SEmmanuel Vadot bias-pull-up: 95*5f62a964SEmmanuel Vadot type: boolean 96*5f62a964SEmmanuel Vadot description: 97*5f62a964SEmmanuel Vadot Configures pull-up resistors for the GPIO pins. Absence of this 98*5f62a964SEmmanuel Vadot property will leave the configuration in its default state. 99*5f62a964SEmmanuel Vadot 100*5f62a964SEmmanuel Vadot required: 101*5f62a964SEmmanuel Vadot - pins 102*5f62a964SEmmanuel Vadot 103*5f62a964SEmmanuel Vadot additionalProperties: false 104*5f62a964SEmmanuel Vadot 105*5f62a964SEmmanuel Vadotrequired: 106*5f62a964SEmmanuel Vadot - compatible 107*5f62a964SEmmanuel Vadot - reg 108*5f62a964SEmmanuel Vadot - gpio-controller 109*5f62a964SEmmanuel Vadot - '#gpio-cells' 110*5f62a964SEmmanuel Vadot 111*5f62a964SEmmanuel VadotunevaluatedProperties: false 112*5f62a964SEmmanuel Vadot 113*5f62a964SEmmanuel Vadotexamples: 114*5f62a964SEmmanuel Vadot - | 115*5f62a964SEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 116*5f62a964SEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 117*5f62a964SEmmanuel Vadot 118*5f62a964SEmmanuel Vadot i2c { 119*5f62a964SEmmanuel Vadot #address-cells = <1>; 120*5f62a964SEmmanuel Vadot #size-cells = <0>; 121*5f62a964SEmmanuel Vadot 122*5f62a964SEmmanuel Vadot gpio@21 { 123*5f62a964SEmmanuel Vadot compatible = "microchip,mcp23017"; 124*5f62a964SEmmanuel Vadot reg = <0x21>; 125*5f62a964SEmmanuel Vadot gpio-controller; 126*5f62a964SEmmanuel Vadot #gpio-cells = <2>; 127*5f62a964SEmmanuel Vadot 128*5f62a964SEmmanuel Vadot interrupt-parent = <&gpio1>; 129*5f62a964SEmmanuel Vadot interrupts = <17 IRQ_TYPE_LEVEL_LOW>; 130*5f62a964SEmmanuel Vadot interrupt-controller; 131*5f62a964SEmmanuel Vadot #interrupt-cells = <2>; 132*5f62a964SEmmanuel Vadot 133*5f62a964SEmmanuel Vadot microchip,irq-mirror; 134*5f62a964SEmmanuel Vadot pinctrl-names = "default"; 135*5f62a964SEmmanuel Vadot pinctrl-0 = <&pinctrl_i2c_gpio0>, <&gpiopullups>; 136*5f62a964SEmmanuel Vadot reset-gpios = <&gpio6 15 GPIO_ACTIVE_LOW>; 137*5f62a964SEmmanuel Vadot 138*5f62a964SEmmanuel Vadot gpiopullups: pinmux { 139*5f62a964SEmmanuel Vadot pins = "gpio0", "gpio1", "gpio2", "gpio3", 140*5f62a964SEmmanuel Vadot "gpio4", "gpio5", "gpio6", "gpio7", 141*5f62a964SEmmanuel Vadot "gpio8", "gpio9", "gpio10", "gpio11", 142*5f62a964SEmmanuel Vadot "gpio12", "gpio13", "gpio14", "gpio15"; 143*5f62a964SEmmanuel Vadot bias-pull-up; 144*5f62a964SEmmanuel Vadot }; 145*5f62a964SEmmanuel Vadot }; 146*5f62a964SEmmanuel Vadot }; 147*5f62a964SEmmanuel Vadot 148*5f62a964SEmmanuel Vadot - | 149*5f62a964SEmmanuel Vadot spi { 150*5f62a964SEmmanuel Vadot #address-cells = <1>; 151*5f62a964SEmmanuel Vadot #size-cells = <0>; 152*5f62a964SEmmanuel Vadot 153*5f62a964SEmmanuel Vadot gpio@0 { 154*5f62a964SEmmanuel Vadot compatible = "microchip,mcp23s17"; 155*5f62a964SEmmanuel Vadot reg = <0>; 156*5f62a964SEmmanuel Vadot gpio-controller; 157*5f62a964SEmmanuel Vadot #gpio-cells = <2>; 158*5f62a964SEmmanuel Vadot spi-max-frequency = <1000000>; 159*5f62a964SEmmanuel Vadot microchip,spi-present-mask = /bits/ 8 <0x01>; 160*5f62a964SEmmanuel Vadot }; 161*5f62a964SEmmanuel Vadot }; 162