1*f91030edSThierry Reding# SPDX-License-Identifier: GPL-2.0-only 2*f91030edSThierry Reding%YAML 1.2 3*f91030edSThierry Reding--- 4*f91030edSThierry Reding$id: http://devicetree.org/schemas/i2c/i2c-mux-gpio.yaml# 5*f91030edSThierry Reding$schema: http://devicetree.org/meta-schemas/core.yaml# 6*f91030edSThierry Reding 7*f91030edSThierry Redingtitle: GPIO-based I2C Bus Mux 8*f91030edSThierry Reding 9*f91030edSThierry Redingmaintainers: 10*f91030edSThierry Reding - Wolfram Sang <wsa@kernel.org> 11*f91030edSThierry Reding 12*f91030edSThierry Redingdescription: | 13*f91030edSThierry Reding This binding describes an I2C bus multiplexer that uses GPIOs to route the I2C signals. 14*f91030edSThierry Reding 15*f91030edSThierry Reding +-----+ +-----+ 16*f91030edSThierry Reding | dev | | dev | 17*f91030edSThierry Reding +------------+ +-----+ +-----+ 18*f91030edSThierry Reding | SoC | | | 19*f91030edSThierry Reding | | /--------+--------+ 20*f91030edSThierry Reding | +------+ | +------+ child bus A, on GPIO value set to 0 21*f91030edSThierry Reding | | I2C |-|--| Mux | 22*f91030edSThierry Reding | +------+ | +--+---+ child bus B, on GPIO value set to 1 23*f91030edSThierry Reding | | | \----------+--------+--------+ 24*f91030edSThierry Reding | +------+ | | | | | 25*f91030edSThierry Reding | | GPIO |-|-----+ +-----+ +-----+ +-----+ 26*f91030edSThierry Reding | +------+ | | dev | | dev | | dev | 27*f91030edSThierry Reding +------------+ +-----+ +-----+ +-----+ 28*f91030edSThierry Reding 29*f91030edSThierry Reding For each I2C child node, an I2C child bus will be created. They will be numbered based on their 30*f91030edSThierry Reding order in the device tree. 31*f91030edSThierry Reding 32*f91030edSThierry Reding Whenever an access is made to a device on a child bus, the value set in the relevant node's reg 33*f91030edSThierry Reding property will be output using the list of GPIOs, the first in the list holding the least- 34*f91030edSThierry Reding significant value. 35*f91030edSThierry Reding 36*f91030edSThierry Reding If an idle state is defined, using the idle-state (optional) property, whenever an access is not 37*f91030edSThierry Reding being made to a device on a child bus, the GPIOs will be set according to the idle value. 38*f91030edSThierry Reding 39*f91030edSThierry Reding If an idle state is not defined, the most recently used value will be left programmed into 40*f91030edSThierry Reding hardware whenever no access is being made to a device on a child bus. 41*f91030edSThierry Reding 42*f91030edSThierry Redingproperties: 43*f91030edSThierry Reding compatible: 44*f91030edSThierry Reding const: i2c-mux-gpio 45*f91030edSThierry Reding 46*f91030edSThierry Reding i2c-parent: 47*f91030edSThierry Reding description: phandle of the I2C bus that this multiplexer's master-side port is connected to 48*f91030edSThierry Reding $ref: "/schemas/types.yaml#/definitions/phandle" 49*f91030edSThierry Reding 50*f91030edSThierry Reding mux-gpios: 51*f91030edSThierry Reding description: list of GPIOs used to control the muxer 52*f91030edSThierry Reding minItems: 1 53*f91030edSThierry Reding maxItems: 4 # Should be enough 54*f91030edSThierry Reding 55*f91030edSThierry Reding idle-state: 56*f91030edSThierry Reding description: Value to set the muxer to when idle. When no value is given, it defaults to the 57*f91030edSThierry Reding last value used. 58*f91030edSThierry Reding $ref: "/schemas/types.yaml#/definitions/uint32" 59*f91030edSThierry Reding 60*f91030edSThierry RedingallOf: 61*f91030edSThierry Reding - $ref: i2c-mux.yaml 62*f91030edSThierry Reding 63*f91030edSThierry RedingunevaluatedProperties: false 64*f91030edSThierry Reding 65*f91030edSThierry Redingrequired: 66*f91030edSThierry Reding - compatible 67*f91030edSThierry Reding - i2c-parent 68*f91030edSThierry Reding - mux-gpios 69*f91030edSThierry Reding 70*f91030edSThierry Redingexamples: 71*f91030edSThierry Reding - | 72*f91030edSThierry Reding i2cmux { 73*f91030edSThierry Reding compatible = "i2c-mux-gpio"; 74*f91030edSThierry Reding #address-cells = <1>; 75*f91030edSThierry Reding #size-cells = <0>; 76*f91030edSThierry Reding mux-gpios = <&gpio1 22 0>, <&gpio1 23 0>; 77*f91030edSThierry Reding i2c-parent = <&i2c1>; 78*f91030edSThierry Reding 79*f91030edSThierry Reding i2c@1 { 80*f91030edSThierry Reding reg = <1>; 81*f91030edSThierry Reding #address-cells = <1>; 82*f91030edSThierry Reding #size-cells = <0>; 83*f91030edSThierry Reding 84*f91030edSThierry Reding ssd1307: oled@3c { 85*f91030edSThierry Reding compatible = "solomon,ssd1307fb-i2c"; 86*f91030edSThierry Reding reg = <0x3c>; 87*f91030edSThierry Reding pwms = <&pwm 4 3000>; 88*f91030edSThierry Reding reset-gpios = <&gpio2 7 1>; 89*f91030edSThierry Reding }; 90*f91030edSThierry Reding }; 91*f91030edSThierry Reding 92*f91030edSThierry Reding i2c@3 { 93*f91030edSThierry Reding reg = <3>; 94*f91030edSThierry Reding #address-cells = <1>; 95*f91030edSThierry Reding #size-cells = <0>; 96*f91030edSThierry Reding 97*f91030edSThierry Reding pca9555: pca9555@20 { 98*f91030edSThierry Reding compatible = "nxp,pca9555"; 99*f91030edSThierry Reding gpio-controller; 100*f91030edSThierry Reding #gpio-cells = <2>; 101*f91030edSThierry Reding reg = <0x20>; 102*f91030edSThierry Reding }; 103*f91030edSThierry Reding }; 104*f91030edSThierry Reding }; 105