1*e67e8565SEmmanuel Vadot# SPDX-License-Identifier: GPL-2.0-only
2*e67e8565SEmmanuel Vadot%YAML 1.2
3*e67e8565SEmmanuel Vadot---
4*e67e8565SEmmanuel Vadot$id: http://devicetree.org/schemas/i2c/i2c-mux-pinctrl.yaml#
5*e67e8565SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
6*e67e8565SEmmanuel Vadot
7*e67e8565SEmmanuel Vadottitle: Pinctrl-based I2C Bus Mux
8*e67e8565SEmmanuel Vadot
9*e67e8565SEmmanuel Vadotmaintainers:
10*e67e8565SEmmanuel Vadot  - Wolfram Sang <wsa@kernel.org>
11*e67e8565SEmmanuel Vadot
12*e67e8565SEmmanuel Vadotdescription: |
13*e67e8565SEmmanuel Vadot  This binding describes an I2C bus multiplexer that uses pin multiplexing to route the I2C
14*e67e8565SEmmanuel Vadot  signals, and represents the pin multiplexing configuration using the pinctrl device tree
15*e67e8565SEmmanuel Vadot  bindings.
16*e67e8565SEmmanuel Vadot
17*e67e8565SEmmanuel Vadot                                 +-----+  +-----+
18*e67e8565SEmmanuel Vadot                                 | dev |  | dev |
19*e67e8565SEmmanuel Vadot    +------------------------+   +-----+  +-----+
20*e67e8565SEmmanuel Vadot    | SoC                    |      |        |
21*e67e8565SEmmanuel Vadot    |                   /----|------+--------+
22*e67e8565SEmmanuel Vadot    |   +---+   +------+     | child bus A, on first set of pins
23*e67e8565SEmmanuel Vadot    |   |I2C|---|Pinmux|     |
24*e67e8565SEmmanuel Vadot    |   +---+   +------+     | child bus B, on second set of pins
25*e67e8565SEmmanuel Vadot    |                   \----|------+--------+--------+
26*e67e8565SEmmanuel Vadot    |                        |      |        |        |
27*e67e8565SEmmanuel Vadot    +------------------------+  +-----+  +-----+  +-----+
28*e67e8565SEmmanuel Vadot                                | dev |  | dev |  | dev |
29*e67e8565SEmmanuel Vadot                                +-----+  +-----+  +-----+
30*e67e8565SEmmanuel Vadot
31*e67e8565SEmmanuel Vadot  For each named state defined in the pinctrl-names property, an I2C child bus will be created.
32*e67e8565SEmmanuel Vadot  I2C child bus numbers are assigned based on the index into the pinctrl-names property.
33*e67e8565SEmmanuel Vadot
34*e67e8565SEmmanuel Vadot  The only exception is that no bus will be created for a state named "idle". If such a state is
35*e67e8565SEmmanuel Vadot  defined, it must be the last entry in pinctrl-names. For example:
36*e67e8565SEmmanuel Vadot
37*e67e8565SEmmanuel Vadot    pinctrl-names = "ddc", "pta", "idle"  ->  ddc = bus 0, pta = bus 1
38*e67e8565SEmmanuel Vadot    pinctrl-names = "ddc", "idle", "pta"  ->  Invalid ("idle" not last)
39*e67e8565SEmmanuel Vadot    pinctrl-names = "idle", "ddc", "pta"  ->  Invalid ("idle" not last)
40*e67e8565SEmmanuel Vadot
41*e67e8565SEmmanuel Vadot  Whenever an access is made to a device on a child bus, the relevant pinctrl state will be
42*e67e8565SEmmanuel Vadot  programmed into hardware.
43*e67e8565SEmmanuel Vadot
44*e67e8565SEmmanuel Vadot  If an idle state is defined, whenever an access is not being made to a device on a child bus,
45*e67e8565SEmmanuel Vadot  the idle pinctrl state will be programmed into hardware.
46*e67e8565SEmmanuel Vadot
47*e67e8565SEmmanuel Vadot  If an idle state is not defined, the most recently used pinctrl state will be left programmed
48*e67e8565SEmmanuel Vadot  into hardware whenever no access is being made of a device on a child bus.
49*e67e8565SEmmanuel Vadot
50*e67e8565SEmmanuel Vadotproperties:
51*e67e8565SEmmanuel Vadot  compatible:
52*e67e8565SEmmanuel Vadot    const: i2c-mux-pinctrl
53*e67e8565SEmmanuel Vadot
54*e67e8565SEmmanuel Vadot  i2c-parent:
55*e67e8565SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
56*e67e8565SEmmanuel Vadot    description: The phandle of the I2C bus that this multiplexer's master-side port is connected
57*e67e8565SEmmanuel Vadot      to.
58*e67e8565SEmmanuel Vadot
59*e67e8565SEmmanuel VadotallOf:
60*e67e8565SEmmanuel Vadot  - $ref: i2c-mux.yaml
61*e67e8565SEmmanuel Vadot
62*e67e8565SEmmanuel VadotunevaluatedProperties: false
63*e67e8565SEmmanuel Vadot
64*e67e8565SEmmanuel Vadotrequired:
65*e67e8565SEmmanuel Vadot  - compatible
66*e67e8565SEmmanuel Vadot  - i2c-parent
67*e67e8565SEmmanuel Vadot
68*e67e8565SEmmanuel Vadotexamples:
69*e67e8565SEmmanuel Vadot  - |
70*e67e8565SEmmanuel Vadot    i2cmux {
71*e67e8565SEmmanuel Vadot      compatible = "i2c-mux-pinctrl";
72*e67e8565SEmmanuel Vadot      #address-cells = <1>;
73*e67e8565SEmmanuel Vadot      #size-cells = <0>;
74*e67e8565SEmmanuel Vadot
75*e67e8565SEmmanuel Vadot      i2c-parent = <&i2c1>;
76*e67e8565SEmmanuel Vadot
77*e67e8565SEmmanuel Vadot      pinctrl-names = "ddc", "pta", "idle";
78*e67e8565SEmmanuel Vadot      pinctrl-0 = <&state_i2cmux_ddc>;
79*e67e8565SEmmanuel Vadot      pinctrl-1 = <&state_i2cmux_pta>;
80*e67e8565SEmmanuel Vadot      pinctrl-2 = <&state_i2cmux_idle>;
81*e67e8565SEmmanuel Vadot
82*e67e8565SEmmanuel Vadot      i2c@0 {
83*e67e8565SEmmanuel Vadot        reg = <0>;
84*e67e8565SEmmanuel Vadot        #address-cells = <1>;
85*e67e8565SEmmanuel Vadot        #size-cells = <0>;
86*e67e8565SEmmanuel Vadot
87*e67e8565SEmmanuel Vadot        eeprom@50 {
88*e67e8565SEmmanuel Vadot          compatible = "atmel,24c02";
89*e67e8565SEmmanuel Vadot          reg = <0x50>;
90*e67e8565SEmmanuel Vadot        };
91*e67e8565SEmmanuel Vadot      };
92*e67e8565SEmmanuel Vadot
93*e67e8565SEmmanuel Vadot      i2c@1 {
94*e67e8565SEmmanuel Vadot        reg = <1>;
95*e67e8565SEmmanuel Vadot        #address-cells = <1>;
96*e67e8565SEmmanuel Vadot        #size-cells = <0>;
97*e67e8565SEmmanuel Vadot
98*e67e8565SEmmanuel Vadot        eeprom@50 {
99*e67e8565SEmmanuel Vadot          compatible = "atmel,24c02";
100*e67e8565SEmmanuel Vadot          reg = <0x50>;
101*e67e8565SEmmanuel Vadot        };
102*e67e8565SEmmanuel Vadot      };
103*e67e8565SEmmanuel Vadot    };
104