1// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2
3#include "qcom-ipq4019.dtsi"
4#include "qcom-ipq4019-ethernet.dtsi"
5
6#include <dt-bindings/gpio/gpio.h>
7#include <dt-bindings/input/input.h>
8#include <dt-bindings/soc/qcom,tcsr.h>
9
10/ {
11	model = "ASUS RT-AC58U";
12	compatible = "asus,rt-ac58u";
13
14	memory {
15		device_type = "memory";
16		reg = <0x80000000 0x8000000>;
17	};
18
19	aliases {
20		led-boot = &led_power;
21		led-failsafe = &led_power;
22		led-running = &led_power;
23		led-upgrade = &led_power;
24		serial0 = &blsp1_uart1;
25	};
26
27	chosen {
28		bootargs-append = " ubi.mtd=UBI_DEV";
29//		stdout-path = "serial0:115200n8";
30		stdout-path = "serial0";
31	};
32
33	soc {
34		rng@22000 {
35			status = "okay";
36		};
37
38		mdio@90000 {
39			status = "okay";
40		};
41
42		ess-psgmii@98000 {
43			status = "okay";
44		};
45
46		tcsr@1949000 {
47			compatible = "qcom,tcsr";
48			reg = <0x1949000 0x100>;
49			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
50		};
51
52		tcsr@194b000 {
53			compatible = "qcom,tcsr";
54			reg = <0x194b000 0x100>;
55			qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
56		};
57
58		ess_tcsr@1953000 {
59			compatible = "qcom,tcsr";
60			reg = <0x1953000 0x1000>;
61			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
62		};
63
64		tcsr@1957000 {
65			compatible = "qcom,tcsr";
66			reg = <0x1957000 0x100>;
67			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
68		};
69
70		usb3@8af8800 {
71			status = "okay";
72
73			dwc3@8a00000 {
74				#address-cells = <1>;
75				#size-cells = <0>;
76
77				usb3_port1: port@1 {
78					reg = <1>;
79					#trigger-source-cells = <0>;
80				};
81
82				usb3_port2: port@2 {
83					reg = <2>;
84					#trigger-source-cells = <0>;
85				};
86			};
87		};
88
89		crypto@8e3a000 {
90			status = "okay";
91		};
92
93		watchdog@b017000 {
94			status = "okay";
95		};
96
97		ess-switch@c000000 {
98			status = "okay";
99		};
100
101		edma@c080000 {
102			status = "okay";
103		};
104	};
105
106	keys {
107		compatible = "gpio-keys";
108
109		reset {
110			label = "reset";
111			gpios = <&tlmm 4 GPIO_ACTIVE_LOW>;
112			linux,code = <KEY_RESTART>;
113		};
114
115		wps {
116			label = "wps";
117			gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
118			linux,code = <KEY_WPS_BUTTON>;
119		};
120	};
121
122	leds {
123		compatible = "gpio-leds";
124
125		led_power: status {
126			label = "blue:status";
127			gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
128		};
129
130		wan {
131			label = "blue:wan";
132			gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>;
133		};
134
135		wlan2G {
136			label = "blue:wlan2G";
137			gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
138			linux,default-trigger = "phy0tpt";
139		};
140
141		wlan5G {
142			label = "blue:wlan5G";
143			gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>;
144			linux,default-trigger = "phy1tpt";
145		};
146
147		usb {
148			label = "blue:usb";
149			gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
150			trigger-sources = <&usb3_port1>, <&usb3_port2>;
151			linux,default-trigger = "usbport";
152		};
153
154		lan {
155			label = "blue:lan";
156			gpios = <&tlmm 2 GPIO_ACTIVE_HIGH>;
157		};
158	};
159};
160
161&cryptobam {
162	status = "okay";
163};
164
165&blsp_dma {
166	status = "okay";
167};
168
169&tlmm {
170	serial_pins: serial_pinmux {
171		mux {
172			pins = "gpio60", "gpio61";
173			function = "blsp_uart0";
174			bias-disable;
175		};
176	};
177
178	spi_0_pins: spi_0_pinmux {
179		mux {
180			function = "blsp_spi0";
181			pins = "gpio55", "gpio56", "gpio57";
182			drive-strength = <12>;
183			bias-disable;
184		};
185
186		mux_cs {
187			function = "gpio";
188			pins = "gpio54", "gpio59";
189			drive-strength = <2>;
190			bias-disable;
191			output-high;
192		};
193	};
194};
195
196&blsp1_spi1 { /* BLSP1 QUP1 */
197	pinctrl-0 = <&spi_0_pins>;
198	pinctrl-names = "default";
199	status = "okay";
200	cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>,
201		   <&tlmm 59 GPIO_ACTIVE_HIGH>;
202
203	flash@0 {
204		/*
205		 * U-boot looks for "n25q128a11" node,
206		 * if we don't have it, it will spit out the following warning:
207		 * "ipq: fdt fixup unable to find compatible node".
208		 */
209		compatible = "jedec,spi-nor";
210		reg = <0>;
211		linux,modalias = "m25p80", "mx25l1606e", "n25q128a11";
212		spi-max-frequency = <30000000>;
213
214		partitions {
215			compatible = "fixed-partitions";
216			#address-cells = <1>;
217			#size-cells = <1>;
218
219			partition@0 {
220				label = "SBL1";
221				reg = <0x00000000 0x00040000>;
222				read-only;
223			};
224			partition@40000 {
225				label = "MIBIB";
226				reg = <0x00040000 0x00020000>;
227				read-only;
228			};
229			partition@60000 {
230				label = "QSEE";
231				reg = <0x00060000 0x00060000>;
232				read-only;
233			};
234			partition@c0000 {
235				label = "CDT";
236				reg = <0x000c0000 0x00010000>;
237				read-only;
238			};
239			partition@d0000 {
240				label = "DDRPARAMS";
241				reg = <0x000d0000 0x00010000>;
242				read-only;
243			};
244			partition@e0000 {
245				label = "APPSBLENV"; /* uboot env*/
246				reg = <0x000e0000 0x00010000>;
247				read-only;
248			};
249			partition@f0000 {
250				label = "APPSBL"; /* uboot */
251				reg = <0x000f0000 0x00080000>;
252				read-only;
253			};
254			partition@170000 {
255				label = "ART";
256				reg = <0x00170000 0x00010000>;
257				read-only;
258			};
259			/* 0x00180000 - 0x00200000 unused */
260		};
261	};
262
263	spi-nand@1 {
264		compatible = "spi-nand";
265		reg = <1>;
266		spi-max-frequency = <30000000>;
267
268		/*
269		 * U-boot looks for "spinand,mt29f" node,
270		 * if we don't have it, it will spit out the following warning:
271		 * "ipq: fdt fixup unable to find compatible node".
272		 */
273
274		partitions {
275			compatible = "fixed-partitions";
276			#address-cells = <1>;
277			#size-cells = <1>;
278
279			partition@0 {
280				/*
281				 * TODO: change to label = "ubi" once we drop 4.14.
282				 *       also drop the bootargs-append and all the
283				 *	 userspace CI_UBIPART="UBI_DEV" remains.
284				 */
285				label = "UBI_DEV";
286				reg = <0x00000000 0x08000000>;
287			};
288		};
289	};
290};
291
292&blsp1_uart1 {
293	pinctrl-0 = <&serial_pins>;
294	pinctrl-names = "default";
295	status = "okay";
296};
297
298&usb3_ss_phy {
299	status = "okay";
300};
301
302&usb3_hs_phy {
303	status = "okay";
304};
305
306&wifi0 {
307	status = "okay";
308	qcom,ath10k-calibration-variant = "RT-AC58U";
309};
310
311&wifi1 {
312	status = "okay";
313	qcom,ath10k-calibration-variant = "RT-AC58U";
314};
315