^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) Pinctrl-based I2C Bus DeMux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) This binding describes an I2C bus demultiplexer that uses pin multiplexing to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) route the I2C signals, and represents the pin multiplexing configuration using
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) the pinctrl device tree bindings. This may be used to select one I2C IP core at
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) runtime which may have a better feature set for a given task than another I2C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) IP core on the SoC. The most simple example is to fall back to GPIO bitbanging
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) if your current runtime configuration hits an errata of the internal IP core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) +-------------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) | SoC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) | | +-----+ +-----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) | +------------+ | | dev | | dev |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) | |I2C IP Core1|--\ | +-----+ +-----+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) | +------------+ \-------+ | | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) | |Pinctrl|--|------+--------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) | +------------+ +-------+ |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) | |I2C IP Core2|--/ |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) | +------------+ |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) | |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) +-------------------------------+
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) Required properties:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) - compatible: "i2c-demux-pinctrl"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) - i2c-parent: List of phandles of I2C masters available for selection. The first
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) one will be used as default.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) - i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) parents.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) directory.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) Example:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) Here is a snipplet for a bus to be demuxed. It contains various i2c clients for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) HDMI, so the bus is named "i2c-hdmi":
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) i2chdmi: i2c@8 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) compatible = "i2c-demux-pinctrl";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) i2c-parent = <&gpioi2c>, <&iic2>, <&i2c2>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) i2c-bus-name = "i2c-hdmi";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) ak4643: sound-codec@12 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) compatible = "asahi-kasei,ak4643";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #sound-dai-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) reg = <0x12>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) composite-in@20 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) compatible = "adi,adv7180";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) reg = <0x20>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) remote = <&vin1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) adv7180: endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) bus-width = <8>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) remote-endpoint = <&vin1ep0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) hdmi@39 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) compatible = "adi,adv7511w";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) reg = <0x39>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) interrupt-parent = <&gpio1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) adi,input-depth = <8>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) adi,input-colorspace = "rgb";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) adi,input-clock = "1x";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) adi,input-style = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) adi,input-justification = "evenly";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) ports {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) port@0 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) reg = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) adv7511_in: endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) remote-endpoint = <&du_out_lvds0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) port@1 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) reg = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) adv7511_out: endpoint {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) remote-endpoint = <&hdmi_con>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) And for clarification, here are the snipplets for the i2c-parents:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) gpioi2c: i2c@9 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #address-cells = <1>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #size-cells = <0>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) compatible = "i2c-gpio";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) >;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) i2c-gpio,delay-us = <5>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) &i2c2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) pinctrl-0 = <&i2c2_pins>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) pinctrl-names = "i2c-hdmi";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) clock-frequency = <100000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) ...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) &iic2 {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) pinctrl-0 = <&iic2_pins>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) pinctrl-names = "i2c-hdmi";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) clock-frequency = <100000>;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) Please note:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) - pinctrl properties for the parent I2C controllers need a pinctrl state
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) with the same name as i2c-bus-name, not "default"!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) - the i2c masters must have their status "disabled". This driver will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) enable them at runtime when needed.