summaryrefslogtreecommitdiffstats
path: root/Documentation/devicetree/bindings/i2c/i2c-demux-pinctrl.txt
blob: 7ce23ac6130808da6a7f621f1991b13f17f185d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
Pinctrl-based I2C Bus DeMux

This binding describes an I2C bus demultiplexer that uses pin multiplexing to
route the I2C signals, and represents the pin multiplexing configuration using
the pinctrl device tree bindings. This may be used to select one I2C IP core at
runtime which may have a better feature set for a given task than another I2C
IP core on the SoC. The most simple example is to fall back to GPIO bitbanging
if your current runtime configuration hits an errata of the internal IP core.

    +-------------------------------+
    | SoC                           |
    |                               |   +-----+  +-----+
    |   +------------+              |   | dev |  | dev |
    |   |I2C IP Core1|--\           |   +-----+  +-----+
    |   +------------+   \-------+  |      |        |
    |                    |Pinctrl|--|------+--------+
    |   +------------+   +-------+  |
    |   |I2C IP Core2|--/           |
    |   +------------+              |
    |                               |
    +-------------------------------+

Required properties:
- compatible: "i2c-demux-pinctrl"
- i2c-parent: List of phandles of I2C masters available for selection. The first
	      one will be used as default.
- i2c-bus-name: The name of this bus. Also needed as pinctrl-name for the I2C
		parents.

Furthermore, I2C mux properties and child nodes. See i2c-mux.txt in this
directory.

Example:

Here is a snipplet for a bus to be demuxed. It contains various i2c clients for
HDMI, so the bus is named "i2c-hdmi":

	i2chdmi: i2c@8 {

		compatible = "i2c-demux-pinctrl";
		i2c-parent = <&gpioi2c>, <&iic2>, <&i2c2>;
		i2c-bus-name = "i2c-hdmi";
		#address-cells = <1>;
		#size-cells = <0>;

		ak4643: sound-codec@12 {
			compatible = "asahi-kasei,ak4643";

			#sound-dai-cells = <0>;
			reg = <0x12>;
		};

		composite-in@20 {
			compatible = "adi,adv7180";
			reg = <0x20>;
			remote = <&vin1>;

			port {
				adv7180: endpoint {
					bus-width = <8>;
					remote-endpoint = <&vin1ep0>;
				};
			};
		};

		hdmi@39 {
			compatible = "adi,adv7511w";
			reg = <0x39>;
			interrupt-parent = <&gpio1>;
			interrupts = <15 IRQ_TYPE_LEVEL_LOW>;

			adi,input-depth = <8>;
			adi,input-colorspace = "rgb";
			adi,input-clock = "1x";
			adi,input-style = <1>;
			adi,input-justification = "evenly";

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;
					adv7511_in: endpoint {
						remote-endpoint = <&du_out_lvds0>;
					};
				};

				port@1 {
					reg = <1>;
					adv7511_out: endpoint {
						remote-endpoint = <&hdmi_con>;
					};
				};
			};
		};
	};

And for clarification, here are the snipplets for the i2c-parents:

	gpioi2c: i2c@9 {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "i2c-gpio";
		status = "disabled";
		gpios = <&gpio5 6 GPIO_ACTIVE_HIGH /* sda */
			 &gpio5 5 GPIO_ACTIVE_HIGH /* scl */
			>;
		i2c-gpio,delay-us = <5>;
	};

...

&i2c2	{
	pinctrl-0 = <&i2c2_pins>;
	pinctrl-names = "i2c-hdmi";

	clock-frequency = <100000>;
};

...

&iic2	{
	pinctrl-0 = <&iic2_pins>;
	pinctrl-names = "i2c-hdmi";

	clock-frequency = <100000>;
};

Please note:

- pinctrl properties for the parent I2C controllers need a pinctrl state
  with the same name as i2c-bus-name, not "default"!

- the i2c masters must have their status "disabled". This driver will
  enable them at runtime when needed.
OpenPOWER on IntegriCloud