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_32k: wifi-32k {
328			rockchip,pins = <0 RK_PB0 2 &pcfg_pull_none>;
329		};
330	};
331
332	usb {
333		vcc5v0_usb_host_en: vcc5v0_usb_host_en {
334			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
335		};
336
337		vcc5v0_usb2_otg_en: vcc5v0_usb2_otg_en {
338			rockchip,pins = <0 RK_PC6 RK_FUNC_GPIO &pcfg_pull_none>;
339		};
340
341	};
342
343	ir {
344		ir_int: ir-int {
345			rockchip,pins = <4 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
346		};
347	};
348
349	led {
350		led_work_en: led_work_en {
351			rockchip,pins = <0 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
352		};
353	};
354};
355
356&pwm0 {
357	status = "okay";
358};
359
360&pwm1 {
361	status = "okay";
362};
363
364&sdhci {
365	bus-width = <8>;
366	mmc-hs200-1_8v;
367	non-removable;
368	status = "okay";
369};
370
371&sdmmc0 {
372	bus-width = <4>;
373	cap-sd-highspeed;
374	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
375	disable-wp;
376	pinctrl-names = "default";
377	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
378	vmmc-supply = <&vcc_3v3>;
379	status = "okay";
380};
381
382&sdmmc1 {
383	bus-width = <4>;
384	cap-sd-highspeed;
385	disable-wp;
386	mmc-pwrseq = <&sdio_pwrseq>;
387	non-removable;
388	pinctrl-names = "default";
389	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk>;
390	vmmc-supply = <&vcc_3v3>;
391	vqmmc-supply = <&vcca_1v8>;
392	status = "okay";
393};
394
395&spdif {
396	status = "okay";
397};
398
399&spi1 {
400	pinctrl-names = "default";
401	pinctrl-0 = <&spi1m1_cs0 &spi1m1_pins>;
402};
403
404&tsadc {
405	/* tshut mode 0:CRU 1:GPIO */
406	rockchip,hw-tshut-mode = <1>;
407	/* tshut polarity 0:LOW 1:HIGH */
408	rockchip,hw-tshut-polarity = <0>;
409	status = "okay";
410};
411
412&uart1 {
413	pinctrl-names = "default";
414	pinctrl-0 = <&uart1m0_xfer &uart1m0_ctsn>;
415	status = "okay";
416	uart-has-rtscts;
417
418	bluetooth {
419		compatible = "brcm,bcm43438-bt";
420		clocks = <&pmucru CLK_RTC_32K>;
421		clock-names = "ext_clock";
422		device-wake-gpios = <&gpio2 RK_PC1 GPIO_ACTIVE_HIGH>;
423		host-wake-gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;
424		shutdown-gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
425		pinctrl-names = "default";
426		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
427		vbat-supply = <&vcc3v3_sys>;
428		vddio-supply = <&vcca_1v8>;
429	};
430};
431
432&uart2 {
433	status = "okay";
434};
435
436&vop {
437	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
438	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
439	status = "okay";
440};
441
442&vop_mmu {
443	status = "okay";
444};
445
446&vp0 {
447	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
448		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
449		remote-endpoint = <&hdmi_in_vp0>;
450	};
451};
452
453&vpu {
454	status = "okay";
455};
456
457&vdpu_mmu {
458	status = "okay";
459};
460
461&usb2phy0_host {
462	phy-supply = <&vcc5v0_usb_host>;
463	status = "okay";
464};
465
466&usb2phy0_otg {
467	vbus-supply = <&vcc5v0_usb2_otg>;
468	status = "okay";
469};
470
471&usb2phy1_host {
472	phy-supply = <&vcc5v0_usb_host>;
473	status = "okay";
474};
475
476&usb2phy1_otg {
477	phy-supply = <&vcc5v0_usb_host>;
478	status = "okay";
479};
480
481&usb2phy1 {
482	status = "okay";
483};
484
485&usb_host0_ehci {
486	status = "okay";
487};
488
489&usb_host0_ohci {
490	status = "okay";
491};
492
493&usb_host1_ehci {
494	status = "okay";
495};
496
497&usb_host1_ohci {
498	status = "okay";
499};
500
501&usb_host1_xhci {
502	status = "okay";
503};
504