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";
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	memory@42000000 {
24		reg = <0x42000000 0x3e000000>;
25		device_type = "memory";
26	};
27
28	mdio0: mdio-0 {
29		status = "okay";
30		compatible = "virtual,mdio-gpio";
31		gpios = <&qcom_pinmux 1 GPIO_ACTIVE_HIGH>,
32			<&qcom_pinmux 0 GPIO_ACTIVE_HIGH>;
33		#address-cells = <1>;
34		#size-cells = <0>;
35
36		pinctrl-0 = <&mdio0_pins>;
37		pinctrl-names = "default";
38
39		switch0: switch@10 {
40			compatible = "qca,qca8337";
41			#address-cells = <1>;
42			#size-cells = <0>;
43
44			dsa,member = <0 0>;
45
46			pinctrl-0 = <&sw0_reset_pin>;
47			pinctrl-names = "default";
48
49			reset-gpios = <&qcom_pinmux 16 GPIO_ACTIVE_LOW>;
50			reg = <0x10>;
51
52			ports {
53				#address-cells = <1>;
54				#size-cells = <0>;
55
56				switch0cpu: port@0 {
57					reg = <0>;
58					label = "cpu";
59					ethernet = <&gmac0>;
60					phy-mode = "rgmii-id";
61					fixed-link {
62						speed = <1000>;
63						full-duplex;
64					};
65				};
66
67				port@1 {
68					reg = <1>;
69					label = "sw1";
70				};
71
72				port@2 {
73					reg = <2>;
74					label = "sw2";
75				};
76
77				port@3 {
78					reg = <3>;
79					label = "sw3";
80				};
81
82				port@4 {
83					reg = <4>;
84					label = "sw4";
85				};
86
87				port@5 {
88					reg = <5>;
89					label = "sw5";
90				};
91			};
92		};
93	};
94
95	mdio1: mdio-1 {
96		status = "okay";
97		compatible = "virtual,mdio-gpio";
98		gpios = <&qcom_pinmux 11 GPIO_ACTIVE_HIGH>,
99			<&qcom_pinmux 10 GPIO_ACTIVE_HIGH>;
100		#address-cells = <1>;
101		#size-cells = <0>;
102
103		pinctrl-0 = <&mdio1_pins>;
104		pinctrl-names = "default";
105
106		switch1: switch@14 {
107			compatible = "qca,qca8337";
108			#address-cells = <1>;
109			#size-cells = <0>;
110
111			dsa,member = <1 0>;
112
113			pinctrl-0 = <&sw1_reset_pin>;
114			pinctrl-names = "default";
115
116			reset-gpios = <&qcom_pinmux 17 GPIO_ACTIVE_LOW>;
117			reg = <0x10>;
118
119			ports {
120				#address-cells = <1>;
121				#size-cells = <0>;
122
123				switch1cpu: port@0 {
124					reg = <0>;
125					label = "cpu";
126					ethernet = <&gmac3>;
127					phy-mode = "sgmii";
128					fixed-link {
129						speed = <1000>;
130						full-duplex;
131					};
132				};
133
134				port@1 {
135					reg = <1>;
136					label = "sw6";
137				};
138
139				port@2 {
140					reg = <2>;
141					label = "sw7";
142				};
143
144				port@3 {
145					reg = <3>;
146					label = "sw8";
147				};
148
149				port@4 {
150					reg = <4>;
151					label = "sw9";
152				};
153
154				port@5 {
155					reg = <5>;
156					label = "sw10";
157				};
158			};
159		};
160	};
161
162	soc {
163		gsbi5: gsbi@1a200000 {
164			qcom,mode = <GSBI_PROT_SPI>;
165			status = "okay";
166
167			spi4: spi@1a280000 {
168				status = "okay";
169				spi-max-frequency = <50000000>;
170
171				pinctrl-0 = <&spi_pins>;
172				pinctrl-names = "default";
173
174				cs-gpios = <&qcom_pinmux 20 GPIO_ACTIVE_HIGH>;
175
176				norflash: flash@0 {
177					compatible = "jedec,spi-nor";
178					#address-cells = <1>;
179					#size-cells = <1>;
180					spi-max-frequency = <50000000>;
181					reg = <0>;
182
183					partition@0 {
184						label = "RouterBoot";
185						reg = <0x0 0x40000>;
186					};
187				};
188			};
189		};
190
191		gpio-keys {
192			compatible = "gpio-keys";
193			pinctrl-0 = <&buttons_pins>;
194			pinctrl-names = "default";
195
196			button {
197				label = "reset";
198				linux,code = <KEY_RESTART>;
199				gpios = <&qcom_pinmux 66 GPIO_ACTIVE_LOW>;
200				linux,input-type = <1>;
201				debounce-interval = <60>;
202			};
203		};
204
205		leds {
206			compatible = "gpio-leds";
207			pinctrl-0 = <&leds_pins>;
208			pinctrl-names = "default";
209
210			led@7 {
211				label = "rb3011:green:user";
212				color = <LED_COLOR_ID_GREEN>;
213				gpios = <&qcom_pinmux 33 GPIO_ACTIVE_HIGH>;
214				default-state = "off";
215			};
216		};
217
218	};
219};
220
221&adm_dma {
222	status = "okay";
223};
224
225&gmac0 {
226	status = "okay";
227
228	phy-mode = "rgmii";
229	qcom,id = <0>;
230	phy-handle = <&switch0cpu>;
231
232	fixed-link {
233		speed = <1000>;
234		full-duplex;
235	};
236};
237
238&gmac3 {
239	status = "okay";
240
241	phy-mode = "sgmii";
242	qcom,id = <3>;
243	phy-handle = <&switch1cpu>;
244
245	fixed-link {
246		speed = <1000>;
247		full-duplex;
248	};
249};
250
251&gsbi7 {
252	status = "okay";
253	qcom,mode = <GSBI_PROT_I2C_UART>;
254};
255
256&gsbi7_serial {
257	status = "okay";
258};
259
260&hs_phy_1 {
261	status = "okay";
262};
263
264&nand {
265	status = "okay";
266
267	nandcs@0 {
268		compatible = "qcom,nandcs";
269		reg = <0>;
270
271		nand-ecc-strength = <4>;
272		nand-bus-width = <8>;
273		nand-ecc-step-size = <512>;
274
275		partitions {
276			compatible = "fixed-partitions";
277			#address-cells = <1>;
278			#size-cells = <1>;
279
280			boot@0 {
281				label = "RouterBoard NAND 1 Boot";
282				reg = <0x0000000 0x0800000>;
283			};
284
285			main@800000 {
286				label = "RouterBoard NAND 1 Main";
287				reg = <0x0800000 0x7800000>;
288			};
289		};
290	};
291};
292
293&qcom_pinmux {
294	buttons_pins: buttons_pins {
295		mux {
296			pins = "gpio66";
297			drive-strength = <16>;
298			bias-disable;
299		};
300	};
301
302	leds_pins: leds_pins {
303		mux {
304			pins = "gpio33";
305			drive-strength = <16>;
306			bias-disable;
307		};
308	};
309
310	mdio1_pins: mdio1_pins {
311		mux {
312			pins = "gpio10", "gpio11";
313			function = "gpio";
314			drive-strength = <8>;
315			bias-disable;
316		};
317	};
318
319	sw0_reset_pin: sw0_reset_pin {
320		mux {
321			pins = "gpio16";
322			drive-strength = <16>;
323			function = "gpio";
324			bias-disable;
325			input-disable;
326		};
327	};
328
329	sw1_reset_pin: sw1_reset_pin {
330		mux {
331			pins = "gpio17";
332			drive-strength = <16>;
333			function = "gpio";
334			bias-disable;
335			input-disable;
336		};
337	};
338
339	usb1_pwr_en_pins: usb1_pwr_en_pins {
340		mux {
341			pins = "gpio4";
342			function = "gpio";
343			drive-strength = <16>;
344			bias-disable;
345			output-high;
346		};
347	};
348};
349
350&ss_phy_1 {
351	status = "okay";
352};
353
354&usb3_1 {
355	pinctrl-0 = <&usb1_pwr_en_pins>;
356	pinctrl-names = "default";
357
358	status = "okay";
359};
360