1*84943d6fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2*84943d6fSEmmanuel Vadot%YAML 1.2 3*84943d6fSEmmanuel Vadot--- 4*84943d6fSEmmanuel Vadot$id: http://devicetree.org/schemas/i2c/i2c-demux-pinctrl.yaml# 5*84943d6fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 6*84943d6fSEmmanuel Vadot 7*84943d6fSEmmanuel Vadottitle: Pinctrl-based I2C Bus Demultiplexer 8*84943d6fSEmmanuel Vadot 9*84943d6fSEmmanuel Vadotmaintainers: 10*84943d6fSEmmanuel Vadot - Wolfram Sang <wsa+renesas@sang-engineering.com> 11*84943d6fSEmmanuel Vadot 12*84943d6fSEmmanuel Vadotdescription: | 13*84943d6fSEmmanuel Vadot This binding describes an I2C bus demultiplexer that uses pin multiplexing to 14*84943d6fSEmmanuel Vadot route the I2C signals, and represents the pin multiplexing configuration 15*84943d6fSEmmanuel Vadot using the pinctrl device tree bindings. This may be used to select one I2C 16*84943d6fSEmmanuel Vadot IP core at runtime which may have a better feature set for a given task than 17*84943d6fSEmmanuel Vadot another I2C IP core on the SoC. The most simple example is to fall back to 18*84943d6fSEmmanuel Vadot GPIO bitbanging if your current runtime configuration hits an errata of the 19*84943d6fSEmmanuel Vadot internal IP core. 20*84943d6fSEmmanuel Vadot 21*84943d6fSEmmanuel Vadot +-------------------------------+ 22*84943d6fSEmmanuel Vadot | SoC | 23*84943d6fSEmmanuel Vadot | | +-----+ +-----+ 24*84943d6fSEmmanuel Vadot | +------------+ | | dev | | dev | 25*84943d6fSEmmanuel Vadot | |I2C IP Core1|--\ | +-----+ +-----+ 26*84943d6fSEmmanuel Vadot | +------------+ \-------+ | | | 27*84943d6fSEmmanuel Vadot | |Pinctrl|--|------+--------+ 28*84943d6fSEmmanuel Vadot | +------------+ +-------+ | 29*84943d6fSEmmanuel Vadot | |I2C IP Core2|--/ | 30*84943d6fSEmmanuel Vadot | +------------+ | 31*84943d6fSEmmanuel Vadot | | 32*84943d6fSEmmanuel Vadot +-------------------------------+ 33*84943d6fSEmmanuel Vadot 34*84943d6fSEmmanuel VadotallOf: 35*84943d6fSEmmanuel Vadot - $ref: i2c-mux.yaml 36*84943d6fSEmmanuel Vadot - $ref: /schemas/i2c/i2c-controller.yaml# 37*84943d6fSEmmanuel Vadot 38*84943d6fSEmmanuel Vadotproperties: 39*84943d6fSEmmanuel Vadot compatible: 40*84943d6fSEmmanuel Vadot const: i2c-demux-pinctrl 41*84943d6fSEmmanuel Vadot 42*84943d6fSEmmanuel Vadot i2c-parent: 43*84943d6fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 44*84943d6fSEmmanuel Vadot description: 45*84943d6fSEmmanuel Vadot List of phandles of I2C masters available for selection. The first one 46*84943d6fSEmmanuel Vadot will be used as default. 47*84943d6fSEmmanuel Vadot 48*84943d6fSEmmanuel Vadot i2c-bus-name: 49*84943d6fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 50*84943d6fSEmmanuel Vadot description: 51*84943d6fSEmmanuel Vadot The name of this bus. Also needed as pinctrl-name for the I2C parents. 52*84943d6fSEmmanuel Vadot 53*84943d6fSEmmanuel Vadotrequired: 54*84943d6fSEmmanuel Vadot - compatible 55*84943d6fSEmmanuel Vadot - i2c-parent 56*84943d6fSEmmanuel Vadot - i2c-bus-name 57*84943d6fSEmmanuel Vadot 58*84943d6fSEmmanuel VadotunevaluatedProperties: false 59*84943d6fSEmmanuel Vadot 60*84943d6fSEmmanuel Vadotexamples: 61*84943d6fSEmmanuel Vadot - | 62*84943d6fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 63*84943d6fSEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 64*84943d6fSEmmanuel Vadot 65*84943d6fSEmmanuel Vadot gpioi2c2: i2c-9 { 66*84943d6fSEmmanuel Vadot #address-cells = <1>; 67*84943d6fSEmmanuel Vadot #size-cells = <0>; 68*84943d6fSEmmanuel Vadot compatible = "i2c-gpio"; 69*84943d6fSEmmanuel Vadot scl-gpios = <&gpio5 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 70*84943d6fSEmmanuel Vadot sda-gpios = <&gpio5 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 71*84943d6fSEmmanuel Vadot i2c-gpio,delay-us = <5>; 72*84943d6fSEmmanuel Vadot 73*84943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 74*84943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 75*84943d6fSEmmanuel Vadot status = "disabled"; 76*84943d6fSEmmanuel Vadot }; 77*84943d6fSEmmanuel Vadot 78*84943d6fSEmmanuel Vadot iic2: i2c@e6520000 { 79*84943d6fSEmmanuel Vadot reg = <0xe6520000 0x425>; 80*84943d6fSEmmanuel Vadot pinctrl-0 = <&iic2_pins>; 81*84943d6fSEmmanuel Vadot // The pinctrl property for the parent I2C controller needs a pinctrl 82*84943d6fSEmmanuel Vadot // state with the same name as i2c-bus-name in the I2C bus demultiplexer 83*84943d6fSEmmanuel Vadot // node, not "default"! 84*84943d6fSEmmanuel Vadot pinctrl-names = "i2c-hdmi"; 85*84943d6fSEmmanuel Vadot 86*84943d6fSEmmanuel Vadot clock-frequency = <100000>; 87*84943d6fSEmmanuel Vadot 88*84943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 89*84943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 90*84943d6fSEmmanuel Vadot status = "disabled"; 91*84943d6fSEmmanuel Vadot }; 92*84943d6fSEmmanuel Vadot 93*84943d6fSEmmanuel Vadot i2c2: i2c@e6530000 { 94*84943d6fSEmmanuel Vadot reg = <0 0xe6530000 0 0x40>; 95*84943d6fSEmmanuel Vadot pinctrl-0 = <&i2c2_pins>; 96*84943d6fSEmmanuel Vadot // The pinctrl property for the parent I2C controller needs a pinctrl 97*84943d6fSEmmanuel Vadot // state with the same name as i2c-bus-name in the I2C bus demultiplexer 98*84943d6fSEmmanuel Vadot // node, not "default"! 99*84943d6fSEmmanuel Vadot pinctrl-names = "i2c-hdmi"; 100*84943d6fSEmmanuel Vadot 101*84943d6fSEmmanuel Vadot clock-frequency = <100000>; 102*84943d6fSEmmanuel Vadot 103*84943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 104*84943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 105*84943d6fSEmmanuel Vadot status = "disabled"; 106*84943d6fSEmmanuel Vadot }; 107*84943d6fSEmmanuel Vadot 108*84943d6fSEmmanuel Vadot // Example for a bus to be demuxed. It contains various I2C clients for 109*84943d6fSEmmanuel Vadot // HDMI, so the bus is named "i2c-hdmi": 110*84943d6fSEmmanuel Vadot i2chdmi: i2c-mux3 { 111*84943d6fSEmmanuel Vadot compatible = "i2c-demux-pinctrl"; 112*84943d6fSEmmanuel Vadot i2c-parent = <&iic2>, <&i2c2>, <&gpioi2c2>; 113*84943d6fSEmmanuel Vadot i2c-bus-name = "i2c-hdmi"; 114*84943d6fSEmmanuel Vadot #address-cells = <1>; 115*84943d6fSEmmanuel Vadot #size-cells = <0>; 116*84943d6fSEmmanuel Vadot 117*84943d6fSEmmanuel Vadot ak4643: codec@12 { 118*84943d6fSEmmanuel Vadot compatible = "asahi-kasei,ak4643"; 119*84943d6fSEmmanuel Vadot #sound-dai-cells = <0>; 120*84943d6fSEmmanuel Vadot reg = <0x12>; 121*84943d6fSEmmanuel Vadot }; 122*84943d6fSEmmanuel Vadot 123*84943d6fSEmmanuel Vadot composite-in@20 { 124*84943d6fSEmmanuel Vadot compatible = "adi,adv7180"; 125*84943d6fSEmmanuel Vadot reg = <0x20>; 126*84943d6fSEmmanuel Vadot 127*84943d6fSEmmanuel Vadot port { 128*84943d6fSEmmanuel Vadot adv7180: endpoint { 129*84943d6fSEmmanuel Vadot bus-width = <8>; 130*84943d6fSEmmanuel Vadot remote-endpoint = <&vin1ep0>; 131*84943d6fSEmmanuel Vadot }; 132*84943d6fSEmmanuel Vadot }; 133*84943d6fSEmmanuel Vadot }; 134*84943d6fSEmmanuel Vadot 135*84943d6fSEmmanuel Vadot hdmi@39 { 136*84943d6fSEmmanuel Vadot compatible = "adi,adv7511w"; 137*84943d6fSEmmanuel Vadot reg = <0x39>; 138*84943d6fSEmmanuel Vadot interrupt-parent = <&gpio1>; 139*84943d6fSEmmanuel Vadot interrupts = <15 IRQ_TYPE_LEVEL_LOW>; 140*84943d6fSEmmanuel Vadot clocks = <&cec_clock>; 141*84943d6fSEmmanuel Vadot clock-names = "cec"; 142*84943d6fSEmmanuel Vadot 143*84943d6fSEmmanuel Vadot avdd-supply = <&fixedregulator1v8>; 144*84943d6fSEmmanuel Vadot dvdd-supply = <&fixedregulator1v8>; 145*84943d6fSEmmanuel Vadot pvdd-supply = <&fixedregulator1v8>; 146*84943d6fSEmmanuel Vadot dvdd-3v-supply = <&fixedregulator3v3>; 147*84943d6fSEmmanuel Vadot bgvdd-supply = <&fixedregulator1v8>; 148*84943d6fSEmmanuel Vadot 149*84943d6fSEmmanuel Vadot adi,input-depth = <8>; 150*84943d6fSEmmanuel Vadot adi,input-colorspace = "rgb"; 151*84943d6fSEmmanuel Vadot adi,input-clock = "1x"; 152*84943d6fSEmmanuel Vadot 153*84943d6fSEmmanuel Vadot ports { 154*84943d6fSEmmanuel Vadot #address-cells = <1>; 155*84943d6fSEmmanuel Vadot #size-cells = <0>; 156*84943d6fSEmmanuel Vadot 157*84943d6fSEmmanuel Vadot port@0 { 158*84943d6fSEmmanuel Vadot reg = <0>; 159*84943d6fSEmmanuel Vadot adv7511_in: endpoint { 160*84943d6fSEmmanuel Vadot remote-endpoint = <&lvds0_out>; 161*84943d6fSEmmanuel Vadot }; 162*84943d6fSEmmanuel Vadot }; 163*84943d6fSEmmanuel Vadot 164*84943d6fSEmmanuel Vadot port@1 { 165*84943d6fSEmmanuel Vadot reg = <1>; 166*84943d6fSEmmanuel Vadot adv7511_out: endpoint { 167*84943d6fSEmmanuel Vadot remote-endpoint = <&hdmi_con_out>; 168*84943d6fSEmmanuel Vadot }; 169*84943d6fSEmmanuel Vadot }; 170*84943d6fSEmmanuel Vadot }; 171*84943d6fSEmmanuel Vadot }; 172*84943d6fSEmmanuel Vadot }; 173