1# SPDX-License-Identifier: GPL-2.0
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/i2c/i2c-mux-gpmux.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: General Purpose I2C Bus Mux
8
9maintainers:
10  - Peter Rosin <peda@axentia.se>
11
12description: |+
13  This binding describes an I2C bus multiplexer that uses a mux controller
14  from the mux subsystem to route the I2C signals.
15
16                                    .-----.  .-----.
17                                    | dev |  | dev |
18      .------------.                '-----'  '-----'
19      | SoC        |                   |        |
20      |            |          .--------+--------'
21      |   .------. |  .------+    child bus A, on MUX value set to 0
22      |   | I2C  |-|--| Mux  |
23      |   '------' |  '--+---+    child bus B, on MUX value set to 1
24      |   .------. |     |    '----------+--------+--------.
25      |   | MUX- | |     |               |        |        |
26      |   | Ctrl |-|-----+            .-----.  .-----.  .-----.
27      |   '------' |                  | dev |  | dev |  | dev |
28      '------------'                  '-----'  '-----'  '-----'
29
30
31
32allOf:
33  - $ref: /schemas/i2c/i2c-mux.yaml#
34
35properties:
36  compatible:
37    const: i2c-mux
38
39  i2c-parent:
40    $ref: /schemas/types.yaml#/definitions/phandle
41    description:
42      The phandle of the I2C bus that this multiplexer's master-side port is
43      connected to.
44
45  mux-controls:
46    maxItems: 1
47    description:
48      The mux-controller states are the I2C sub-bus numbers.
49
50  mux-locked:
51    type: boolean
52    description: |
53      Explicitly allow unrelated I2C transactions on the parent I2C adapter at
54      these times:
55       - during setup of the multiplexer
56       - between setup of the multiplexer and the child bus I2C transaction
57       - between the child bus I2C transaction and releasing of the multiplexer
58       - during releasing of the multiplexer
59
60      However, I2C transactions to devices behind all I2C multiplexers connected
61      to the same parent adapter that this multiplexer is connected to are blocked
62      for the full duration of the complete multiplexed I2C transaction (i.e.
63      including the times covered by the above list).
64      If mux-locked is not present, the multiplexer is assumed to be parent-locked.
65      This means that no unrelated I2C transactions are allowed on the parent I2C
66      adapter for the complete multiplexed I2C transaction.
67      The properties of mux-locked and parent-locked multiplexers are discussed
68      in more detail in Documentation/i2c/i2c-topology.rst.
69
70required:
71  - compatible
72  - i2c-parent
73  - mux-controls
74
75unevaluatedProperties: false
76
77examples:
78  - |
79    #include <dt-bindings/gpio/gpio.h>
80    mux: mux-controller {
81        compatible = "gpio-mux";
82        #mux-control-cells = <0>;
83
84        mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>,
85                    <&pioA 1 GPIO_ACTIVE_HIGH>;
86    };
87
88    i2c-mux {
89        compatible = "i2c-mux";
90        mux-locked;
91        i2c-parent = <&i2c1>;
92
93        mux-controls = <&mux>;
94
95        #address-cells = <1>;
96        #size-cells = <0>;
97
98        i2c@1 {
99            reg = <1>;
100            #address-cells = <1>;
101            #size-cells = <0>;
102
103            gpio@20 {
104                compatible = "nxp,pca9555";
105                gpio-controller;
106                #gpio-cells = <2>;
107                reg = <0x20>;
108            };
109        };
110
111        i2c@3 {
112            reg = <3>;
113            #address-cells = <1>;
114            #size-cells = <0>;
115
116            gpio@20 {
117                compatible = "nxp,pca9555";
118                gpio-controller;
119                #gpio-cells = <2>;
120                reg = <0x20>;
121            };
122        };
123    };
124...
125