1// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
2/*
3 * Copyright (c) 2022 FriendlyElec Computer Tech. Co., Ltd.
4 * (http://www.friendlyelec.com)
5 *
6 * Copyright (c) 2023 Tianling Shen <cnsztl@gmail.com>
7 */
8
9/dts-v1/;
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/leds/common.h>
13#include <dt-bindings/pinctrl/rockchip.h>
14#include <dt-bindings/soc/rockchip,vop2.h>
15#include "rk3568.dtsi"
16
17/ {
18	aliases {
19		mmc0 = &sdmmc0;
20		mmc1 = &sdhci;
21	};
22
23	chosen: chosen {
24		stdout-path = "serial2:1500000n8";
25	};
26
27	hdmi-con {
28		compatible = "hdmi-connector";
29		type = "a";
30
31		port {
32			hdmi_con_in: endpoint {
33				remote-endpoint = <&hdmi_out_con>;
34			};
35		};
36	};
37
38	vdd_usbc: vdd-usbc-regulator {
39		compatible = "regulator-fixed";
40		regulator-name = "vdd_usbc";
41		regulator-always-on;
42		regulator-boot-on;
43		regulator-min-microvolt = <5000000>;
44		regulator-max-microvolt = <5000000>;
45	};
46
47	vcc3v3_sys: vcc3v3-sys-regulator {
48		compatible = "regulator-fixed";
49		regulator-name = "vcc3v3_sys";
50		regulator-always-on;
51		regulator-boot-on;
52		regulator-min-microvolt = <3300000>;
53		regulator-max-microvolt = <3300000>;
54		vin-supply = <&vdd_usbc>;
55	};
56
57	vcc5v0_sys: vcc5v0-sys-regulator {
58		compatible = "regulator-fixed";
59		regulator-name = "vcc5v0_sys";
60		regulator-always-on;
61		regulator-boot-on;
62		regulator-min-microvolt = <5000000>;
63		regulator-max-microvolt = <5000000>;
64		vin-supply = <&vdd_usbc>;
65	};
66
67	vcc3v3_pcie: vcc3v3-pcie-regulator {
68		compatible = "regulator-fixed";
69		regulator-name = "vcc3v3_pcie";
70		regulator-min-microvolt = <3300000>;
71		regulator-max-microvolt = <3300000>;
72		enable-active-high;
73		gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
74		startup-delay-us = <200000>;
75		vin-supply = <&vcc5v0_sys>;
76	};
77
78	vcc5v0_usb: vcc5v0-usb-regulator {
79		compatible = "regulator-fixed";
80		regulator-name = "vcc5v0_usb";
81		regulator-always-on;
82		regulator-boot-on;
83		regulator-min-microvolt = <5000000>;
84		regulator-max-microvolt = <5000000>;
85		vin-supply = <&vdd_usbc>;
86	};
87
88	vcc5v0_usb_host: vcc5v0-usb-host-regulator {
89		compatible = "regulator-fixed";
90		enable-active-high;
91		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
92		pinctrl-names = "default";
93		pinctrl-0 = <&vcc5v0_usb_host_en>;
94		regulator-name = "vcc5v0_usb_host";
95		regulator-always-on;
96		regulator-boot-on;
97		regulator-min-microvolt = <5000000>;
98		regulator-max-microvolt = <5000000>;
99		vin-supply = <&vcc5v0_usb>;
100	};
101
102	vcc5v0_usb_otg: vcc5v0-usb-otg-regulator {
103		compatible = "regulator-fixed";
104		enable-active-high;
105		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
106		pinctrl-names = "default";
107		pinctrl-0 = <&vcc5v0_usb_otg_en>;
108		regulator-name = "vcc5v0_usb_otg";
109		regulator-min-microvolt = <5000000>;
110		regulator-max-microvolt = <5000000>;
111		vin-supply = <&vcc5v0_usb>;
112	};
113
114	pcie30_avdd0v9: pcie30-avdd0v9-regulator {
115		compatible = "regulator-fixed";
116		regulator-name = "pcie30_avdd0v9";
117		regulator-always-on;
118		regulator-boot-on;
119		regulator-min-microvolt = <900000>;
120		regulator-max-microvolt = <900000>;
121		vin-supply = <&vcc3v3_sys>;
122	};
123
124	pcie30_avdd1v8: pcie30-avdd1v8-regulator {
125		compatible = "regulator-fixed";
126		regulator-name = "pcie30_avdd1v8";
127		regulator-always-on;
128		regulator-boot-on;
129		regulator-min-microvolt = <1800000>;
130		regulator-max-microvolt = <1800000>;
131		vin-supply = <&vcc3v3_sys>;
132	};
133};
134
135&combphy0 {
136	status = "okay";
137};
138
139&combphy1 {
140	status = "okay";
141};
142
143&combphy2 {
144	status = "okay";
145};
146
147&cpu0 {
148	cpu-supply = <&vdd_cpu>;
149};
150
151&cpu1 {
152	cpu-supply = <&vdd_cpu>;
153};
154
155&cpu2 {
156	cpu-supply = <&vdd_cpu>;
157};
158
159&cpu3 {
160	cpu-supply = <&vdd_cpu>;
161};
162
163&gpu {
164	mali-supply = <&vdd_gpu>;
165	status = "okay";
166};
167
168&hdmi {
169	avdd-0v9-supply = <&vdda0v9_image>;
170	avdd-1v8-supply = <&vcca1v8_image>;
171	status = "okay";
172};
173
174&hdmi_in {
175	hdmi_in_vp0: endpoint {
176		remote-endpoint = <&vp0_out_hdmi>;
177	};
178};
179
180&hdmi_out {
181	hdmi_out_con: endpoint {
182		remote-endpoint = <&hdmi_con_in>;
183	};
184};
185
186&hdmi_sound {
187	status = "okay";
188};
189
190&i2c0 {
191	status = "okay";
192
193	vdd_cpu: regulator@1c {
194		compatible = "tcs,tcs4525";
195		reg = <0x1c>;
196		fcs,suspend-voltage-selector = <1>;
197		regulator-name = "vdd_cpu";
198		regulator-always-on;
199		regulator-boot-on;
200		regulator-min-microvolt = <800000>;
201		regulator-max-microvolt = <1150000>;
202		regulator-ramp-delay = <2300>;
203		vin-supply = <&vcc5v0_sys>;
204
205		regulator-state-mem {
206			regulator-off-in-suspend;
207		};
208	};
209
210	rk809: pmic@20 {
211		compatible = "rockchip,rk809";
212		reg = <0x20>;
213		interrupt-parent = <&gpio0>;
214		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
215		#clock-cells = <1>;
216		pinctrl-names = "default";
217		pinctrl-0 = <&pmic_int>;
218		rockchip,system-power-controller;
219		vcc1-supply = <&vcc3v3_sys>;
220		vcc2-supply = <&vcc3v3_sys>;
221		vcc3-supply = <&vcc3v3_sys>;
222		vcc4-supply = <&vcc3v3_sys>;
223		vcc5-supply = <&vcc3v3_sys>;
224		vcc6-supply = <&vcc3v3_sys>;
225		vcc7-supply = <&vcc3v3_sys>;
226		vcc8-supply = <&vcc3v3_sys>;
227		vcc9-supply = <&vcc3v3_sys>;
228		wakeup-source;
229
230		regulators {
231			vdd_logic: DCDC_REG1 {
232				regulator-name = "vdd_logic";
233				regulator-always-on;
234				regulator-boot-on;
235				regulator-init-microvolt = <900000>;
236				regulator-initial-mode = <0x2>;
237				regulator-min-microvolt = <500000>;
238				regulator-max-microvolt = <1350000>;
239				regulator-ramp-delay = <6001>;
240
241				regulator-state-mem {
242					regulator-off-in-suspend;
243				};
244			};
245
246			vdd_gpu: DCDC_REG2 {
247				regulator-name = "vdd_gpu";
248				regulator-always-on;
249				regulator-init-microvolt = <900000>;
250				regulator-initial-mode = <0x2>;
251				regulator-min-microvolt = <500000>;
252				regulator-max-microvolt = <1350000>;
253				regulator-ramp-delay = <6001>;
254
255				regulator-state-mem {
256					regulator-off-in-suspend;
257				};
258			};
259
260			vcc_ddr: DCDC_REG3 {
261				regulator-name = "vcc_ddr";
262				regulator-always-on;
263				regulator-boot-on;
264				regulator-initial-mode = <0x2>;
265
266				regulator-state-mem {
267					regulator-on-in-suspend;
268				};
269			};
270
271			vdd_npu: DCDC_REG4 {
272				regulator-name = "vdd_npu";
273				regulator-init-microvolt = <900000>;
274				regulator-initial-mode = <0x2>;
275				regulator-min-microvolt = <500000>;
276				regulator-max-microvolt = <1350000>;
277				regulator-ramp-delay = <6001>;
278
279				regulator-state-mem {
280					regulator-off-in-suspend;
281				};
282			};
283
284			vcc_1v8: DCDC_REG5 {
285				regulator-name = "vcc_1v8";
286				regulator-always-on;
287				regulator-boot-on;
288				regulator-min-microvolt = <1800000>;
289				regulator-max-microvolt = <1800000>;
290
291				regulator-state-mem {
292					regulator-off-in-suspend;
293				};
294			};
295
296			vdda0v9_image: LDO_REG1 {
297				regulator-name = "vdda0v9_image";
298				regulator-min-microvolt = <950000>;
299				regulator-max-microvolt = <950000>;
300
301				regulator-state-mem {
302					regulator-off-in-suspend;
303				};
304			};
305
306			vdda_0v9: LDO_REG2 {
307				regulator-name = "vdda_0v9";
308				regulator-always-on;
309				regulator-boot-on;
310				regulator-min-microvolt = <900000>;
311				regulator-max-microvolt = <900000>;
312
313				regulator-state-mem {
314					regulator-off-in-suspend;
315				};
316			};
317
318			vdda0v9_pmu: LDO_REG3 {
319				regulator-name = "vdda0v9_pmu";
320				regulator-always-on;
321				regulator-boot-on;
322				regulator-min-microvolt = <900000>;
323				regulator-max-microvolt = <900000>;
324
325				regulator-state-mem {
326					regulator-on-in-suspend;
327					regulator-suspend-microvolt = <900000>;
328				};
329			};
330
331			vccio_acodec: LDO_REG4 {
332				regulator-name = "vccio_acodec";
333				regulator-min-microvolt = <3300000>;
334				regulator-max-microvolt = <3300000>;
335
336				regulator-state-mem {
337					regulator-off-in-suspend;
338				};
339			};
340
341			vccio_sd: LDO_REG5 {
342				regulator-name = "vccio_sd";
343				regulator-min-microvolt = <1800000>;
344				regulator-max-microvolt = <3300000>;
345
346				regulator-state-mem {
347					regulator-off-in-suspend;
348				};
349			};
350
351			vcc3v3_pmu: LDO_REG6 {
352				regulator-name = "vcc3v3_pmu";
353				regulator-always-on;
354				regulator-boot-on;
355				regulator-min-microvolt = <3300000>;
356				regulator-max-microvolt = <3300000>;
357
358				regulator-state-mem {
359					regulator-on-in-suspend;
360					regulator-suspend-microvolt = <3300000>;
361				};
362			};
363
364			vcca_1v8: LDO_REG7 {
365				regulator-name = "vcca_1v8";
366				regulator-always-on;
367				regulator-boot-on;
368				regulator-min-microvolt = <1800000>;
369				regulator-max-microvolt = <1800000>;
370
371				regulator-state-mem {
372					regulator-off-in-suspend;
373				};
374			};
375
376			vcca1v8_pmu: LDO_REG8 {
377				regulator-name = "vcca1v8_pmu";
378				regulator-always-on;
379				regulator-boot-on;
380				regulator-min-microvolt = <1800000>;
381				regulator-max-microvolt = <1800000>;
382
383				regulator-state-mem {
384					regulator-on-in-suspend;
385					regulator-suspend-microvolt = <1800000>;
386				};
387			};
388
389			vcca1v8_image: LDO_REG9 {
390				regulator-name = "vcca1v8_image";
391				regulator-min-microvolt = <1800000>;
392				regulator-max-microvolt = <1800000>;
393
394				regulator-state-mem {
395					regulator-off-in-suspend;
396				};
397			};
398
399			vcc_3v3: SWITCH_REG1 {
400				regulator-name = "vcc_3v3";
401				regulator-always-on;
402				regulator-boot-on;
403
404				regulator-state-mem {
405					regulator-off-in-suspend;
406				};
407			};
408
409			vcc3v3_sd: SWITCH_REG2 {
410				regulator-name = "vcc3v3_sd";
411				regulator-always-on;
412				regulator-boot-on;
413
414				regulator-state-mem {
415					regulator-off-in-suspend;
416				};
417			};
418		};
419
420	};
421};
422
423&i2c5 {
424	status = "okay";
425
426	hym8563: rtc@51 {
427		compatible = "haoyu,hym8563";
428		reg = <0x51>;
429		interrupt-parent = <&gpio0>;
430		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
431		#clock-cells = <0>;
432		clock-output-names = "rtcic_32kout";
433		pinctrl-names = "default";
434		pinctrl-0 = <&hym8563_int>;
435		wakeup-source;
436	};
437};
438
439&i2s0_8ch {
440	status = "okay";
441};
442
443&pcie30phy {
444	data-lanes = <1 2>;
445	status = "okay";
446};
447
448&pinctrl {
449	hym8563 {
450		hym8563_int: hym8563-int {
451			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>;
452		};
453	};
454
455	pmic {
456		pmic_int: pmic-int {
457			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
458		};
459	};
460
461	usb {
462		vcc5v0_usb_host_en: vcc5v0-usb-host-en {
463			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
464		};
465
466		vcc5v0_usb_otg_en: vcc5v0-usb-otg-en {
467			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
468		};
469	};
470};
471
472&pmu_io_domains {
473	pmuio1-supply = <&vcc3v3_pmu>;
474	pmuio2-supply = <&vcc3v3_pmu>;
475	vccio1-supply = <&vccio_acodec>;
476	vccio3-supply = <&vccio_sd>;
477	vccio4-supply = <&vcc_1v8>;
478	vccio5-supply = <&vcc_3v3>;
479	vccio6-supply = <&vcc_1v8>;
480	vccio7-supply = <&vcc_3v3>;
481	status = "okay";
482};
483
484&saradc {
485	vref-supply = <&vcca_1v8>;
486	status = "okay";
487};
488
489&sdhci {
490	bus-width = <8>;
491	max-frequency = <200000000>;
492	non-removable;
493	pinctrl-names = "default";
494	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd>;
495	status = "okay";
496};
497
498&sdmmc0 {
499	max-frequency = <150000000>;
500	no-sdio;
501	no-mmc;
502	bus-width = <4>;
503	cap-mmc-highspeed;
504	cap-sd-highspeed;
505	disable-wp;
506	vmmc-supply = <&vcc3v3_sd>;
507	vqmmc-supply = <&vccio_sd>;
508	pinctrl-names = "default";
509	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
510	status = "okay";
511};
512
513&tsadc {
514	rockchip,hw-tshut-mode = <1>;
515	rockchip,hw-tshut-polarity = <0>;
516	status = "okay";
517};
518
519&uart2 {
520	status = "okay";
521};
522
523&usb_host0_ehci {
524	status = "okay";
525};
526
527&usb_host0_ohci {
528	status = "okay";
529};
530
531&usb_host0_xhci {
532	extcon = <&usb2phy0>;
533	dr_mode = "host";
534	status = "okay";
535};
536
537&usb_host1_ehci {
538	status = "okay";
539};
540
541&usb_host1_ohci {
542	status = "okay";
543};
544
545&usb_host1_xhci {
546	status = "okay";
547};
548
549&usb2phy0 {
550	status = "okay";
551};
552
553&usb2phy0_host {
554	phy-supply = <&vcc5v0_usb_host>;
555	status = "okay";
556};
557
558&usb2phy0_otg {
559	status = "okay";
560};
561
562&usb2phy1 {
563	status = "okay";
564};
565
566&usb2phy1_host {
567	phy-supply = <&vcc5v0_usb_otg>;
568	status = "okay";
569};
570
571&usb2phy1_otg {
572	status = "okay";
573};
574
575&vop {
576	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
577	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
578	status = "okay";
579};
580
581&vop_mmu {
582	status = "okay";
583};
584
585&vp0 {
586	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
587		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
588		remote-endpoint = <&hdmi_in_vp0>;
589	};
590};
591