1c66ec88fSEmmanuel VadotGPIO-based I2C Bus Mux 2c66ec88fSEmmanuel Vadot 3c66ec88fSEmmanuel VadotThis binding describes an I2C bus multiplexer that uses GPIOs to 4c66ec88fSEmmanuel Vadotroute the I2C signals. 5c66ec88fSEmmanuel Vadot 6c66ec88fSEmmanuel Vadot +-----+ +-----+ 7c66ec88fSEmmanuel Vadot | dev | | dev | 8c66ec88fSEmmanuel Vadot +------------+ +-----+ +-----+ 9c66ec88fSEmmanuel Vadot | SoC | | | 10c66ec88fSEmmanuel Vadot | | /--------+--------+ 11c66ec88fSEmmanuel Vadot | +------+ | +------+ child bus A, on GPIO value set to 0 12c66ec88fSEmmanuel Vadot | | I2C |-|--| Mux | 13c66ec88fSEmmanuel Vadot | +------+ | +--+---+ child bus B, on GPIO value set to 1 14c66ec88fSEmmanuel Vadot | | | \----------+--------+--------+ 15c66ec88fSEmmanuel Vadot | +------+ | | | | | 16c66ec88fSEmmanuel Vadot | | GPIO |-|-----+ +-----+ +-----+ +-----+ 17c66ec88fSEmmanuel Vadot | +------+ | | dev | | dev | | dev | 18c66ec88fSEmmanuel Vadot +------------+ +-----+ +-----+ +-----+ 19c66ec88fSEmmanuel Vadot 20c66ec88fSEmmanuel VadotRequired properties: 21c66ec88fSEmmanuel Vadot- compatible: i2c-mux-gpio 22c66ec88fSEmmanuel Vadot- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side 23c66ec88fSEmmanuel Vadot port is connected to. 24c66ec88fSEmmanuel Vadot- mux-gpios: list of gpios used to control the muxer 25*5956d97fSEmmanuel Vadot* Standard I2C mux properties. See i2c-mux.yaml in this directory. 26*5956d97fSEmmanuel Vadot* I2C child bus nodes. See i2c-mux.yaml in this directory. 27c66ec88fSEmmanuel Vadot 28c66ec88fSEmmanuel VadotOptional properties: 29c66ec88fSEmmanuel Vadot- idle-state: value to set the muxer to when idle. When no value is 30c66ec88fSEmmanuel Vadot given, it defaults to the last value used. 31c66ec88fSEmmanuel Vadot 32c66ec88fSEmmanuel VadotFor each i2c child node, an I2C child bus will be created. They will 33c66ec88fSEmmanuel Vadotbe numbered based on their order in the device tree. 34c66ec88fSEmmanuel Vadot 35c66ec88fSEmmanuel VadotWhenever an access is made to a device on a child bus, the value set 36c66ec88fSEmmanuel Vadotin the relevant node's reg property will be output using the list of 37c66ec88fSEmmanuel VadotGPIOs, the first in the list holding the least-significant value. 38c66ec88fSEmmanuel Vadot 39c66ec88fSEmmanuel VadotIf an idle state is defined, using the idle-state (optional) property, 40c66ec88fSEmmanuel Vadotwhenever an access is not being made to a device on a child bus, the 41c66ec88fSEmmanuel VadotGPIOs will be set according to the idle value. 42c66ec88fSEmmanuel Vadot 43c66ec88fSEmmanuel VadotIf an idle state is not defined, the most recently used value will be 44c66ec88fSEmmanuel Vadotleft programmed into hardware whenever no access is being made to a 45c66ec88fSEmmanuel Vadotdevice on a child bus. 46c66ec88fSEmmanuel Vadot 47c66ec88fSEmmanuel VadotExample: 48c66ec88fSEmmanuel Vadot i2cmux { 49c66ec88fSEmmanuel Vadot compatible = "i2c-mux-gpio"; 50c66ec88fSEmmanuel Vadot #address-cells = <1>; 51c66ec88fSEmmanuel Vadot #size-cells = <0>; 52c66ec88fSEmmanuel Vadot mux-gpios = <&gpio1 22 0 &gpio1 23 0>; 53c66ec88fSEmmanuel Vadot i2c-parent = <&i2c1>; 54c66ec88fSEmmanuel Vadot 55c66ec88fSEmmanuel Vadot i2c@1 { 56c66ec88fSEmmanuel Vadot reg = <1>; 57c66ec88fSEmmanuel Vadot #address-cells = <1>; 58c66ec88fSEmmanuel Vadot #size-cells = <0>; 59c66ec88fSEmmanuel Vadot 60c66ec88fSEmmanuel Vadot ssd1307: oled@3c { 61c66ec88fSEmmanuel Vadot compatible = "solomon,ssd1307fb-i2c"; 62c66ec88fSEmmanuel Vadot reg = <0x3c>; 63c66ec88fSEmmanuel Vadot pwms = <&pwm 4 3000>; 64c66ec88fSEmmanuel Vadot reset-gpios = <&gpio2 7 1>; 65c66ec88fSEmmanuel Vadot }; 66c66ec88fSEmmanuel Vadot }; 67c66ec88fSEmmanuel Vadot 68c66ec88fSEmmanuel Vadot i2c@3 { 69c66ec88fSEmmanuel Vadot reg = <3>; 70c66ec88fSEmmanuel Vadot #address-cells = <1>; 71c66ec88fSEmmanuel Vadot #size-cells = <0>; 72c66ec88fSEmmanuel Vadot 73c66ec88fSEmmanuel Vadot pca9555: pca9555@20 { 74c66ec88fSEmmanuel Vadot compatible = "nxp,pca9555"; 75c66ec88fSEmmanuel Vadot gpio-controller; 76c66ec88fSEmmanuel Vadot #gpio-cells = <2>; 77c66ec88fSEmmanuel Vadot reg = <0x20>; 78c66ec88fSEmmanuel Vadot }; 79c66ec88fSEmmanuel Vadot }; 80c66ec88fSEmmanuel Vadot }; 81