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