1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/*
4 * Author: Piotr Oniszczuk piotr.oniszczuk@gmail.com
5 * Based on Quartz64 DT by: Peter Geis pgwipeout@gmail.com
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/leds/common.h>
12#include <dt-bindings/pinctrl/rockchip.h>
13#include <dt-bindings/soc/rockchip,vop2.h>
14#include "rk3566.dtsi"
15
16/ {
17	model = "Rockchip RK3566 BOX DEMO Board";
18	compatible = "rockchip,rk3566-box-demo", "rockchip,rk3566";
19
20	aliases {
21		ethernet0 = &gmac1;
22		mmc0 = &sdmmc0;
23		mmc1 = &sdmmc1;
24		mmc2 = &sdhci;
25	};
26
27	chosen: chosen {
28		stdout-path = "serial2:1500000n8";
29	};
30
31	gmac1_clkin: external-gmac1-clock {
32		compatible = "fixed-clock";
33		clock-frequency = <125000000>;
34		clock-output-names = "gmac1_clkin";
35		#clock-cells = <0>;
36	};
37
38	hdmi-con {
39		compatible = "hdmi-connector";
40		type = "a";
41
42		port {
43			hdmi_con_in: endpoint {
44				remote-endpoint = <&hdmi_out_con>;
45			};
46		};
47	};
48
49	ir-receiver {
50		compatible = "gpio-ir-receiver";
51		gpios = <&gpio4 RK_PC3 GPIO_ACTIVE_LOW>;
52		pinctrl-0 = <&ir_int>;
53		linux,rc-map-name = "rc-beelink-gs1";
54		status = "okay";
55	};
56
57	leds {
58		compatible = "gpio-leds";
59
60		led_work: led-0 {
61			gpios = <&gpio0 RK_PC3 GPIO_ACTIVE_HIGH>;
62			function = LED_FUNCTION_HEARTBEAT;
63			color = <LED_COLOR_ID_BLUE>;
64			linux,default-trigger = "heartbeat";
65			pinctrl-names = "default";
66			pinctrl-0 = <&led_work_en>;
67		};
68	};
69
70	sdio_pwrseq: sdio-pwrseq {
71		status = "okay";
72		compatible = "mmc-pwrseq-simple";
73		clocks = <&pmucru CLK_RTC_32K>;
74		clock-names = "ext_clock";
75		pinctrl-names = "default";
76		pinctrl-0 = <&wifi_enable_h &wifi_32k>;
77		reset-gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
78	};
79
80	spdif_dit: spdif-dit {
81		compatible = "linux,spdif-dit";
82		#sound-dai-cells = <0>;
83	};
84
85	spdif_sound: spdif-sound {
86		compatible = "simple-audio-card";
87		simple-audio-card,name = "SPDIF";
88
89		simple-audio-card,cpu {
90			sound-dai = <&spdif>;
91		};
92
93		simple-audio-card,codec {
94			sound-dai = <&spdif_dit>;
95		};
96	};
97
98	vcc12v0_dcin: regulator-vcc12v0-dcin {
99		compatible = "regulator-fixed";
100		regulator-name = "vcc12v0_dcin";
101		regulator-always-on;
102		regulator-boot-on;
103		regulator-min-microvolt = <12000000>;
104		regulator-max-microvolt = <12000000>;
105	};
106
107	vcc5v0_sys: regulator-vcc5v0-sys {
108		compatible = "regulator-fixed";
109		regulator-name = "vcc5v0_sys";
110		regulator-always-on;
111		regulator-boot-on;
112		regulator-min-microvolt = <5000000>;
113		regulator-max-microvolt = <5000000>;
114		vin-supply = <&vcc12v0_dcin>;
115	};
116
117	vcc3v3_sys: regulator-vcc3v3-sys {
118		compatible = "regulator-fixed";
119		regulator-name = "vcc3v3_sys";
120		regulator-always-on;
121		regulator-boot-on;
122		regulator-min-microvolt = <3300000>;
123		regulator-max-microvolt = <3300000>;
124		vin-supply = <&vcc12v0_dcin>;
125	};
126
127	vcc_3v3: regulator-vcc-3v3 {
128		compatible = "regulator-fixed";
129		regulator-name = "vcc_3v3";
130		regulator-always-on;
131		regulator-boot-on;
132		regulator-min-microvolt = <3300000>;
133		regulator-max-microvolt = <3300000>;
134		vin-supply = <&vcc3v3_sys>;
135	};
136
137	vcc5v0_usb_host: regulator-vcc5v0-usb-host {
138		compatible = "regulator-fixed";
139		enable-active-high;
140		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
141		pinctrl-names = "default";
142		pinctrl-0 = <&vcc5v0_usb_host_en>;
143		regulator-name = "vcc5v0_usb_host";
144		regulator-min-microvolt = <5000000>;
145		regulator-max-microvolt = <5000000>;
146		vin-supply = <&vcc5v0_sys>;
147	};
148
149	vcc5v0_usb2_otg: regulator-vcc5v0-usb2-otg {
150		compatible = "regulator-fixed";
151		enable-active-high;
152		gpio = <&gpio0 RK_PC6 GPIO_ACTIVE_HIGH>;
153		pinctrl-names = "default";
154		pinctrl-0 = <&vcc5v0_usb2_otg_en>;
155		regulator-name = "vcc5v0_usb_otg";
156		regulator-min-microvolt = <5000000>;
157		regulator-max-microvolt = <5000000>;
158		vin-supply = <&vcc5v0_sys>;
159	};
160
161	vcca_1v8: regulator-vcca-1v8 {
162		compatible = "regulator-fixed";
163		regulator-name = "vcca_1v8";
164		regulator-always-on;
165		regulator-boot-on;
166		regulator-min-microvolt = <1800000>;
167		regulator-max-microvolt = <1800000>;
168		vin-supply = <&vcc3v3_sys>;
169	};
170
171	vdda_0v9: regulator-vdda-0v9 {
172		compatible = "regulator-fixed";
173		regulator-name = "vdda_0v9";
174		regulator-always-on;
175		regulator-boot-on;
176		regulator-min-microvolt = <900000>;
177		regulator-max-microvolt = <900000>;
178		vin-supply = <&vcc3v3_sys>;
179	};
180
181	vdd_fixed: regulator-vdd-fixed {
182		compatible = "regulator-fixed";
183		regulator-name = "vdd_fixed";
184		regulator-min-microvolt = <950000>;
185		regulator-max-microvolt = <950000>;
186		regulator-always-on;
187		regulator-boot-on;
188		vin-supply = <&vcc5v0_sys>;
189	};
190
191	vdd_cpu: regulator-vdd-cpu {
192		compatible = "pwm-regulator";
193		pwms = <&pwm0 0 5000 1>;
194		regulator-name = "vdd_cpu";
195		regulator-min-microvolt = <800000>;
196		regulator-max-microvolt = <1200000>;
197		regulator-always-on;
198		regulator-boot-on;
199		regulator-settling-time-up-us = <250>;
200		pwm-supply = <&vcc5v0_sys>;
201	};
202
203	vdd_logic: regulator-vdd-logic {
204		compatible = "pwm-regulator";
205		pwms = <&pwm1 0 5000 1>;
206		regulator-name = "vdd_logic";
207		regulator-min-microvolt = <800000>;
208		regulator-max-microvolt = <1100000>;
209		regulator-always-on;
210		regulator-boot-on;
211		regulator-settling-time-up-us = <250>;
212		pwm-supply = <&vcc5v0_sys>;
213	};
214};
215
216&combphy1 {
217	status = "okay";
218};
219
220&combphy2 {
221	status = "okay";
222};
223
224&cpu0 {
225	cpu-supply = <&vdd_cpu>;
226};
227
228&cpu1 {
229	cpu-supply = <&vdd_cpu>;
230};
231
232&cpu2 {
233	cpu-supply = <&vdd_cpu>;
234};
235
236&cpu3 {
237	cpu-supply = <&vdd_cpu>;
238};
239
240&gmac1 {
241	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
242	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>;
243	phy-mode = "rgmii";
244	clock_in_out = "input";
245	pinctrl-names = "default";
246	pinctrl-0 = <&gmac1m1_miim
247		    &gmac1m1_tx_bus2
248		    &gmac1m1_rx_bus2
249		    &gmac1m1_rgmii_clk
250		    &gmac1m1_rgmii_bus
251		    &gmac1m1_clkinout>;
252	snps,reset-gpio = <&gpio4 RK_PC2 GPIO_ACTIVE_LOW>;
253	snps,reset-active-low;
254	/* Reset time is 20ms, 100ms for rtl8211f */
255	snps,reset-delays-us = <0 20000 100000>;
256
257	tx_delay = <0x4f>;
258	rx_delay = <0x2d>;
259	phy-handle = <&rgmii_phy1>;
260	status = "okay";
261};
262
263&mdio1 {
264	rgmii_phy1: ethernet-phy@1 {
265		compatible = "ethernet-phy-ieee802.3-c22";
266		reg = <0x1>;
267	};
268};
269
270&hdmi {
271	assigned-clocks = <&cru CLK_HDMI_CEC>;
272	assigned-clock-rates = <32768>;
273	avdd-0v9-supply = <&vdda_0v9>;
274	avdd-1v8-supply = <&vcca_1v8>;
275	status = "okay";
276};
277
278&hdmi_in {
279	hdmi_in_vp0: endpoint {
280		remote-endpoint = <&vp0_out_hdmi>;
281	};
282};
283
284&hdmi_out {
285	hdmi_out_con: endpoint {
286		remote-endpoint = <&hdmi_con_in>;
287	};
288};
289
290&hdmi_sound {
291	status = "okay";
292};
293
294&gpu {
295	status = "okay";
296};
297
298&i2s0_8ch {
299	status = "okay";
300};
301
302&i2s1_8ch {
303	rockchip,trcm-sync-tx-only;
304	status = "okay";
305};
306
307&pinctrl {
308	bt {
309		bt_enable_h: bt-enable-h {
310			rockchip,pins = <2 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
311		};
312
313		bt_host_wake_l: bt-host-wake-l {
314			rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_down>;
315		};
316
317		bt_wake_l: bt-wake-l {
318			rockchip,pins = <2 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
319		};
320	};
321
322	sdio-pwrseq {
323		wifi_enable_h: wifi-enable-h {
324			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
325		};
326
327		wifi_host_wake_h: wifi-host-wake-l {
328			rockchip,pins = <2 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
329		};
330
331		wifi_32k: wifi-32k {
332			rockchip,pins = <2 RK_PC6 1 &pcfg_pull_none>;
333		};
334	};
335
336	usb {
337		vcc5v0_usb_host_en: vcc5v0_usb_host_en {
338			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
339		};
340
341		vcc5v0_usb2_otg_en: vcc5v0_usb2_otg_en {
342			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
343		};
344
345	};
346
347	ir {
348		ir_int: ir-int {
349			rockchip,pins = <4 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
350		};
351	};
352
353	led {
354		led_work_en: led_work_en {
355			rockchip,pins = <0 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
356		};
357	};
358};
359
360&pmu_io_domains {
361	pmuio2-supply = <&vcc_3v3>;
362	vccio1-supply = <&vcc_3v3>;
363	vccio3-supply = <&vcc_3v3>;
364	vccio4-supply = <&vcca_1v8>;
365	vccio5-supply = <&vcc_3v3>;
366	vccio6-supply = <&vcca_1v8>;
367	vccio7-supply = <&vcc_3v3>;
368	status = "okay";
369};
370
371&pwm0 {
372	status = "okay";
373};
374
375&pwm1 {
376	status = "okay";
377};
378
379&sdhci {
380	bus-width = <8>;
381	mmc-hs200-1_8v;
382	non-removable;
383	status = "okay";
384};
385
386&sdmmc0 {
387	bus-width = <4>;
388	cap-sd-highspeed;
389	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
390	disable-wp;
391	pinctrl-names = "default";
392	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
393	vmmc-supply = <&vcc_3v3>;
394	status = "okay";
395};
396
397&sdmmc1 {
398	/* WiFi & BT combo module AMPAK AP6398S */
399	#address-cells = <1>;
400	#size-cells = <0>;
401	bus-width = <4>;
402	clock-frequency = <150000000>;
403	cap-sdio-irq;
404	cap-sd-highspeed;
405	sd-uhs-sdr104;
406	keep-power-in-suspend;
407	mmc-pwrseq = <&sdio_pwrseq>;
408	non-removable;
409	pinctrl-names = "default";
410	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
411	vmmc-supply = <&vcc_3v3>;
412	vqmmc-supply = <&vcca_1v8>;
413	status = "okay";
414
415	brcmf: wifi@1 {
416		compatible = "brcm,bcm4329-fmac";
417		reg = <1>;
418		interrupt-parent = <&gpio2>;
419		interrupts = <RK_PB2 IRQ_TYPE_LEVEL_HIGH>;
420		interrupt-names = "host-wake";
421		pinctrl-names = "default";
422		pinctrl-0 = <&wifi_host_wake_h>;
423	};
424};
425
426&spdif {
427	status = "okay";
428};
429
430&spi1 {
431	pinctrl-names = "default";
432	pinctrl-0 = <&spi1m1_cs0 &spi1m1_pins>;
433};
434
435&tsadc {
436	/* tshut mode 0:CRU 1:GPIO */
437	rockchip,hw-tshut-mode = <1>;
438	/* tshut polarity 0:LOW 1:HIGH */
439	rockchip,hw-tshut-polarity = <0>;
440	status = "okay";
441};
442
443&uart1 {
444	pinctrl-names = "default";
445	pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn>;
446	status = "okay";
447	uart-has-rtscts;
448
449	bluetooth {
450		compatible = "brcm,bcm43438-bt";
451		clocks = <&pmucru CLK_RTC_32K>;
452		clock-names = "ext_clock";
453		device-wake-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>;
454		host-wake-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;
455		shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
456		pinctrl-names = "default";
457		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
458		vbat-supply = <&vcc3v3_sys>;
459		vddio-supply = <&vcca_1v8>;
460	};
461};
462
463&uart2 {
464	status = "okay";
465};
466
467&vop {
468	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
469	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
470	status = "okay";
471};
472
473&vop_mmu {
474	status = "okay";
475};
476
477&vp0 {
478	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
479		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
480		remote-endpoint = <&hdmi_in_vp0>;
481	};
482};
483
484&vpu {
485	status = "okay";
486};
487
488&vdpu_mmu {
489	status = "okay";
490};
491
492&usb2phy0_host {
493	phy-supply = <&vcc5v0_usb_host>;
494	status = "okay";
495};
496
497&usb2phy0_otg {
498	phy-supply = <&vcc5v0_usb2_otg>;
499	status = "okay";
500};
501
502&usb2phy1_host {
503	phy-supply = <&vcc5v0_usb_host>;
504	status = "okay";
505};
506
507&usb2phy1_otg {
508	phy-supply = <&vcc5v0_usb_host>;
509	status = "okay";
510};
511
512&usb2phy1 {
513	status = "okay";
514};
515
516&usb_host0_ehci {
517	status = "okay";
518};
519
520&usb_host0_ohci {
521	status = "okay";
522};
523
524&usb_host1_ehci {
525	status = "okay";
526};
527
528&usb_host1_ohci {
529	status = "okay";
530};
531
532&usb_host1_xhci {
533	status = "okay";
534};
535