xref: /openbmc/linux/Documentation/devicetree/bindings/i2c/i2c-mux-reg.txt (revision 762f99f4f3cb41a775b5157dd761217beba65873)
1b3fdd327SYork SunRegister-based I2C Bus Mux
2b3fdd327SYork Sun
3b3fdd327SYork SunThis binding describes an I2C bus multiplexer that uses a single register
4b3fdd327SYork Sunto route the I2C signals.
5b3fdd327SYork Sun
6b3fdd327SYork SunRequired properties:
7b3fdd327SYork Sun- compatible: i2c-mux-reg
8b3fdd327SYork Sun- i2c-parent: The phandle of the I2C bus that this multiplexer's master-side
9b3fdd327SYork Sun  port is connected to.
10*a404a636SRob Herring* Standard I2C mux properties. See i2c-mux.yaml in this directory.
11*a404a636SRob Herring* I2C child bus nodes. See i2c-mux.yaml in this directory.
12b3fdd327SYork Sun
13b3fdd327SYork SunOptional properties:
14b3fdd327SYork Sun- reg: this pair of <offset size> specifies the register to control the mux.
15b3fdd327SYork Sun  The <offset size> depends on its parent node. It can be any memory-mapped
16b3fdd327SYork Sun  address. The size must be either 1, 2, or 4 bytes. If reg is omitted, the
17b3fdd327SYork Sun  resource of this device will be used.
18b3fdd327SYork Sun- little-endian: The existence indicates the register is in little endian.
19b3fdd327SYork Sun- big-endian: The existence indicates the register is in big endian.
20b3fdd327SYork Sun  If both little-endian and big-endian are omitted, the endianness of the
21b3fdd327SYork Sun  CPU will be used.
22b3fdd327SYork Sun- write-only: The existence indicates the register is write-only.
23b3fdd327SYork Sun- idle-state: value to set the muxer to when idle. When no value is
24b3fdd327SYork Sun  given, it defaults to the last value used.
25b3fdd327SYork Sun
26b3fdd327SYork SunWhenever an access is made to a device on a child bus, the value set
272e932849SSimon Hormanin the relevant node's reg property will be output to the register.
28b3fdd327SYork Sun
29b3fdd327SYork SunIf an idle state is defined, using the idle-state (optional) property,
30b3fdd327SYork Sunwhenever an access is not being made to a device on a child bus, the
31b3fdd327SYork Sunregister will be set according to the idle value.
32b3fdd327SYork Sun
33b3fdd327SYork SunIf an idle state is not defined, the most recently used value will be
34b3fdd327SYork Sunleft programmed into the register.
35b3fdd327SYork Sun
36b3fdd327SYork SunExample of a mux on PCIe card, the host is a powerpc SoC (big endian):
37b3fdd327SYork Sun
38b3fdd327SYork Sun	i2c-mux {
39b3fdd327SYork Sun		/* the <offset size> depends on the address translation
40b3fdd327SYork Sun		 * of the parent device. If omitted, device resource
41b3fdd327SYork Sun		 * will be used instead. The size is to determine
42b3fdd327SYork Sun		 * whether iowrite32, iowrite16, or iowrite8 will be used.
43b3fdd327SYork Sun		 */
44b3fdd327SYork Sun		reg = <0x6028 0x4>;
45b3fdd327SYork Sun		little-endian;		/* little endian register on PCIe */
46b3fdd327SYork Sun		compatible = "i2c-mux-reg";
47b3fdd327SYork Sun		#address-cells = <1>;
48b3fdd327SYork Sun		#size-cells = <0>;
49b3fdd327SYork Sun		i2c-parent = <&i2c1>;
50b3fdd327SYork Sun		i2c@0 {
51b3fdd327SYork Sun			reg = <0>;
52b3fdd327SYork Sun			#address-cells = <1>;
53b3fdd327SYork Sun			#size-cells = <0>;
54b3fdd327SYork Sun
55b3fdd327SYork Sun			si5338: clock-generator@70 {
56b3fdd327SYork Sun				compatible = "silabs,si5338";
57b3fdd327SYork Sun				reg = <0x70>;
58b3fdd327SYork Sun				/* other stuff */
59b3fdd327SYork Sun			};
60b3fdd327SYork Sun		};
61b3fdd327SYork Sun
62b3fdd327SYork Sun		i2c@1 {
63b3fdd327SYork Sun			/* data is written using iowrite32 */
64b3fdd327SYork Sun			reg = <1>;
65b3fdd327SYork Sun			#address-cells = <1>;
66b3fdd327SYork Sun			#size-cells = <0>;
67b3fdd327SYork Sun
68b3fdd327SYork Sun			si5338: clock-generator@70 {
69b3fdd327SYork Sun				compatible = "silabs,si5338";
70b3fdd327SYork Sun				reg = <0x70>;
71b3fdd327SYork Sun				/* other stuff */
72b3fdd327SYork Sun			};
73b3fdd327SYork Sun		};
74b3fdd327SYork Sun	};
75