xref: /freebsd-src/sys/contrib/device-tree/Bindings/net/dsa/realtek-smi.txt (revision 8cc087a1eee9ec1ca9f7ac1e63ad51bdb5a682eb)
1c66ec88fSEmmanuel VadotRealtek SMI-based Switches
2c66ec88fSEmmanuel Vadot==========================
3c66ec88fSEmmanuel Vadot
4c66ec88fSEmmanuel VadotThe SMI "Simple Management Interface" is a two-wire protocol using
5c66ec88fSEmmanuel Vadotbit-banged GPIO that while it reuses the MDIO lines MCK and MDIO does
6c66ec88fSEmmanuel Vadotnot use the MDIO protocol. This binding defines how to specify the
7c66ec88fSEmmanuel VadotSMI-based Realtek devices.
8c66ec88fSEmmanuel Vadot
9c66ec88fSEmmanuel VadotRequired properties:
10c66ec88fSEmmanuel Vadot
11c66ec88fSEmmanuel Vadot- compatible: must be exactly one of:
12*8cc087a1SEmmanuel Vadot      "realtek,rtl8365mb" (4+1 ports)
13c66ec88fSEmmanuel Vadot      "realtek,rtl8366"
14c66ec88fSEmmanuel Vadot      "realtek,rtl8366rb" (4+1 ports)
15c66ec88fSEmmanuel Vadot      "realtek,rtl8366s"  (4+1 ports)
16c66ec88fSEmmanuel Vadot      "realtek,rtl8367"
17c66ec88fSEmmanuel Vadot      "realtek,rtl8367b"
18c66ec88fSEmmanuel Vadot      "realtek,rtl8368s"  (8 port)
19c66ec88fSEmmanuel Vadot      "realtek,rtl8369"
20c66ec88fSEmmanuel Vadot      "realtek,rtl8370"   (8 port)
21c66ec88fSEmmanuel Vadot
22c66ec88fSEmmanuel VadotRequired properties:
23c66ec88fSEmmanuel Vadot- mdc-gpios: GPIO line for the MDC clock line.
24c66ec88fSEmmanuel Vadot- mdio-gpios: GPIO line for the MDIO data line.
25c66ec88fSEmmanuel Vadot- reset-gpios: GPIO line for the reset signal.
26c66ec88fSEmmanuel Vadot
27c66ec88fSEmmanuel VadotOptional properties:
28c66ec88fSEmmanuel Vadot- realtek,disable-leds: if the LED drivers are not used in the
29c66ec88fSEmmanuel Vadot  hardware design this will disable them so they are not turned on
30c66ec88fSEmmanuel Vadot  and wasting power.
31c66ec88fSEmmanuel Vadot
32c66ec88fSEmmanuel VadotRequired subnodes:
33c66ec88fSEmmanuel Vadot
34c66ec88fSEmmanuel Vadot- interrupt-controller
35c66ec88fSEmmanuel Vadot
36c66ec88fSEmmanuel Vadot  This defines an interrupt controller with an IRQ line (typically
37c66ec88fSEmmanuel Vadot  a GPIO) that will demultiplex and handle the interrupt from the single
38c66ec88fSEmmanuel Vadot  interrupt line coming out of one of the SMI-based chips. It most
39c66ec88fSEmmanuel Vadot  importantly provides link up/down interrupts to the PHY blocks inside
40c66ec88fSEmmanuel Vadot  the ASIC.
41c66ec88fSEmmanuel Vadot
42c66ec88fSEmmanuel VadotRequired properties of interrupt-controller:
43c66ec88fSEmmanuel Vadot
44c66ec88fSEmmanuel Vadot- interrupt: parent interrupt, see interrupt-controller/interrupts.txt
45c66ec88fSEmmanuel Vadot- interrupt-controller: see interrupt-controller/interrupts.txt
46c66ec88fSEmmanuel Vadot- #address-cells: should be <0>
47c66ec88fSEmmanuel Vadot- #interrupt-cells: should be <1>
48c66ec88fSEmmanuel Vadot
49c66ec88fSEmmanuel Vadot- mdio
50c66ec88fSEmmanuel Vadot
51c66ec88fSEmmanuel Vadot  This defines the internal MDIO bus of the SMI device, mostly for the
52c66ec88fSEmmanuel Vadot  purpose of being able to hook the interrupts to the right PHY and
53c66ec88fSEmmanuel Vadot  the right PHY to the corresponding port.
54c66ec88fSEmmanuel Vadot
55c66ec88fSEmmanuel VadotRequired properties of mdio:
56c66ec88fSEmmanuel Vadot
57c66ec88fSEmmanuel Vadot- compatible: should be set to "realtek,smi-mdio" for all SMI devices
58c66ec88fSEmmanuel Vadot
59c66ec88fSEmmanuel VadotSee net/mdio.txt for additional MDIO bus properties.
60c66ec88fSEmmanuel Vadot
61c66ec88fSEmmanuel VadotSee net/dsa/dsa.txt for a list of additional required and optional properties
62c66ec88fSEmmanuel Vadotand subnodes of DSA switches.
63c66ec88fSEmmanuel Vadot
64c66ec88fSEmmanuel VadotExamples:
65c66ec88fSEmmanuel Vadot
66*8cc087a1SEmmanuel VadotAn example for the RTL8366RB:
67*8cc087a1SEmmanuel Vadot
68c66ec88fSEmmanuel Vadotswitch {
69c66ec88fSEmmanuel Vadot	compatible = "realtek,rtl8366rb";
70c66ec88fSEmmanuel Vadot	/* 22 = MDIO (has input reads), 21 = MDC (clock, output only) */
71c66ec88fSEmmanuel Vadot	mdc-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
72c66ec88fSEmmanuel Vadot	mdio-gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
73c66ec88fSEmmanuel Vadot	reset-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
74c66ec88fSEmmanuel Vadot
75c66ec88fSEmmanuel Vadot	switch_intc: interrupt-controller {
76c66ec88fSEmmanuel Vadot		/* GPIO 15 provides the interrupt */
77c66ec88fSEmmanuel Vadot		interrupt-parent = <&gpio0>;
78c66ec88fSEmmanuel Vadot		interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
79c66ec88fSEmmanuel Vadot		interrupt-controller;
80c66ec88fSEmmanuel Vadot		#address-cells = <0>;
81c66ec88fSEmmanuel Vadot		#interrupt-cells = <1>;
82c66ec88fSEmmanuel Vadot	};
83c66ec88fSEmmanuel Vadot
84c66ec88fSEmmanuel Vadot	ports {
85c66ec88fSEmmanuel Vadot		#address-cells = <1>;
86c66ec88fSEmmanuel Vadot		#size-cells = <0>;
87c66ec88fSEmmanuel Vadot		reg = <0>;
88c66ec88fSEmmanuel Vadot		port@0 {
89c66ec88fSEmmanuel Vadot			reg = <0>;
90c66ec88fSEmmanuel Vadot			label = "lan0";
91c66ec88fSEmmanuel Vadot			phy-handle = <&phy0>;
92c66ec88fSEmmanuel Vadot		};
93c66ec88fSEmmanuel Vadot		port@1 {
94c66ec88fSEmmanuel Vadot			reg = <1>;
95c66ec88fSEmmanuel Vadot			label = "lan1";
96c66ec88fSEmmanuel Vadot			phy-handle = <&phy1>;
97c66ec88fSEmmanuel Vadot		};
98c66ec88fSEmmanuel Vadot		port@2 {
99c66ec88fSEmmanuel Vadot			reg = <2>;
100c66ec88fSEmmanuel Vadot			label = "lan2";
101c66ec88fSEmmanuel Vadot			phy-handle = <&phy2>;
102c66ec88fSEmmanuel Vadot		};
103c66ec88fSEmmanuel Vadot		port@3 {
104c66ec88fSEmmanuel Vadot			reg = <3>;
105c66ec88fSEmmanuel Vadot			label = "lan3";
106c66ec88fSEmmanuel Vadot			phy-handle = <&phy3>;
107c66ec88fSEmmanuel Vadot		};
108c66ec88fSEmmanuel Vadot		port@4 {
109c66ec88fSEmmanuel Vadot			reg = <4>;
110c66ec88fSEmmanuel Vadot			label = "wan";
111c66ec88fSEmmanuel Vadot			phy-handle = <&phy4>;
112c66ec88fSEmmanuel Vadot		};
113c66ec88fSEmmanuel Vadot		port@5 {
114c66ec88fSEmmanuel Vadot			reg = <5>;
115c66ec88fSEmmanuel Vadot			label = "cpu";
116c66ec88fSEmmanuel Vadot			ethernet = <&gmac0>;
117c66ec88fSEmmanuel Vadot			phy-mode = "rgmii";
118c66ec88fSEmmanuel Vadot			fixed-link {
119c66ec88fSEmmanuel Vadot				speed = <1000>;
120c66ec88fSEmmanuel Vadot				full-duplex;
121c66ec88fSEmmanuel Vadot			};
122c66ec88fSEmmanuel Vadot		};
123c66ec88fSEmmanuel Vadot	};
124c66ec88fSEmmanuel Vadot
125c66ec88fSEmmanuel Vadot	mdio {
126c66ec88fSEmmanuel Vadot		compatible = "realtek,smi-mdio", "dsa-mdio";
127c66ec88fSEmmanuel Vadot		#address-cells = <1>;
128c66ec88fSEmmanuel Vadot		#size-cells = <0>;
129c66ec88fSEmmanuel Vadot
130c66ec88fSEmmanuel Vadot		phy0: phy@0 {
131c66ec88fSEmmanuel Vadot			reg = <0>;
132c66ec88fSEmmanuel Vadot			interrupt-parent = <&switch_intc>;
133c66ec88fSEmmanuel Vadot			interrupts = <0>;
134c66ec88fSEmmanuel Vadot		};
135c66ec88fSEmmanuel Vadot		phy1: phy@1 {
136c66ec88fSEmmanuel Vadot			reg = <1>;
137c66ec88fSEmmanuel Vadot			interrupt-parent = <&switch_intc>;
138c66ec88fSEmmanuel Vadot			interrupts = <1>;
139c66ec88fSEmmanuel Vadot		};
140c66ec88fSEmmanuel Vadot		phy2: phy@2 {
141c66ec88fSEmmanuel Vadot			reg = <2>;
142c66ec88fSEmmanuel Vadot			interrupt-parent = <&switch_intc>;
143c66ec88fSEmmanuel Vadot			interrupts = <2>;
144c66ec88fSEmmanuel Vadot		};
145c66ec88fSEmmanuel Vadot		phy3: phy@3 {
146c66ec88fSEmmanuel Vadot			reg = <3>;
147c66ec88fSEmmanuel Vadot			interrupt-parent = <&switch_intc>;
148c66ec88fSEmmanuel Vadot			interrupts = <3>;
149c66ec88fSEmmanuel Vadot		};
150c66ec88fSEmmanuel Vadot		phy4: phy@4 {
151c66ec88fSEmmanuel Vadot			reg = <4>;
152c66ec88fSEmmanuel Vadot			interrupt-parent = <&switch_intc>;
153c66ec88fSEmmanuel Vadot			interrupts = <12>;
154c66ec88fSEmmanuel Vadot		};
155c66ec88fSEmmanuel Vadot	};
156c66ec88fSEmmanuel Vadot};
157*8cc087a1SEmmanuel Vadot
158*8cc087a1SEmmanuel VadotAn example for the RTL8365MB-VC:
159*8cc087a1SEmmanuel Vadot
160*8cc087a1SEmmanuel Vadotswitch {
161*8cc087a1SEmmanuel Vadot	compatible = "realtek,rtl8365mb";
162*8cc087a1SEmmanuel Vadot	mdc-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
163*8cc087a1SEmmanuel Vadot	mdio-gpios = <&gpio1 17 GPIO_ACTIVE_HIGH>;
164*8cc087a1SEmmanuel Vadot	reset-gpios = <&gpio5 0 GPIO_ACTIVE_LOW>;
165*8cc087a1SEmmanuel Vadot
166*8cc087a1SEmmanuel Vadot	switch_intc: interrupt-controller {
167*8cc087a1SEmmanuel Vadot		interrupt-parent = <&gpio5>;
168*8cc087a1SEmmanuel Vadot		interrupts = <1 IRQ_TYPE_LEVEL_LOW>;
169*8cc087a1SEmmanuel Vadot		interrupt-controller;
170*8cc087a1SEmmanuel Vadot		#address-cells = <0>;
171*8cc087a1SEmmanuel Vadot		#interrupt-cells = <1>;
172*8cc087a1SEmmanuel Vadot	};
173*8cc087a1SEmmanuel Vadot
174*8cc087a1SEmmanuel Vadot	ports {
175*8cc087a1SEmmanuel Vadot		#address-cells = <1>;
176*8cc087a1SEmmanuel Vadot		#size-cells = <0>;
177*8cc087a1SEmmanuel Vadot		reg = <0>;
178*8cc087a1SEmmanuel Vadot		port@0 {
179*8cc087a1SEmmanuel Vadot			reg = <0>;
180*8cc087a1SEmmanuel Vadot			label = "swp0";
181*8cc087a1SEmmanuel Vadot			phy-handle = <&ethphy0>;
182*8cc087a1SEmmanuel Vadot		};
183*8cc087a1SEmmanuel Vadot		port@1 {
184*8cc087a1SEmmanuel Vadot			reg = <1>;
185*8cc087a1SEmmanuel Vadot			label = "swp1";
186*8cc087a1SEmmanuel Vadot			phy-handle = <&ethphy1>;
187*8cc087a1SEmmanuel Vadot		};
188*8cc087a1SEmmanuel Vadot		port@2 {
189*8cc087a1SEmmanuel Vadot			reg = <2>;
190*8cc087a1SEmmanuel Vadot			label = "swp2";
191*8cc087a1SEmmanuel Vadot			phy-handle = <&ethphy2>;
192*8cc087a1SEmmanuel Vadot		};
193*8cc087a1SEmmanuel Vadot		port@3 {
194*8cc087a1SEmmanuel Vadot			reg = <3>;
195*8cc087a1SEmmanuel Vadot			label = "swp3";
196*8cc087a1SEmmanuel Vadot			phy-handle = <&ethphy3>;
197*8cc087a1SEmmanuel Vadot		};
198*8cc087a1SEmmanuel Vadot		port@6 {
199*8cc087a1SEmmanuel Vadot			reg = <6>;
200*8cc087a1SEmmanuel Vadot			label = "cpu";
201*8cc087a1SEmmanuel Vadot			ethernet = <&fec1>;
202*8cc087a1SEmmanuel Vadot			phy-mode = "rgmii";
203*8cc087a1SEmmanuel Vadot			tx-internal-delay-ps = <2000>;
204*8cc087a1SEmmanuel Vadot			rx-internal-delay-ps = <2000>;
205*8cc087a1SEmmanuel Vadot
206*8cc087a1SEmmanuel Vadot			fixed-link {
207*8cc087a1SEmmanuel Vadot				speed = <1000>;
208*8cc087a1SEmmanuel Vadot				full-duplex;
209*8cc087a1SEmmanuel Vadot				pause;
210*8cc087a1SEmmanuel Vadot			};
211*8cc087a1SEmmanuel Vadot		};
212*8cc087a1SEmmanuel Vadot	};
213*8cc087a1SEmmanuel Vadot
214*8cc087a1SEmmanuel Vadot	mdio {
215*8cc087a1SEmmanuel Vadot		compatible = "realtek,smi-mdio";
216*8cc087a1SEmmanuel Vadot		#address-cells = <1>;
217*8cc087a1SEmmanuel Vadot		#size-cells = <0>;
218*8cc087a1SEmmanuel Vadot
219*8cc087a1SEmmanuel Vadot		ethphy0: phy@0 {
220*8cc087a1SEmmanuel Vadot			reg = <0>;
221*8cc087a1SEmmanuel Vadot			interrupt-parent = <&switch_intc>;
222*8cc087a1SEmmanuel Vadot			interrupts = <0>;
223*8cc087a1SEmmanuel Vadot		};
224*8cc087a1SEmmanuel Vadot		ethphy1: phy@1 {
225*8cc087a1SEmmanuel Vadot			reg = <1>;
226*8cc087a1SEmmanuel Vadot			interrupt-parent = <&switch_intc>;
227*8cc087a1SEmmanuel Vadot			interrupts = <1>;
228*8cc087a1SEmmanuel Vadot		};
229*8cc087a1SEmmanuel Vadot		ethphy2: phy@2 {
230*8cc087a1SEmmanuel Vadot			reg = <2>;
231*8cc087a1SEmmanuel Vadot			interrupt-parent = <&switch_intc>;
232*8cc087a1SEmmanuel Vadot			interrupts = <2>;
233*8cc087a1SEmmanuel Vadot		};
234*8cc087a1SEmmanuel Vadot		ethphy3: phy@3 {
235*8cc087a1SEmmanuel Vadot			reg = <3>;
236*8cc087a1SEmmanuel Vadot			interrupt-parent = <&switch_intc>;
237*8cc087a1SEmmanuel Vadot			interrupts = <3>;
238*8cc087a1SEmmanuel Vadot		};
239*8cc087a1SEmmanuel Vadot	};
240*8cc087a1SEmmanuel Vadot};
241