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