184943d6fSEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 284943d6fSEmmanuel Vadot%YAML 1.2 384943d6fSEmmanuel Vadot--- 484943d6fSEmmanuel Vadot$id: http://devicetree.org/schemas/i2c/i2c-demux-pinctrl.yaml# 584943d6fSEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml# 684943d6fSEmmanuel Vadot 784943d6fSEmmanuel Vadottitle: Pinctrl-based I2C Bus Demultiplexer 884943d6fSEmmanuel Vadot 984943d6fSEmmanuel Vadotmaintainers: 1084943d6fSEmmanuel Vadot - Wolfram Sang <wsa+renesas@sang-engineering.com> 1184943d6fSEmmanuel Vadot 1284943d6fSEmmanuel Vadotdescription: | 1384943d6fSEmmanuel Vadot This binding describes an I2C bus demultiplexer that uses pin multiplexing to 1484943d6fSEmmanuel Vadot route the I2C signals, and represents the pin multiplexing configuration 1584943d6fSEmmanuel Vadot using the pinctrl device tree bindings. This may be used to select one I2C 1684943d6fSEmmanuel Vadot IP core at runtime which may have a better feature set for a given task than 1784943d6fSEmmanuel Vadot another I2C IP core on the SoC. The most simple example is to fall back to 1884943d6fSEmmanuel Vadot GPIO bitbanging if your current runtime configuration hits an errata of the 1984943d6fSEmmanuel Vadot internal IP core. 2084943d6fSEmmanuel Vadot 2184943d6fSEmmanuel Vadot +-------------------------------+ 2284943d6fSEmmanuel Vadot | SoC | 2384943d6fSEmmanuel Vadot | | +-----+ +-----+ 2484943d6fSEmmanuel Vadot | +------------+ | | dev | | dev | 2584943d6fSEmmanuel Vadot | |I2C IP Core1|--\ | +-----+ +-----+ 2684943d6fSEmmanuel Vadot | +------------+ \-------+ | | | 2784943d6fSEmmanuel Vadot | |Pinctrl|--|------+--------+ 2884943d6fSEmmanuel Vadot | +------------+ +-------+ | 2984943d6fSEmmanuel Vadot | |I2C IP Core2|--/ | 3084943d6fSEmmanuel Vadot | +------------+ | 3184943d6fSEmmanuel Vadot | | 3284943d6fSEmmanuel Vadot +-------------------------------+ 3384943d6fSEmmanuel Vadot 3484943d6fSEmmanuel VadotallOf: 3584943d6fSEmmanuel Vadot - $ref: /schemas/i2c/i2c-controller.yaml# 3684943d6fSEmmanuel Vadot 3784943d6fSEmmanuel Vadotproperties: 3884943d6fSEmmanuel Vadot compatible: 3984943d6fSEmmanuel Vadot const: i2c-demux-pinctrl 4084943d6fSEmmanuel Vadot 4184943d6fSEmmanuel Vadot i2c-parent: 4284943d6fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/phandle-array 43*01950c46SEmmanuel Vadot items: 44*01950c46SEmmanuel Vadot maxItems: 1 4584943d6fSEmmanuel Vadot description: 4684943d6fSEmmanuel Vadot List of phandles of I2C masters available for selection. The first one 4784943d6fSEmmanuel Vadot will be used as default. 4884943d6fSEmmanuel Vadot 4984943d6fSEmmanuel Vadot i2c-bus-name: 5084943d6fSEmmanuel Vadot $ref: /schemas/types.yaml#/definitions/string 5184943d6fSEmmanuel Vadot description: 5284943d6fSEmmanuel Vadot The name of this bus. Also needed as pinctrl-name for the I2C parents. 5384943d6fSEmmanuel Vadot 5484943d6fSEmmanuel Vadotrequired: 5584943d6fSEmmanuel Vadot - compatible 5684943d6fSEmmanuel Vadot - i2c-parent 5784943d6fSEmmanuel Vadot - i2c-bus-name 5884943d6fSEmmanuel Vadot 5984943d6fSEmmanuel VadotunevaluatedProperties: false 6084943d6fSEmmanuel Vadot 6184943d6fSEmmanuel Vadotexamples: 6284943d6fSEmmanuel Vadot - | 6384943d6fSEmmanuel Vadot #include <dt-bindings/gpio/gpio.h> 6484943d6fSEmmanuel Vadot #include <dt-bindings/interrupt-controller/irq.h> 6584943d6fSEmmanuel Vadot 6684943d6fSEmmanuel Vadot gpioi2c2: i2c-9 { 6784943d6fSEmmanuel Vadot #address-cells = <1>; 6884943d6fSEmmanuel Vadot #size-cells = <0>; 6984943d6fSEmmanuel Vadot compatible = "i2c-gpio"; 7084943d6fSEmmanuel Vadot scl-gpios = <&gpio5 5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 7184943d6fSEmmanuel Vadot sda-gpios = <&gpio5 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; 7284943d6fSEmmanuel Vadot i2c-gpio,delay-us = <5>; 7384943d6fSEmmanuel Vadot 7484943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 7584943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 7684943d6fSEmmanuel Vadot status = "disabled"; 7784943d6fSEmmanuel Vadot }; 7884943d6fSEmmanuel Vadot 7984943d6fSEmmanuel Vadot iic2: i2c@e6520000 { 8084943d6fSEmmanuel Vadot reg = <0xe6520000 0x425>; 8184943d6fSEmmanuel Vadot pinctrl-0 = <&iic2_pins>; 8284943d6fSEmmanuel Vadot // The pinctrl property for the parent I2C controller needs a pinctrl 8384943d6fSEmmanuel Vadot // state with the same name as i2c-bus-name in the I2C bus demultiplexer 8484943d6fSEmmanuel Vadot // node, not "default"! 8584943d6fSEmmanuel Vadot pinctrl-names = "i2c-hdmi"; 8684943d6fSEmmanuel Vadot 8784943d6fSEmmanuel Vadot clock-frequency = <100000>; 8884943d6fSEmmanuel Vadot 8984943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 9084943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 9184943d6fSEmmanuel Vadot status = "disabled"; 9284943d6fSEmmanuel Vadot }; 9384943d6fSEmmanuel Vadot 9484943d6fSEmmanuel Vadot i2c2: i2c@e6530000 { 9584943d6fSEmmanuel Vadot reg = <0 0xe6530000 0 0x40>; 9684943d6fSEmmanuel Vadot pinctrl-0 = <&i2c2_pins>; 9784943d6fSEmmanuel Vadot // The pinctrl property for the parent I2C controller needs a pinctrl 9884943d6fSEmmanuel Vadot // state with the same name as i2c-bus-name in the I2C bus demultiplexer 9984943d6fSEmmanuel Vadot // node, not "default"! 10084943d6fSEmmanuel Vadot pinctrl-names = "i2c-hdmi"; 10184943d6fSEmmanuel Vadot 10284943d6fSEmmanuel Vadot clock-frequency = <100000>; 10384943d6fSEmmanuel Vadot 10484943d6fSEmmanuel Vadot // The I2C controller must have its status "disabled". The I2C bus 10584943d6fSEmmanuel Vadot // demultiplexer will enable it at runtime when needed. 10684943d6fSEmmanuel Vadot status = "disabled"; 10784943d6fSEmmanuel Vadot }; 10884943d6fSEmmanuel Vadot 10984943d6fSEmmanuel Vadot // Example for a bus to be demuxed. It contains various I2C clients for 11084943d6fSEmmanuel Vadot // HDMI, so the bus is named "i2c-hdmi": 11184943d6fSEmmanuel Vadot i2chdmi: i2c-mux3 { 11284943d6fSEmmanuel Vadot compatible = "i2c-demux-pinctrl"; 11384943d6fSEmmanuel Vadot i2c-parent = <&iic2>, <&i2c2>, <&gpioi2c2>; 11484943d6fSEmmanuel Vadot i2c-bus-name = "i2c-hdmi"; 11584943d6fSEmmanuel Vadot #address-cells = <1>; 11684943d6fSEmmanuel Vadot #size-cells = <0>; 11784943d6fSEmmanuel Vadot 11884943d6fSEmmanuel Vadot ak4643: codec@12 { 11984943d6fSEmmanuel Vadot compatible = "asahi-kasei,ak4643"; 12084943d6fSEmmanuel Vadot #sound-dai-cells = <0>; 12184943d6fSEmmanuel Vadot reg = <0x12>; 12284943d6fSEmmanuel Vadot }; 12384943d6fSEmmanuel Vadot 12484943d6fSEmmanuel Vadot composite-in@20 { 12584943d6fSEmmanuel Vadot compatible = "adi,adv7180"; 12684943d6fSEmmanuel Vadot reg = <0x20>; 12784943d6fSEmmanuel Vadot 12884943d6fSEmmanuel Vadot port { 12984943d6fSEmmanuel Vadot adv7180: endpoint { 13084943d6fSEmmanuel Vadot bus-width = <8>; 13184943d6fSEmmanuel Vadot remote-endpoint = <&vin1ep0>; 13284943d6fSEmmanuel Vadot }; 13384943d6fSEmmanuel Vadot }; 13484943d6fSEmmanuel Vadot }; 13584943d6fSEmmanuel Vadot 13684943d6fSEmmanuel Vadot hdmi@39 { 13784943d6fSEmmanuel Vadot compatible = "adi,adv7511w"; 13884943d6fSEmmanuel Vadot reg = <0x39>; 13984943d6fSEmmanuel Vadot interrupt-parent = <&gpio1>; 14084943d6fSEmmanuel Vadot interrupts = <15 IRQ_TYPE_LEVEL_LOW>; 14184943d6fSEmmanuel Vadot clocks = <&cec_clock>; 14284943d6fSEmmanuel Vadot clock-names = "cec"; 14384943d6fSEmmanuel Vadot 14484943d6fSEmmanuel Vadot avdd-supply = <&fixedregulator1v8>; 14584943d6fSEmmanuel Vadot dvdd-supply = <&fixedregulator1v8>; 14684943d6fSEmmanuel Vadot pvdd-supply = <&fixedregulator1v8>; 14784943d6fSEmmanuel Vadot dvdd-3v-supply = <&fixedregulator3v3>; 14884943d6fSEmmanuel Vadot bgvdd-supply = <&fixedregulator1v8>; 14984943d6fSEmmanuel Vadot 15084943d6fSEmmanuel Vadot adi,input-depth = <8>; 15184943d6fSEmmanuel Vadot adi,input-colorspace = "rgb"; 15284943d6fSEmmanuel Vadot adi,input-clock = "1x"; 15384943d6fSEmmanuel Vadot 15484943d6fSEmmanuel Vadot ports { 15584943d6fSEmmanuel Vadot #address-cells = <1>; 15684943d6fSEmmanuel Vadot #size-cells = <0>; 15784943d6fSEmmanuel Vadot 15884943d6fSEmmanuel Vadot port@0 { 15984943d6fSEmmanuel Vadot reg = <0>; 16084943d6fSEmmanuel Vadot adv7511_in: endpoint { 16184943d6fSEmmanuel Vadot remote-endpoint = <&lvds0_out>; 16284943d6fSEmmanuel Vadot }; 16384943d6fSEmmanuel Vadot }; 16484943d6fSEmmanuel Vadot 16584943d6fSEmmanuel Vadot port@1 { 16684943d6fSEmmanuel Vadot reg = <1>; 16784943d6fSEmmanuel Vadot adv7511_out: endpoint { 16884943d6fSEmmanuel Vadot remote-endpoint = <&hdmi_con_out>; 16984943d6fSEmmanuel Vadot }; 17084943d6fSEmmanuel Vadot }; 17184943d6fSEmmanuel Vadot }; 17284943d6fSEmmanuel Vadot }; 17384943d6fSEmmanuel Vadot }; 174