1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 Fuzhou Rockchip Electronics Co., Ltd
4 * Copyright (c) 2019 Radxa Limited
5 * Copyright (c) 2022 Amarula Solutions(India)
6 */
7
8/dts-v1/;
9#include <dt-bindings/leds/common.h>
10#include "rk3399.dtsi"
11#include "rk3399-t-opp.dtsi"
12
13/ {
14	model = "Radxa ROCK 4C+";
15	compatible = "radxa,rock-4c-plus", "rockchip,rk3399";
16
17	aliases {
18		mmc0 = &sdmmc;
19		mmc1 = &sdhci;
20	};
21
22	chosen {
23		stdout-path = "serial2:1500000n8";
24	};
25
26	clkin_gmac: external-gmac-clock {
27		compatible = "fixed-clock";
28		clock-frequency = <125000000>;
29		clock-output-names = "clkin_gmac";
30		#clock-cells = <0>;
31	};
32
33	leds {
34		compatible = "gpio-leds";
35		pinctrl-names = "default";
36		pinctrl-0 = <&user_led1 &user_led2>;
37
38		/* USER_LED1 */
39		led-0 {
40			function = LED_FUNCTION_POWER;
41			color = <LED_COLOR_ID_GREEN>;
42			gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_LOW>;
43			linux,default-trigger = "default-on";
44		};
45
46		/* USER_LED2 */
47		led-1 {
48			function = LED_FUNCTION_STATUS;
49			color = <LED_COLOR_ID_BLUE>;
50			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
51			linux,default-trigger = "heartbeat";
52		};
53	};
54
55	sdio_pwrseq: sdio-pwrseq {
56		compatible = "mmc-pwrseq-simple";
57		clocks = <&rk809 1>;
58		clock-names = "ext_clock";
59		pinctrl-names = "default";
60		pinctrl-0 = <&wifi_enable_h>;
61		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
62	};
63
64	vcc_3v3: vcc-3v3-regulator {
65		compatible = "regulator-fixed";
66		regulator-name = "vcc_3v3";
67		regulator-always-on;
68		regulator-boot-on;
69		regulator-min-microvolt = <3300000>;
70		regulator-max-microvolt = <3300000>;
71		vin-supply = <&vcc3v3_sys>;
72	};
73
74	vcc3v3_phy1: vcc3v3-phy1-regulator {
75		compatible = "regulator-fixed";
76		regulator-name = "vcc3v3_phy1";
77		regulator-always-on;
78		regulator-boot-on;
79		regulator-min-microvolt = <3300000>;
80		regulator-max-microvolt = <3300000>;
81		vin-supply = <&vcc_3v3>;
82	};
83
84	vcc5v0_host1: vcc5v0-host-regulator {
85		compatible = "regulator-fixed";
86		enable-active-high;
87		gpio = <&gpio3 RK_PD6 GPIO_ACTIVE_HIGH>;
88		pinctrl-names = "default";
89		pinctrl-0 = <&vcc5v0_host_en>;
90		regulator-name = "vcc5v0_host1";
91		regulator-always-on;
92		regulator-boot-on;
93		vin-supply = <&vcc5v0_host0_s0>;
94	};
95
96	vcc5v0_sys: vcc5v0-sys-regulator {
97		compatible = "regulator-fixed";
98		regulator-name = "vcc5v0_sys";
99		regulator-always-on;
100		regulator-boot-on;
101		regulator-min-microvolt = <5000000>;
102		regulator-max-microvolt = <5000000>;
103	};
104
105	vcc5v0_typec: vcc5v0-typec-regulator {
106		compatible = "regulator-fixed";
107		enable-active-high;
108		gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>;
109		pinctrl-names = "default";
110		pinctrl-0 = <&vcc5v0_typec0_en>;
111		regulator-name = "vcc5v0_typec";
112		regulator-always-on;
113		regulator-boot-on;
114		vin-supply = <&vcc5v0_sys>;
115	};
116
117	vdd_log: vdd-log-regulator {
118		compatible = "regulator-fixed";
119		regulator-name = "vdd_log";
120		regulator-always-on;
121		regulator-boot-on;
122		regulator-min-microvolt = <950000>;
123		regulator-max-microvolt = <950000>;
124		vin-supply = <&vcc5v0_sys>;
125	};
126};
127
128&cpu_l0 {
129	cpu-supply = <&vdd_cpu_l>;
130};
131
132&cpu_l1 {
133	cpu-supply = <&vdd_cpu_l>;
134};
135
136&cpu_l2 {
137	cpu-supply = <&vdd_cpu_l>;
138};
139
140&cpu_l3 {
141	cpu-supply = <&vdd_cpu_l>;
142};
143
144&cpu_b0 {
145	cpu-supply = <&vdd_cpu_b>;
146};
147
148&cpu_b1 {
149	cpu-supply = <&vdd_cpu_b>;
150};
151
152&emmc_phy {
153	status = "okay";
154};
155
156&gmac {
157	assigned-clocks = <&cru SCLK_RMII_SRC>;
158	assigned-clock-parents = <&clkin_gmac>;
159	clock_in_out = "input";
160	phy-supply = <&vcc3v3_phy1>;
161	phy-mode = "rgmii";
162	pinctrl-names = "default";
163	pinctrl-0 = <&rgmii_pins>;
164	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
165	snps,reset-active-low;
166	snps,reset-delays-us = <0 10000 50000>;
167	tx_delay = <0x2a>;
168	rx_delay = <0x21>;
169	status = "okay";
170};
171
172&gpu {
173	mali-supply = <&vdd_gpu>;
174	status = "okay";
175};
176
177&hdmi {
178	avdd-0v9-supply = <&vcc_0v9_s0>;
179	avdd-1v8-supply = <&vcc_1v8_s0>;
180	ddc-i2c-bus = <&i2c3>;
181	pinctrl-names = "default";
182	pinctrl-0 = <&hdmi_cec>;
183	status = "okay";
184};
185
186&hdmi_sound {
187	status = "okay";
188};
189
190&i2c0 {
191	status = "okay";
192	i2c-scl-falling-time-ns = <30>;
193	i2c-scl-rising-time-ns = <180>;
194	clock-frequency = <400000>;
195
196	rk809: pmic@20 {
197		compatible = "rockchip,rk809";
198		reg = <0x20>;
199		interrupt-parent = <&gpio1>;
200		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
201		#clock-cells = <1>;
202		clock-output-names = "rk808-clkout1", "rk808-clkout2";
203		pinctrl-names = "default";
204		pinctrl-0 = <&pmic_int_l>;
205		rockchip,system-power-controller;
206		wakeup-source;
207
208		vcc1-supply = <&vcc5v0_sys>;
209		vcc2-supply = <&vcc5v0_sys>;
210		vcc3-supply = <&vcc5v0_sys>;
211		vcc4-supply = <&vcc5v0_sys>;
212		vcc5-supply = <&vcc_buck5_s3>;
213		vcc6-supply = <&vcc_buck5_s3>;
214		vcc7-supply = <&vcc5v0_sys>;
215		vcc8-supply = <&vcc3v3_sys>;
216		vcc9-supply = <&vcc5v0_sys>;
217
218		regulators {
219			vdd_center: DCDC_REG1 {
220				regulator-always-on;
221				regulator-boot-on;
222				regulator-min-microvolt = <750000>;
223				regulator-max-microvolt = <1350000>;
224				regulator-initial-mode = <0x2>;
225				regulator-name = "vdd_center";
226				regulator-state-mem {
227					regulator-off-in-suspend;
228					regulator-suspend-microvolt = <900000>;
229				};
230			};
231
232			vdd_cpu_l: DCDC_REG2 {
233				regulator-always-on;
234				regulator-boot-on;
235				regulator-min-microvolt = <750000>;
236				regulator-max-microvolt = <1350000>;
237				regulator-ramp-delay = <6001>;
238				regulator-initial-mode = <0x2>;
239				regulator-name = "vdd_cpu_l";
240				regulator-state-mem {
241					regulator-off-in-suspend;
242				};
243			};
244
245			vcc_ddr: DCDC_REG3 {
246				regulator-always-on;
247				regulator-boot-on;
248				regulator-name = "vcc_ddr";
249				regulator-initial-mode = <0x2>;
250				regulator-state-mem {
251					regulator-on-in-suspend;
252				};
253			};
254
255			vcc3v3_sys: DCDC_REG4 {
256				regulator-always-on;
257				regulator-boot-on;
258				regulator-min-microvolt = <3300000>;
259				regulator-max-microvolt = <3300000>;
260				regulator-initial-mode = <0x2>;
261				regulator-name = "vcc3v3_sys";
262				regulator-state-mem {
263					regulator-on-in-suspend;
264					regulator-suspend-microvolt = <3300000>;
265				};
266			};
267
268			vcc_buck5_s3: DCDC_REG5 {
269				regulator-always-on;
270				regulator-boot-on;
271				regulator-min-microvolt = <3300000>;
272				regulator-max-microvolt = <3300000>;
273				regulator-name = "vcc_buck5_s3";
274				regulator-state-mem {
275					regulator-on-in-suspend;
276					regulator-suspend-microvolt = <3300000>;
277				};
278			};
279
280			vcc_0v9_s3: LDO_REG1 {
281				regulator-always-on;
282				regulator-boot-on;
283				regulator-min-microvolt = <900000>;
284				regulator-max-microvolt = <900000>;
285				regulator-name = "vcc_0v9_s3";
286				regulator-state-mem {
287					regulator-off-in-suspend;
288				};
289			};
290
291			vcc_1v8_s3: LDO_REG2 {
292				regulator-always-on;
293				regulator-boot-on;
294				regulator-min-microvolt = <1800000>;
295				regulator-max-microvolt = <1800000>;
296				regulator-name = "vcc_1v8_s3";
297				regulator-state-mem {
298					regulator-on-in-suspend;
299					regulator-suspend-microvolt = <1800000>;
300				};
301			};
302
303			vcc_0v9_s0: LDO_REG3 {
304				regulator-always-on;
305				regulator-boot-on;
306				regulator-min-microvolt = <900000>;
307				regulator-max-microvolt = <900000>;
308				regulator-name = "vcc_0v9_s0";
309				regulator-state-mem {
310					regulator-on-in-suspend;
311					regulator-suspend-microvolt = <900000>;
312				};
313			};
314
315			vcc_1v8_s0: LDO_REG4 {
316				regulator-always-on;
317				regulator-boot-on;
318				regulator-min-microvolt = <1800000>;
319				regulator-max-microvolt = <1800000>;
320				regulator-name = "vcc_1v8_s0";
321				regulator-state-mem {
322					regulator-off-in-suspend;
323				};
324			};
325
326			vcc_mipi: LDO_REG5 {
327				regulator-always-on;
328				regulator-boot-on;
329				regulator-min-microvolt = <3000000>;
330				regulator-max-microvolt = <3000000>;
331				regulator-name = "vcc_mipi";
332				regulator-state-mem {
333					regulator-off-in-suspend;
334				};
335			};
336
337			vcc_1v5_s0: LDO_REG6 {
338				regulator-always-on;
339				regulator-boot-on;
340				regulator-min-microvolt = <1500000>;
341				regulator-max-microvolt = <1500000>;
342				regulator-name = "vcc_1v5_s0";
343				regulator-state-mem {
344					regulator-off-in-suspend;
345				};
346			};
347
348			vcc_3v0_s0: LDO_REG7 {
349				regulator-always-on;
350				regulator-boot-on;
351				regulator-min-microvolt = <3000000>;
352				regulator-max-microvolt = <3000000>;
353				regulator-name = "vcc_3v0_s0";
354				regulator-state-mem {
355					regulator-off-in-suspend;
356				};
357			};
358
359			vcc_sdio_s0: LDO_REG8 {
360				regulator-always-on;
361				regulator-boot-on;
362				regulator-min-microvolt = <1800000>;
363				regulator-max-microvolt = <3300000>;
364				regulator-name = "vcc_sdio_s0";
365				regulator-state-mem {
366					regulator-off-in-suspend;
367				};
368			};
369
370			vcc_cam: LDO_REG9 {
371				regulator-always-on;
372				regulator-boot-on;
373				regulator-min-microvolt = <3300000>;
374				regulator-max-microvolt = <3300000>;
375				regulator-name = "vcc_cam";
376				regulator-state-mem {
377					regulator-off-in-suspend;
378				};
379			};
380
381			vcc5v0_host0_s0: SWITCH_REG1 {
382				regulator-always-on;
383				regulator-boot-on;
384				regulator-name = "vcc5v0_host0_s0";
385				regulator-state-mem {
386					regulator-on-in-suspend;
387				};
388			};
389
390			lcd_3v3: SWITCH_REG2 {
391				regulator-always-on;
392				regulator-boot-on;
393				regulator-name = "lcd_3v3";
394				regulator-state-mem {
395					regulator-off-in-suspend;
396				};
397			};
398		};
399	};
400
401	vdd_cpu_b: regulator@40 {
402		compatible = "silergy,syr827";
403		reg = <0x40>;
404		fcs,suspend-voltage-selector = <1>;
405		regulator-compatible = "fan53555-reg";
406		pinctrl-0 = <&vsel1_gpio>;
407		vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
408		regulator-name = "vdd_cpu_b";
409		regulator-min-microvolt = <712500>;
410		regulator-max-microvolt = <1500000>;
411		regulator-ramp-delay = <1000>;
412		regulator-always-on;
413		regulator-boot-on;
414		vin-supply = <&vcc5v0_sys>;
415		regulator-state-mem {
416			regulator-off-in-suspend;
417		};
418	};
419
420	vdd_gpu: regulator@41 {
421		compatible = "silergy,syr828";
422		reg = <0x41>;
423		fcs,suspend-voltage-selector = <1>;
424		regulator-compatible = "fan53555-reg";
425		pinctrl-0 = <&vsel2_gpio>;
426		vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
427		regulator-name = "vdd_gpu";
428		regulator-min-microvolt = <712500>;
429		regulator-max-microvolt = <1500000>;
430		regulator-ramp-delay = <1000>;
431		regulator-always-on;
432		regulator-boot-on;
433		vin-supply = <&vcc5v0_sys>;
434		regulator-initial-mode = <1>; /* 1:force PWM 2:auto */
435		regulator-state-mem {
436			regulator-off-in-suspend;
437		};
438	};
439};
440
441&i2c3 {
442	i2c-scl-rising-time-ns = <450>;
443	i2c-scl-falling-time-ns = <15>;
444	status = "okay";
445};
446
447&i2s2 {
448	status = "okay";
449};
450
451&io_domains {
452	audio-supply = <&vcc_1v8_s0>;
453	bt656-supply = <&vcc_3v0_s0>;
454	gpio1830-supply = <&vcc_3v0_s0>;
455	sdmmc-supply = <&vcc_sdio_s0>;
456	status = "okay";
457};
458
459&pinctrl {
460	bt {
461		bt_enable_h: bt-enable-h {
462			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
463		};
464
465		bt_host_wake_l: bt-host-wake-l {
466			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
467		};
468
469		bt_wake_l: bt-wake-l {
470			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
471		};
472	};
473
474	leds {
475		user_led1: user-led1 {
476			rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
477		};
478
479		user_led2: user-led2 {
480			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
481		};
482	};
483
484	pmic {
485		pmic_int_l: pmic-int-l {
486			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
487		};
488
489		vsel1_gpio: vsel1-gpio {
490			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
491		};
492
493		vsel2_gpio: vsel2-gpio {
494			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
495		};
496	};
497
498	sdmmc {
499		sdmmc_bus4: sdmmc-bus4 {
500			rockchip,pins = <4 8 1 &pcfg_pull_up_8ma>,
501					<4 9 1 &pcfg_pull_up_8ma>,
502					<4 10 1 &pcfg_pull_up_8ma>,
503					<4 11 1 &pcfg_pull_up_8ma>;
504		};
505
506		sdmmc_clk: sdmmc-clk {
507			rockchip,pins = <4 12 1 &pcfg_pull_none_18ma>;
508		};
509
510		sdmmc_cmd: sdmmc-cmd {
511			rockchip,pins = <4 13 1 &pcfg_pull_up_8ma>;
512		};
513	};
514
515	usb-typec {
516		vcc5v0_typec0_en: vcc5v0-typec-en {
517			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
518		};
519	};
520
521	usb2 {
522		vcc5v0_host_en: vcc5v0-host-en {
523			rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
524		};
525	};
526
527	wifi {
528		wifi_enable_h: wifi-enable-h {
529			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
530		};
531
532		wifi_host_wake_l: wifi-host-wake-l {
533			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
534		};
535	};
536};
537
538&pmu_io_domains {
539	pmu1830-supply = <&vcc_3v0_s0>;
540	status = "okay";
541};
542
543&saradc {
544	status = "okay";
545	vref-supply = <&vcc_1v8_s3>;
546};
547
548&sdhci {
549	max-frequency = <150000000>;
550	bus-width = <8>;
551	mmc-hs400-1_8v;
552	non-removable;
553	mmc-hs400-enhanced-strobe;
554	status = "okay";
555};
556
557&sdio0 {
558	#address-cells = <1>;
559	#size-cells = <0>;
560	bus-width = <4>;
561	clock-frequency = <50000000>;
562	cap-sdio-irq;
563	cap-sd-highspeed;
564	keep-power-in-suspend;
565	mmc-pwrseq = <&sdio_pwrseq>;
566	non-removable;
567	pinctrl-names = "default";
568	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
569	sd-uhs-sdr104;
570	status = "okay";
571
572	brcmf: wifi@1 {
573		compatible = "brcm,bcm4329-fmac";
574		reg = <1>;
575		interrupt-parent = <&gpio0>;
576		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_HIGH>;
577		interrupt-names = "host-wake";
578		pinctrl-names = "default";
579		pinctrl-0 = <&wifi_host_wake_l>;
580	};
581};
582
583&sdmmc {
584	bus-width = <4>;
585	cap-mmc-highspeed;
586	cap-sd-highspeed;
587	card-detect-delay = <800>;
588	disable-wp;
589	pinctrl-names = "default";
590	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_bus4>;
591	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
592	vqmmc-supply = <&vcc_sdio_s0>;
593	status = "okay";
594};
595
596&tcphy0 {
597	status = "okay";
598};
599
600&tcphy1 {
601	status = "okay";
602};
603
604&u2phy0 {
605	status = "okay";
606
607	u2phy0_otg: otg-port {
608		status = "okay";
609	};
610
611	u2phy0_host: host-port {
612		phy-supply = <&vcc5v0_host1>;
613		status = "okay";
614	};
615};
616
617&u2phy1 {
618	status = "okay";
619
620	u2phy1_otg: otg-port {
621		status = "okay";
622	};
623
624	u2phy1_host: host-port {
625		phy-supply = <&vcc5v0_host1>;
626		status = "okay";
627	};
628};
629
630&uart0 {
631	pinctrl-names = "default";
632	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
633	status = "okay";
634
635	bluetooth {
636		compatible = "brcm,bcm4345c5";
637		clocks = <&rk809 1>;
638		clock-names = "lpo";
639		device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
640		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
641		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
642		max-speed = <1500000>;
643		pinctrl-names = "default";
644		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
645		vbat-supply = <&vcc3v3_sys>;
646		vddio-supply = <&vcc_1v8_s3>;
647	};
648};
649
650&uart2 {
651	status = "okay";
652};
653
654&usb_host0_ehci {
655	status = "okay";
656};
657
658&usb_host0_ohci {
659	status = "okay";
660};
661
662&usb_host1_ehci {
663	status = "okay";
664};
665
666&usb_host1_ohci {
667	status = "okay";
668};
669
670&usbdrd3_0 {
671	extcon = <&u2phy0>;
672	status = "okay";
673};
674
675&usbdrd_dwc3_0 {
676	status = "okay";
677	dr_mode = "host";
678};
679
680&usbdrd3_1 {
681	status = "okay";
682};
683
684&usbdrd_dwc3_1 {
685	status = "okay";
686	dr_mode = "host";
687};
688
689&vopb {
690	status = "okay";
691};
692
693&vopb_mmu {
694	status = "okay";
695};
696
697&vopl {
698	status = "okay";
699};
700
701&vopl_mmu {
702	status = "okay";
703};
704