1 // SPDX-License-Identifier: GPL-2.0
2 #include "qcom-ipq8064.dtsi"
3 #include <dt-bindings/input/input.h>
4 #include <dt-bindings/leds/common.h>
5 
6 / {
7 	model = "MikroTik RB3011UiAS-RM";
8 	compatible = "mikrotik,rb3011", "qcom,ipq8064";
9 
10 	aliases {
11 		serial0 = &gsbi7_serial;
12 		ethernet0 = &gmac0;
13 		ethernet1 = &gmac3;
14 		mdio-gpio0 = &mdio0;
15 		mdio-gpio1 = &mdio1;
16 	};
17 
18 	chosen {
19 		bootargs = "loglevel=8 console=ttyMSM0,115200";
20 		stdout-path = "serial0:115200n8";
21 	};
22 
23 	gpio-keys {
24 		compatible = "gpio-keys";
25 		pinctrl-0 = <&buttons_pins>;
26 		pinctrl-names = "default";
27 
28 		button {
29 			label = "reset";
30 			linux,code = <KEY_RESTART>;
31 			gpios = <&qcom_pinmux 66 GPIO_ACTIVE_LOW>;
32 			linux,input-type = <1>;
33 			debounce-interval = <60>;
34 		};
35 	};
36 
37 	leds {
38 		compatible = "gpio-leds";
39 		pinctrl-0 = <&leds_pins>;
40 		pinctrl-names = "default";
41 
42 		led-0 {
43 			label = "rb3011:green:user";
44 			color = <LED_COLOR_ID_GREEN>;
45 			gpios = <&qcom_pinmux 33 GPIO_ACTIVE_HIGH>;
46 			default-state = "off";
47 		};
48 	};
49 
50 	memory@42000000 {
51 		reg = <0x42000000 0x3e000000>;
52 		device_type = "memory";
53 	};
54 
55 	mdio0: mdio-0 {
56 		status = "okay";
57 		compatible = "virtual,mdio-gpio";
58 		gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH>,
59 			<&qcom_pinmux 0 GPIO_ACTIVE_HIGH>;
60 		#address-cells = <1>;
61 		#size-cells = <0>;
62 
63 		pinctrl-0 = <&mdio0_pins>;
64 		pinctrl-names = "default";
65 
66 		switch0: switch@10 {
67 			compatible = "qca,qca8337";
68 
69 			dsa,member = <0 0>;
70 
71 			pinctrl-0 = <&sw0_reset_pin>;
72 			pinctrl-names = "default";
73 
74 			reset-gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>;
75 			reg = <0x10>;
76 
77 			ports {
78 				#address-cells = <1>;
79 				#size-cells = <0>;
80 
81 				switch0cpu: port@0 {
82 					reg = <0>;
83 					label = "cpu";
84 					ethernet = <&gmac0>;
85 					phy-mode = "rgmii-id";
86 					fixed-link {
87 						speed = <1000>;
88 						full-duplex;
89 					};
90 				};
91 
92 				port@1 {
93 					reg = <1>;
94 					label = "sw1";
95 
96 					leds {
97 						#address-cells = <1>;
98 						#size-cells = <0>;
99 
100 						led@0 {
101 							reg = <0>;
102 							color = <LED_COLOR_ID_GREEN>;
103 							function = LED_FUNCTION_LAN;
104 							default-state = "keep";
105 						};
106 					};
107 				};
108 
109 				port@2 {
110 					reg = <2>;
111 					label = "sw2";
112 
113 					leds {
114 						#address-cells = <1>;
115 						#size-cells = <0>;
116 
117 						led@0 {
118 							reg = <0>;
119 							color = <LED_COLOR_ID_GREEN>;
120 							function = LED_FUNCTION_LAN;
121 							default-state = "keep";
122 						};
123 					};
124 				};
125 
126 				port@3 {
127 					reg = <3>;
128 					label = "sw3";
129 
130 					leds {
131 						#address-cells = <1>;
132 						#size-cells = <0>;
133 
134 						led@0 {
135 							reg = <0>;
136 							color = <LED_COLOR_ID_GREEN>;
137 							function = LED_FUNCTION_LAN;
138 							default-state = "keep";
139 						};
140 					};
141 				};
142 
143 				port@4 {
144 					reg = <4>;
145 					label = "sw4";
146 
147 					leds {
148 						#address-cells = <1>;
149 						#size-cells = <0>;
150 
151 						led@0 {
152 							reg = <0>;
153 							color = <LED_COLOR_ID_GREEN>;
154 							function = LED_FUNCTION_LAN;
155 							default-state = "keep";
156 						};
157 					};
158 				};
159 
160 				port@5 {
161 					reg = <5>;
162 					label = "sw5";
163 
164 					leds {
165 						#address-cells = <1>;
166 						#size-cells = <0>;
167 
168 						led@0 {
169 							reg = <0>;
170 							color = <LED_COLOR_ID_GREEN>;
171 							function = LED_FUNCTION_LAN;
172 							default-state = "keep";
173 						};
174 					};
175 				};
176 			};
177 		};
178 	};
179 
180 	mdio1: mdio-1 {
181 		status = "okay";
182 		compatible = "virtual,mdio-gpio";
183 		gpios = <&qcom_pinmux 11 GPIO_ACTIVE_HIGH>,
184 			<&qcom_pinmux 10 GPIO_ACTIVE_HIGH>;
185 		#address-cells = <1>;
186 		#size-cells = <0>;
187 
188 		pinctrl-0 = <&mdio1_pins>;
189 		pinctrl-names = "default";
190 
191 		switch1: switch@14 {
192 			compatible = "qca,qca8337";
193 
194 			dsa,member = <1 0>;
195 
196 			pinctrl-0 = <&sw1_reset_pin>;
197 			pinctrl-names = "default";
198 
199 			reset-gpios = <&qcom_pinmux 17 GPIO_ACTIVE_LOW>;
200 			reg = <0x10>;
201 
202 			ports {
203 				#address-cells = <1>;
204 				#size-cells = <0>;
205 
206 				switch1cpu: port@0 {
207 					reg = <0>;
208 					label = "cpu";
209 					ethernet = <&gmac3>;
210 					phy-mode = "sgmii";
211 					fixed-link {
212 						speed = <1000>;
213 						full-duplex;
214 					};
215 				};
216 
217 				port@1 {
218 					reg = <1>;
219 					label = "sw6";
220 
221 					leds {
222 						#address-cells = <1>;
223 						#size-cells = <0>;
224 
225 						led@0 {
226 							reg = <0>;
227 							color = <LED_COLOR_ID_GREEN>;
228 							function = LED_FUNCTION_LAN;
229 							default-state = "keep";
230 						};
231 					};
232 				};
233 
234 				port@2 {
235 					reg = <2>;
236 					label = "sw7";
237 
238 					leds {
239 						#address-cells = <1>;
240 						#size-cells = <0>;
241 
242 						led@0 {
243 							reg = <0>;
244 							color = <LED_COLOR_ID_GREEN>;
245 							function = LED_FUNCTION_LAN;
246 							default-state = "keep";
247 						};
248 					};
249 				};
250 
251 				port@3 {
252 					reg = <3>;
253 					label = "sw8";
254 
255 					leds {
256 						#address-cells = <1>;
257 						#size-cells = <0>;
258 
259 						led@0 {
260 							reg = <0>;
261 							color = <LED_COLOR_ID_GREEN>;
262 							function = LED_FUNCTION_LAN;
263 							default-state = "keep";
264 						};
265 					};
266 				};
267 
268 				port@4 {
269 					reg = <4>;
270 					label = "sw9";
271 
272 					leds {
273 						#address-cells = <1>;
274 						#size-cells = <0>;
275 
276 						led@0 {
277 							reg = <0>;
278 							color = <LED_COLOR_ID_GREEN>;
279 							function = LED_FUNCTION_LAN;
280 							default-state = "keep";
281 						};
282 					};
283 				};
284 
285 				port@5 {
286 					reg = <5>;
287 					label = "sw10";
288 
289 					leds {
290 						#address-cells = <1>;
291 						#size-cells = <0>;
292 
293 						led@0 {
294 							reg = <0>;
295 							color = <LED_COLOR_ID_GREEN>;
296 							function = LED_FUNCTION_LAN;
297 							default-state = "keep";
298 						};
299 					};
300 				};
301 			};
302 		};
303 	};
304 
305 	soc {
306 		gsbi5: gsbi@1a200000 {
307 			qcom,mode = <GSBI_PROT_SPI>;
308 			status = "okay";
309 
310 			spi4: spi@1a280000 {
311 				status = "okay";
312 
313 				pinctrl-0 = <&spi_pins>;
314 				pinctrl-names = "default";
315 
316 				cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
317 
318 				norflash: flash@0 {
319 					compatible = "jedec,spi-nor";
320 					#address-cells = <1>;
321 					#size-cells = <1>;
322 					spi-max-frequency = <50000000>;
323 					reg = <0>;
324 
325 					partition@0 {
326 						label = "RouterBoot";
327 						reg = <0x0 0x40000>;
328 					};
329 				};
330 			};
331 		};
332 	};
333 };
334 
335 &adm_dma {
336 	status = "okay";
337 };
338 
339 &gmac0 {
340 	status = "okay";
341 
342 	phy-mode = "rgmii";
343 	qcom,id = <0>;
344 	phy-handle = <&switch0cpu>;
345 
346 	fixed-link {
347 		speed = <1000>;
348 		full-duplex;
349 	};
350 };
351 
352 &gmac3 {
353 	status = "okay";
354 
355 	phy-mode = "sgmii";
356 	qcom,id = <3>;
357 	phy-handle = <&switch1cpu>;
358 
359 	fixed-link {
360 		speed = <1000>;
361 		full-duplex;
362 	};
363 };
364 
365 &gsbi7 {
366 	status = "okay";
367 	qcom,mode = <GSBI_PROT_I2C_UART>;
368 };
369 
370 &gsbi7_serial {
371 	status = "okay";
372 };
373 
374 &hs_phy_1 {
375 	status = "okay";
376 };
377 
378 &nand {
379 	status = "okay";
380 
381 	nand@0 {
382 		reg = <0>;
383 
384 		nand-ecc-strength = <4>;
385 		nand-bus-width = <8>;
386 		nand-ecc-step-size = <512>;
387 
388 		partitions {
389 			compatible = "fixed-partitions";
390 			#address-cells = <1>;
391 			#size-cells = <1>;
392 
393 			boot@0 {
394 				label = "RouterBoard NAND 1 Boot";
395 				reg = <0x0000000 0x0800000>;
396 			};
397 
398 			main@800000 {
399 				label = "RouterBoard NAND 1 Main";
400 				reg = <0x0800000 0x7800000>;
401 			};
402 		};
403 	};
404 };
405 
406 &qcom_pinmux {
407 	buttons_pins: buttons-state {
408 		pins = "gpio66";
409 		function = "gpio";
410 		drive-strength = <16>;
411 		bias-disable;
412 	};
413 
414 	leds_pins: leds-state {
415 		pins = "gpio33";
416 		function = "gpio";
417 		drive-strength = <16>;
418 		bias-disable;
419 	};
420 
421 	mdio1_pins: mdio1-state {
422 		pins = "gpio10", "gpio11";
423 		function = "gpio";
424 		drive-strength = <8>;
425 		bias-disable;
426 	};
427 
428 	sw0_reset_pin: sw0-reset-state {
429 		pins = "gpio16";
430 		drive-strength = <16>;
431 		function = "gpio";
432 		bias-disable;
433 		input-disable;
434 	};
435 
436 	sw1_reset_pin: sw1-reset-state {
437 		pins = "gpio17";
438 		drive-strength = <16>;
439 		function = "gpio";
440 		bias-disable;
441 		input-disable;
442 	};
443 
444 	usb1_pwr_en_pins: usb1-pwr-en-state {
445 		pins = "gpio4";
446 		function = "gpio";
447 		drive-strength = <16>;
448 		bias-disable;
449 		output-high;
450 	};
451 };
452 
453 &ss_phy_1 {
454 	status = "okay";
455 };
456 
457 &usb3_1 {
458 	pinctrl-0 = <&usb1_pwr_en_pins>;
459 	pinctrl-names = "default";
460 
461 	status = "okay";
462 };
463