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