xref: /freebsd/sys/contrib/device-tree/Bindings/mux/reg-mux.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotGeneric register bitfield-based multiplexer controller bindings
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotDefine register bitfields to be used to control multiplexers. The parent
4*c66ec88fSEmmanuel Vadotdevice tree node must be a device node to provide register r/w access.
5*c66ec88fSEmmanuel Vadot
6*c66ec88fSEmmanuel VadotRequired properties:
7*c66ec88fSEmmanuel Vadot- compatible : should be one of
8*c66ec88fSEmmanuel Vadot	"reg-mux" : if parent device of mux controller is not syscon device
9*c66ec88fSEmmanuel Vadot	"mmio-mux" : if parent device of mux controller is syscon device
10*c66ec88fSEmmanuel Vadot- #mux-control-cells : <1>
11*c66ec88fSEmmanuel Vadot- mux-reg-masks : an array of register offset and pre-shifted bitfield mask
12*c66ec88fSEmmanuel Vadot                  pairs, each describing a single mux control.
13*c66ec88fSEmmanuel Vadot* Standard mux-controller bindings as decribed in mux-controller.txt
14*c66ec88fSEmmanuel Vadot
15*c66ec88fSEmmanuel VadotOptional properties:
16*c66ec88fSEmmanuel Vadot- idle-states : if present, the state the muxes will have when idle. The
17*c66ec88fSEmmanuel Vadot		special state MUX_IDLE_AS_IS is the default.
18*c66ec88fSEmmanuel Vadot
19*c66ec88fSEmmanuel VadotThe multiplexer state of each multiplexer is defined as the value of the
20*c66ec88fSEmmanuel Vadotbitfield described by the corresponding register offset and bitfield mask
21*c66ec88fSEmmanuel Vadotpair in the mux-reg-masks array.
22*c66ec88fSEmmanuel Vadot
23*c66ec88fSEmmanuel VadotExample 1:
24*c66ec88fSEmmanuel VadotThe parent device of mux controller is not a syscon device.
25*c66ec88fSEmmanuel Vadot
26*c66ec88fSEmmanuel Vadot&i2c0 {
27*c66ec88fSEmmanuel Vadot	fpga@66 { // fpga connected to i2c
28*c66ec88fSEmmanuel Vadot		compatible = "fsl,lx2160aqds-fpga", "fsl,fpga-qixis-i2c",
29*c66ec88fSEmmanuel Vadot			     "simple-mfd";
30*c66ec88fSEmmanuel Vadot		reg = <0x66>;
31*c66ec88fSEmmanuel Vadot
32*c66ec88fSEmmanuel Vadot		mux: mux-controller {
33*c66ec88fSEmmanuel Vadot			compatible = "reg-mux";
34*c66ec88fSEmmanuel Vadot			#mux-control-cells = <1>;
35*c66ec88fSEmmanuel Vadot			mux-reg-masks = <0x54 0xf8>, /* 0: reg 0x54, bits 7:3 */
36*c66ec88fSEmmanuel Vadot					<0x54 0x07>; /* 1: reg 0x54, bits 2:0 */
37*c66ec88fSEmmanuel Vadot		};
38*c66ec88fSEmmanuel Vadot	};
39*c66ec88fSEmmanuel Vadot};
40*c66ec88fSEmmanuel Vadot
41*c66ec88fSEmmanuel Vadotmdio-mux-1 {
42*c66ec88fSEmmanuel Vadot	compatible = "mdio-mux-multiplexer";
43*c66ec88fSEmmanuel Vadot	mux-controls = <&mux 0>;
44*c66ec88fSEmmanuel Vadot	mdio-parent-bus = <&emdio1>;
45*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
46*c66ec88fSEmmanuel Vadot	#size-cells = <0>;
47*c66ec88fSEmmanuel Vadot
48*c66ec88fSEmmanuel Vadot	mdio@0 {
49*c66ec88fSEmmanuel Vadot		reg = <0x0>;
50*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
51*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
52*c66ec88fSEmmanuel Vadot	};
53*c66ec88fSEmmanuel Vadot
54*c66ec88fSEmmanuel Vadot	mdio@8 {
55*c66ec88fSEmmanuel Vadot		reg = <0x8>;
56*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
57*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
58*c66ec88fSEmmanuel Vadot	};
59*c66ec88fSEmmanuel Vadot
60*c66ec88fSEmmanuel Vadot	..
61*c66ec88fSEmmanuel Vadot	..
62*c66ec88fSEmmanuel Vadot};
63*c66ec88fSEmmanuel Vadot
64*c66ec88fSEmmanuel Vadotmdio-mux-2 {
65*c66ec88fSEmmanuel Vadot	compatible = "mdio-mux-multiplexer";
66*c66ec88fSEmmanuel Vadot	mux-controls = <&mux 1>;
67*c66ec88fSEmmanuel Vadot	mdio-parent-bus = <&emdio2>;
68*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
69*c66ec88fSEmmanuel Vadot	#size-cells = <0>;
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel Vadot	mdio@0 {
72*c66ec88fSEmmanuel Vadot		reg = <0x0>;
73*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
74*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
75*c66ec88fSEmmanuel Vadot	};
76*c66ec88fSEmmanuel Vadot
77*c66ec88fSEmmanuel Vadot	mdio@1 {
78*c66ec88fSEmmanuel Vadot		reg = <0x1>;
79*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
80*c66ec88fSEmmanuel Vadot		#size-cells = <0>;
81*c66ec88fSEmmanuel Vadot	};
82*c66ec88fSEmmanuel Vadot
83*c66ec88fSEmmanuel Vadot	..
84*c66ec88fSEmmanuel Vadot	..
85*c66ec88fSEmmanuel Vadot};
86*c66ec88fSEmmanuel Vadot
87*c66ec88fSEmmanuel VadotExample 2:
88*c66ec88fSEmmanuel VadotThe parent device of mux controller is syscon device.
89*c66ec88fSEmmanuel Vadot
90*c66ec88fSEmmanuel Vadotsyscon {
91*c66ec88fSEmmanuel Vadot	compatible = "syscon";
92*c66ec88fSEmmanuel Vadot
93*c66ec88fSEmmanuel Vadot	mux: mux-controller {
94*c66ec88fSEmmanuel Vadot		compatible = "mmio-mux";
95*c66ec88fSEmmanuel Vadot		#mux-control-cells = <1>;
96*c66ec88fSEmmanuel Vadot
97*c66ec88fSEmmanuel Vadot		mux-reg-masks = <0x3 0x30>, /* 0: reg 0x3, bits 5:4 */
98*c66ec88fSEmmanuel Vadot				<0x3 0x40>, /* 1: reg 0x3, bit 6 */
99*c66ec88fSEmmanuel Vadot		idle-states = <MUX_IDLE_AS_IS>, <0>;
100*c66ec88fSEmmanuel Vadot	};
101*c66ec88fSEmmanuel Vadot};
102*c66ec88fSEmmanuel Vadot
103*c66ec88fSEmmanuel Vadotvideo-mux {
104*c66ec88fSEmmanuel Vadot	compatible = "video-mux";
105*c66ec88fSEmmanuel Vadot	mux-controls = <&mux 0>;
106*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
107*c66ec88fSEmmanuel Vadot	#size-cells = <0>;
108*c66ec88fSEmmanuel Vadot
109*c66ec88fSEmmanuel Vadot	ports {
110*c66ec88fSEmmanuel Vadot		/* inputs 0..3 */
111*c66ec88fSEmmanuel Vadot		port@0 {
112*c66ec88fSEmmanuel Vadot			reg = <0>;
113*c66ec88fSEmmanuel Vadot		};
114*c66ec88fSEmmanuel Vadot		port@1 {
115*c66ec88fSEmmanuel Vadot			reg = <1>;
116*c66ec88fSEmmanuel Vadot		};
117*c66ec88fSEmmanuel Vadot		port@2 {
118*c66ec88fSEmmanuel Vadot			reg = <2>;
119*c66ec88fSEmmanuel Vadot		};
120*c66ec88fSEmmanuel Vadot		port@3 {
121*c66ec88fSEmmanuel Vadot			reg = <3>;
122*c66ec88fSEmmanuel Vadot		};
123*c66ec88fSEmmanuel Vadot
124*c66ec88fSEmmanuel Vadot		/* output */
125*c66ec88fSEmmanuel Vadot		port@4 {
126*c66ec88fSEmmanuel Vadot			reg = <4>;
127*c66ec88fSEmmanuel Vadot		};
128*c66ec88fSEmmanuel Vadot	};
129*c66ec88fSEmmanuel Vadot};
130