1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4#include <dt-bindings/gpio/gpio.h>
5#include <dt-bindings/leds/common.h>
6#include <dt-bindings/pinctrl/rockchip.h>
7#include <dt-bindings/soc/rockchip,vop2.h>
8#include "rk3568.dtsi"
9
10/ {
11	model = "Radxa ROCK3 Model A";
12	compatible = "radxa,rock3a", "rockchip,rk3568";
13
14	aliases {
15		ethernet0 = &gmac1;
16		mmc0 = &sdmmc0;
17		mmc1 = &sdhci;
18	};
19
20	chosen: chosen {
21		stdout-path = "serial2:1500000n8";
22	};
23
24	hdmi-con {
25		compatible = "hdmi-connector";
26		type = "a";
27
28		port {
29			hdmi_con_in: endpoint {
30				remote-endpoint = <&hdmi_out_con>;
31			};
32		};
33	};
34
35	leds {
36		compatible = "gpio-leds";
37
38		led_user: led-0 {
39			gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
40			function = LED_FUNCTION_HEARTBEAT;
41			color = <LED_COLOR_ID_BLUE>;
42			linux,default-trigger = "heartbeat";
43			pinctrl-names = "default";
44			pinctrl-0 = <&led_user_en>;
45		};
46	};
47
48	rk809-sound {
49		compatible = "simple-audio-card";
50		simple-audio-card,format = "i2s";
51		simple-audio-card,name = "Analog RK809";
52		simple-audio-card,mclk-fs = <256>;
53
54		simple-audio-card,cpu {
55			sound-dai = <&i2s1_8ch>;
56		};
57
58		simple-audio-card,codec {
59			sound-dai = <&rk809>;
60		};
61	};
62
63	vcc12v_dcin: vcc12v-dcin {
64		compatible = "regulator-fixed";
65		regulator-name = "vcc12v_dcin";
66		regulator-always-on;
67		regulator-boot-on;
68	};
69
70	vcc3v3_pcie: vcc3v3-pcie-regulator {
71		compatible = "regulator-fixed";
72		enable-active-high;
73		gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_HIGH>;
74		pinctrl-names = "default";
75		pinctrl-0 = <&pcie_enable_h>;
76		regulator-name = "vcc3v3_pcie";
77		regulator-min-microvolt = <3300000>;
78		regulator-max-microvolt = <3300000>;
79		vin-supply = <&vcc5v0_sys>;
80	};
81
82	vcc3v3_sys: vcc3v3-sys {
83		compatible = "regulator-fixed";
84		regulator-name = "vcc3v3_sys";
85		regulator-always-on;
86		regulator-boot-on;
87		regulator-min-microvolt = <3300000>;
88		regulator-max-microvolt = <3300000>;
89		vin-supply = <&vcc12v_dcin>;
90	};
91
92	vcc5v0_sys: vcc5v0-sys {
93		compatible = "regulator-fixed";
94		regulator-name = "vcc5v0_sys";
95		regulator-always-on;
96		regulator-boot-on;
97		regulator-min-microvolt = <5000000>;
98		regulator-max-microvolt = <5000000>;
99		vin-supply = <&vcc12v_dcin>;
100	};
101
102	vcc5v0_usb: vcc5v0-usb {
103		compatible = "regulator-fixed";
104		regulator-name = "vcc5v0_usb";
105		regulator-always-on;
106		regulator-boot-on;
107		regulator-min-microvolt = <5000000>;
108		regulator-max-microvolt = <5000000>;
109		vin-supply = <&vcc12v_dcin>;
110	};
111
112	vcc5v0_usb_host: vcc5v0-usb-host {
113		compatible = "regulator-fixed";
114		enable-active-high;
115		gpio = <&gpio0 RK_PA6 GPIO_ACTIVE_HIGH>;
116		pinctrl-names = "default";
117		pinctrl-0 = <&vcc5v0_usb_host_en>;
118		regulator-name = "vcc5v0_usb_host";
119		regulator-min-microvolt = <5000000>;
120		regulator-max-microvolt = <5000000>;
121		vin-supply = <&vcc5v0_usb>;
122	};
123
124	vcc5v0_usb_hub: vcc5v0-usb-hub-regulator {
125		compatible = "regulator-fixed";
126		enable-active-high;
127		gpio = <&gpio0 RK_PD5 GPIO_ACTIVE_HIGH>;
128		pinctrl-names = "default";
129		pinctrl-0 = <&vcc5v0_usb_hub_en>;
130		regulator-name = "vcc5v0_usb_hub";
131		regulator-always-on;
132		vin-supply = <&vcc5v0_usb>;
133	};
134
135	vcc5v0_usb_otg: vcc5v0-usb-otg-regulator {
136		compatible = "regulator-fixed";
137		enable-active-high;
138		gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_HIGH>;
139		pinctrl-names = "default";
140		pinctrl-0 = <&vcc5v0_usb_otg_en>;
141		regulator-name = "vcc5v0_usb_otg";
142		regulator-min-microvolt = <5000000>;
143		regulator-max-microvolt = <5000000>;
144		vin-supply = <&vcc5v0_usb>;
145	};
146
147	vcc_cam: vcc-cam {
148		compatible = "regulator-fixed";
149		enable-active-high;
150		gpio = <&gpio1 RK_PB1 GPIO_ACTIVE_HIGH>;
151		pinctrl-names = "default";
152		pinctrl-0 = <&vcc_cam_en>;
153		regulator-name = "vcc_cam";
154		regulator-min-microvolt = <3300000>;
155		regulator-max-microvolt = <3300000>;
156		vin-supply = <&vcc3v3_sys>;
157
158		regulator-state-mem {
159			regulator-off-in-suspend;
160		};
161	};
162
163	vcc_mipi: vcc-mipi {
164		compatible = "regulator-fixed";
165		enable-active-high;
166		gpio = <&gpio3 RK_PC0 GPIO_ACTIVE_HIGH>;
167		pinctrl-names = "default";
168		pinctrl-0 = <&vcc_mipi_en>;
169		regulator-name = "vcc_mipi";
170		regulator-min-microvolt = <3300000>;
171		regulator-max-microvolt = <3300000>;
172		vin-supply = <&vcc3v3_sys>;
173
174		regulator-state-mem {
175			regulator-off-in-suspend;
176		};
177	};
178};
179
180&combphy0 {
181	status = "okay";
182};
183
184&combphy1 {
185	status = "okay";
186};
187
188&combphy2 {
189	status = "okay";
190};
191
192&cpu0 {
193	cpu-supply = <&vdd_cpu>;
194};
195
196&cpu1 {
197	cpu-supply = <&vdd_cpu>;
198};
199
200&cpu2 {
201	cpu-supply = <&vdd_cpu>;
202};
203
204&cpu3 {
205	cpu-supply = <&vdd_cpu>;
206};
207
208&gmac1 {
209	assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
210	assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>;
211	assigned-clock-rates = <0>, <125000000>;
212	clock_in_out = "output";
213	phy-handle = <&rgmii_phy1>;
214	phy-mode = "rgmii-id";
215	pinctrl-names = "default";
216	pinctrl-0 = <&gmac1m1_miim
217		     &gmac1m1_tx_bus2
218		     &gmac1m1_rx_bus2
219		     &gmac1m1_rgmii_clk
220		     &gmac1m1_rgmii_bus>;
221	status = "okay";
222};
223
224&gpu {
225	mali-supply = <&vdd_gpu>;
226	status = "okay";
227};
228
229&hdmi {
230	avdd-0v9-supply = <&vdda0v9_image>;
231	avdd-1v8-supply = <&vcca1v8_image>;
232	status = "okay";
233};
234
235&hdmi_in {
236	hdmi_in_vp0: endpoint {
237		remote-endpoint = <&vp0_out_hdmi>;
238	};
239};
240
241&hdmi_out {
242	hdmi_out_con: endpoint {
243		remote-endpoint = <&hdmi_con_in>;
244	};
245};
246
247&hdmi_sound {
248	status = "okay";
249};
250
251&i2c0 {
252	status = "okay";
253
254	vdd_cpu: regulator@1c {
255		compatible = "tcs,tcs4525";
256		reg = <0x1c>;
257		fcs,suspend-voltage-selector = <1>;
258		regulator-name = "vdd_cpu";
259		regulator-always-on;
260		regulator-boot-on;
261		regulator-min-microvolt = <800000>;
262		regulator-max-microvolt = <1150000>;
263		regulator-ramp-delay = <2300>;
264		vin-supply = <&vcc5v0_sys>;
265
266		regulator-state-mem {
267			regulator-off-in-suspend;
268		};
269	};
270
271	rk809: pmic@20 {
272		compatible = "rockchip,rk809";
273		reg = <0x20>;
274		interrupt-parent = <&gpio0>;
275		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
276		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
277		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
278		#clock-cells = <1>;
279		clock-names = "mclk";
280		clocks = <&cru I2S1_MCLKOUT_TX>;
281		pinctrl-names = "default";
282		pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>;
283		rockchip,system-power-controller;
284		#sound-dai-cells = <0>;
285		vcc1-supply = <&vcc3v3_sys>;
286		vcc2-supply = <&vcc3v3_sys>;
287		vcc3-supply = <&vcc3v3_sys>;
288		vcc4-supply = <&vcc3v3_sys>;
289		vcc5-supply = <&vcc3v3_sys>;
290		vcc6-supply = <&vcc3v3_sys>;
291		vcc7-supply = <&vcc3v3_sys>;
292		vcc8-supply = <&vcc3v3_sys>;
293		vcc9-supply = <&vcc3v3_sys>;
294		wakeup-source;
295
296		regulators {
297			vdd_logic: DCDC_REG1 {
298				regulator-name = "vdd_logic";
299				regulator-always-on;
300				regulator-boot-on;
301				regulator-init-microvolt = <900000>;
302				regulator-initial-mode = <0x2>;
303				regulator-min-microvolt = <500000>;
304				regulator-max-microvolt = <1350000>;
305				regulator-ramp-delay = <6001>;
306
307				regulator-state-mem {
308					regulator-off-in-suspend;
309				};
310			};
311
312			vdd_gpu: DCDC_REG2 {
313				regulator-name = "vdd_gpu";
314				regulator-always-on;
315				regulator-init-microvolt = <900000>;
316				regulator-initial-mode = <0x2>;
317				regulator-min-microvolt = <500000>;
318				regulator-max-microvolt = <1350000>;
319				regulator-ramp-delay = <6001>;
320
321				regulator-state-mem {
322					regulator-off-in-suspend;
323				};
324			};
325
326			vcc_ddr: DCDC_REG3 {
327				regulator-name = "vcc_ddr";
328				regulator-always-on;
329				regulator-boot-on;
330				regulator-initial-mode = <0x2>;
331
332				regulator-state-mem {
333					regulator-on-in-suspend;
334				};
335			};
336
337			vdd_npu: DCDC_REG4 {
338				regulator-name = "vdd_npu";
339				regulator-init-microvolt = <900000>;
340				regulator-initial-mode = <0x2>;
341				regulator-min-microvolt = <500000>;
342				regulator-max-microvolt = <1350000>;
343				regulator-ramp-delay = <6001>;
344
345				regulator-state-mem {
346					regulator-off-in-suspend;
347				};
348			};
349
350			vcc_1v8: DCDC_REG5 {
351				regulator-name = "vcc_1v8";
352				regulator-always-on;
353				regulator-boot-on;
354				regulator-min-microvolt = <1800000>;
355				regulator-max-microvolt = <1800000>;
356
357				regulator-state-mem {
358					regulator-off-in-suspend;
359				};
360			};
361
362			vdda0v9_image: LDO_REG1 {
363				regulator-name = "vdda0v9_image";
364				regulator-min-microvolt = <900000>;
365				regulator-max-microvolt = <900000>;
366
367				regulator-state-mem {
368					regulator-off-in-suspend;
369				};
370			};
371
372			vdda_0v9: LDO_REG2 {
373				regulator-name = "vdda_0v9";
374				regulator-always-on;
375				regulator-boot-on;
376				regulator-min-microvolt = <900000>;
377				regulator-max-microvolt = <900000>;
378
379				regulator-state-mem {
380					regulator-off-in-suspend;
381				};
382			};
383
384			vdda0v9_pmu: LDO_REG3 {
385				regulator-name = "vdda0v9_pmu";
386				regulator-always-on;
387				regulator-boot-on;
388				regulator-min-microvolt = <900000>;
389				regulator-max-microvolt = <900000>;
390
391				regulator-state-mem {
392					regulator-on-in-suspend;
393					regulator-suspend-microvolt = <900000>;
394				};
395			};
396
397			vccio_acodec: LDO_REG4 {
398				regulator-name = "vccio_acodec";
399				regulator-always-on;
400				regulator-min-microvolt = <3300000>;
401				regulator-max-microvolt = <3300000>;
402
403				regulator-state-mem {
404					regulator-off-in-suspend;
405				};
406			};
407
408			vccio_sd: LDO_REG5 {
409				regulator-name = "vccio_sd";
410				regulator-min-microvolt = <1800000>;
411				regulator-max-microvolt = <3300000>;
412
413				regulator-state-mem {
414					regulator-off-in-suspend;
415				};
416			};
417
418			vcc3v3_pmu: LDO_REG6 {
419				regulator-name = "vcc3v3_pmu";
420				regulator-always-on;
421				regulator-boot-on;
422				regulator-min-microvolt = <3300000>;
423				regulator-max-microvolt = <3300000>;
424
425				regulator-state-mem {
426					regulator-on-in-suspend;
427					regulator-suspend-microvolt = <3300000>;
428				};
429			};
430
431			vcca_1v8: LDO_REG7 {
432				regulator-name = "vcca_1v8";
433				regulator-always-on;
434				regulator-boot-on;
435				regulator-min-microvolt = <1800000>;
436				regulator-max-microvolt = <1800000>;
437
438				regulator-state-mem {
439					regulator-off-in-suspend;
440				};
441			};
442
443			vcca1v8_pmu: LDO_REG8 {
444				regulator-name = "vcca1v8_pmu";
445				regulator-always-on;
446				regulator-boot-on;
447				regulator-min-microvolt = <1800000>;
448				regulator-max-microvolt = <1800000>;
449
450				regulator-state-mem {
451					regulator-on-in-suspend;
452					regulator-suspend-microvolt = <1800000>;
453				};
454			};
455
456			vcca1v8_image: LDO_REG9 {
457				regulator-name = "vcca1v8_image";
458				regulator-min-microvolt = <1800000>;
459				regulator-max-microvolt = <1800000>;
460
461				regulator-state-mem {
462					regulator-off-in-suspend;
463				};
464			};
465
466			vcc_3v3: SWITCH_REG1 {
467				regulator-name = "vcc_3v3";
468				regulator-always-on;
469				regulator-boot-on;
470
471				regulator-state-mem {
472					regulator-off-in-suspend;
473				};
474			};
475
476			vcc3v3_sd: SWITCH_REG2 {
477				regulator-name = "vcc3v3_sd";
478
479				regulator-state-mem {
480					regulator-off-in-suspend;
481				};
482			};
483		};
484
485		codec {
486			mic-in-differential;
487		};
488	};
489};
490
491&i2c3 {
492	pinctrl-names = "default";
493	pinctrl-0 = <&i2c3m1_xfer>;
494	status = "disabled";
495};
496
497&i2c4 {
498	pinctrl-names = "default";
499	pinctrl-0 = <&i2c4m1_xfer>;
500	status = "disabled";
501};
502
503&i2c5 {
504	status = "okay";
505
506	hym8563: rtc@51 {
507		compatible = "haoyu,hym8563";
508		reg = <0x51>;
509		interrupt-parent = <&gpio0>;
510		interrupts = <RK_PD3 IRQ_TYPE_LEVEL_LOW>;
511		#clock-cells = <0>;
512		clock-frequency = <32768>;
513		clock-output-names = "rtcic_32kout";
514		pinctrl-names = "default";
515		pinctrl-0 = <&hym8563_int>;
516		wakeup-source;
517	};
518};
519
520&i2s0_8ch {
521	status = "okay";
522};
523
524&i2s1_8ch {
525	rockchip,trcm-sync-tx-only;
526	status = "okay";
527};
528
529&mdio1 {
530	rgmii_phy1: ethernet-phy@0 {
531		compatible = "ethernet-phy-ieee802.3-c22";
532		reg = <0x0>;
533		pinctrl-names = "default";
534		pinctrl-0 = <&eth_phy_rst>;
535		reset-assert-us = <20000>;
536		reset-deassert-us = <100000>;
537		reset-gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
538	};
539};
540
541&pcie2x1 {
542	pinctrl-names = "default";
543	pinctrl-0 = <&pcie_reset_h>;
544	reset-gpios = <&gpio3 RK_PC1 GPIO_ACTIVE_HIGH>;
545	vpcie3v3-supply = <&vcc3v3_pcie>;
546	status = "okay";
547};
548
549&pinctrl {
550	cam {
551		vcc_cam_en: vcc_cam_en {
552			rockchip,pins = <1 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
553		};
554	};
555
556	display {
557		vcc_mipi_en: vcc_mipi_en {
558			rockchip,pins = <3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
559		};
560	};
561
562	ethernet {
563		eth_phy_rst: eth_phy_rst {
564			rockchip,pins = <3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
565		};
566	};
567
568	hym8563 {
569		hym8563_int: hym8563-int {
570			rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>;
571		};
572	};
573
574	leds {
575		led_user_en: led_user_en {
576			rockchip,pins = <0 RK_PB7 RK_FUNC_GPIO &pcfg_pull_none>;
577		};
578	};
579
580	pcie {
581		pcie_enable_h: pcie-enable-h {
582			rockchip,pins = <0 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
583		};
584
585		pcie_reset_h: pcie-reset-h {
586			rockchip,pins = <3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_none>;
587		};
588	};
589
590	pmic {
591		pmic_int: pmic_int {
592			rockchip,pins =
593				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
594		};
595	};
596
597	usb {
598		vcc5v0_usb_host_en: vcc5v0_usb_host_en {
599			rockchip,pins = <0 RK_PA6 RK_FUNC_GPIO &pcfg_pull_none>;
600		};
601		vcc5v0_usb_hub_en: vcc5v0_usb_hub_en {
602			rockchip,pins = <0 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
603		};
604		vcc5v0_usb_otg_en: vcc5v0_usb_otg_en {
605			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_none>;
606		};
607	};
608};
609
610&pmu_io_domains {
611	pmuio1-supply = <&vcc3v3_pmu>;
612	pmuio2-supply = <&vcc3v3_pmu>;
613	vccio1-supply = <&vccio_acodec>;
614	vccio2-supply = <&vcc_1v8>;
615	vccio3-supply = <&vccio_sd>;
616	vccio4-supply = <&vcc_1v8>;
617	vccio5-supply = <&vcc_3v3>;
618	vccio6-supply = <&vcc_1v8>;
619	vccio7-supply = <&vcc_3v3>;
620	status = "okay";
621};
622
623&saradc {
624	vref-supply = <&vcca_1v8>;
625	status = "okay";
626};
627
628&sdhci {
629	bus-width = <8>;
630	max-frequency = <200000000>;
631	non-removable;
632	pinctrl-names = "default";
633	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
634	vmmc-supply = <&vcc_3v3>;
635	vqmmc-supply = <&vcc_1v8>;
636	status = "okay";
637};
638
639&sdmmc0 {
640	bus-width = <4>;
641	cap-sd-highspeed;
642	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
643	disable-wp;
644	pinctrl-names = "default";
645	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
646	sd-uhs-sdr104;
647	vmmc-supply = <&vcc3v3_sd>;
648	vqmmc-supply = <&vccio_sd>;
649	status = "okay";
650};
651
652&tsadc {
653	rockchip,hw-tshut-mode = <1>;
654	rockchip,hw-tshut-polarity = <0>;
655	status = "okay";
656};
657
658&uart2 {
659	status = "okay";
660};
661
662&usb_host0_ehci {
663	status = "okay";
664};
665
666&usb_host0_ohci {
667	status = "okay";
668};
669
670&usb_host0_xhci {
671	extcon = <&usb2phy0>;
672	status = "okay";
673};
674
675&usb_host1_ehci {
676	status = "okay";
677};
678
679&usb_host1_ohci {
680	status = "okay";
681};
682
683&usb_host1_xhci {
684	status = "okay";
685};
686
687&usb2phy0 {
688	status = "okay";
689};
690
691&usb2phy0_host {
692	phy-supply = <&vcc5v0_usb_host>;
693	status = "okay";
694};
695
696&usb2phy0_otg {
697	phy-supply = <&vcc5v0_usb_otg>;
698	status = "okay";
699};
700
701&usb2phy1 {
702	status = "okay";
703};
704
705&usb2phy1_host {
706	phy-supply = <&vcc5v0_usb_host>;
707	status = "okay";
708};
709
710&usb2phy1_otg {
711	phy-supply = <&vcc5v0_usb_host>;
712	status = "okay";
713};
714
715&vop {
716	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
717	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
718	status = "okay";
719};
720
721&vop_mmu {
722	status = "okay";
723};
724
725&vp0 {
726	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
727		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
728		remote-endpoint = <&hdmi_in_vp0>;
729	};
730};
731