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	status = "okay";
155};
156
157&gmac {
158	assigned-clocks = <&cru SCLK_RMII_SRC>;
159	assigned-clock-parents = <&clkin_gmac>;
160	clock_in_out = "input";
161	phy-supply = <&vcc3v3_phy1>;
162	phy-mode = "rgmii";
163	pinctrl-names = "default";
164	pinctrl-0 = <&rgmii_pins>;
165	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
166	snps,reset-active-low;
167	snps,reset-delays-us = <0 10000 50000>;
168	tx_delay = <0x2a>;
169	rx_delay = <0x21>;
170	status = "okay";
171};
172
173&gpu {
174	mali-supply = <&vdd_gpu>;
175	status = "okay";
176};
177
178&hdmi {
179	avdd-0v9-supply = <&vcc_0v9_s0>;
180	avdd-1v8-supply = <&vcc_1v8_s0>;
181	ddc-i2c-bus = <&i2c3>;
182	pinctrl-names = "default";
183	pinctrl-0 = <&hdmi_cec>;
184	status = "okay";
185};
186
187&hdmi_sound {
188	status = "okay";
189};
190
191&i2c0 {
192	status = "okay";
193	i2c-scl-falling-time-ns = <30>;
194	i2c-scl-rising-time-ns = <180>;
195	clock-frequency = <400000>;
196
197	rk809: pmic@20 {
198		compatible = "rockchip,rk809";
199		reg = <0x20>;
200		interrupt-parent = <&gpio1>;
201		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
202		#clock-cells = <1>;
203		clock-output-names = "rk808-clkout1", "rk808-clkout2";
204		pinctrl-names = "default";
205		pinctrl-0 = <&pmic_int_l>;
206		rockchip,system-power-controller;
207		wakeup-source;
208
209		vcc1-supply = <&vcc5v0_sys>;
210		vcc2-supply = <&vcc5v0_sys>;
211		vcc3-supply = <&vcc5v0_sys>;
212		vcc4-supply = <&vcc5v0_sys>;
213		vcc5-supply = <&vcc_buck5_s3>;
214		vcc6-supply = <&vcc_buck5_s3>;
215		vcc7-supply = <&vcc5v0_sys>;
216		vcc8-supply = <&vcc3v3_sys>;
217		vcc9-supply = <&vcc5v0_sys>;
218
219		regulators {
220			vdd_center: DCDC_REG1 {
221				regulator-always-on;
222				regulator-boot-on;
223				regulator-min-microvolt = <750000>;
224				regulator-max-microvolt = <1350000>;
225				regulator-initial-mode = <0x2>;
226				regulator-name = "vdd_center";
227				regulator-state-mem {
228					regulator-off-in-suspend;
229					regulator-suspend-microvolt = <900000>;
230				};
231			};
232
233			vdd_cpu_l: DCDC_REG2 {
234				regulator-always-on;
235				regulator-boot-on;
236				regulator-min-microvolt = <750000>;
237				regulator-max-microvolt = <1350000>;
238				regulator-ramp-delay = <6001>;
239				regulator-initial-mode = <0x2>;
240				regulator-name = "vdd_cpu_l";
241				regulator-state-mem {
242					regulator-off-in-suspend;
243				};
244			};
245
246			vcc_ddr: DCDC_REG3 {
247				regulator-always-on;
248				regulator-boot-on;
249				regulator-name = "vcc_ddr";
250				regulator-initial-mode = <0x2>;
251				regulator-state-mem {
252					regulator-on-in-suspend;
253				};
254			};
255
256			vcc3v3_sys: DCDC_REG4 {
257				regulator-always-on;
258				regulator-boot-on;
259				regulator-min-microvolt = <3300000>;
260				regulator-max-microvolt = <3300000>;
261				regulator-initial-mode = <0x2>;
262				regulator-name = "vcc3v3_sys";
263				regulator-state-mem {
264					regulator-on-in-suspend;
265					regulator-suspend-microvolt = <3300000>;
266				};
267			};
268
269			vcc_buck5_s3: DCDC_REG5 {
270				regulator-always-on;
271				regulator-boot-on;
272				regulator-min-microvolt = <3300000>;
273				regulator-max-microvolt = <3300000>;
274				regulator-name = "vcc_buck5_s3";
275				regulator-state-mem {
276					regulator-on-in-suspend;
277					regulator-suspend-microvolt = <3300000>;
278				};
279			};
280
281			vcc_0v9_s3: LDO_REG1 {
282				regulator-always-on;
283				regulator-boot-on;
284				regulator-min-microvolt = <900000>;
285				regulator-max-microvolt = <900000>;
286				regulator-name = "vcc_0v9_s3";
287				regulator-state-mem {
288					regulator-off-in-suspend;
289				};
290			};
291
292			vcc_1v8_s3: LDO_REG2 {
293				regulator-always-on;
294				regulator-boot-on;
295				regulator-min-microvolt = <1800000>;
296				regulator-max-microvolt = <1800000>;
297				regulator-name = "vcc_1v8_s3";
298				regulator-state-mem {
299					regulator-on-in-suspend;
300					regulator-suspend-microvolt = <1800000>;
301				};
302			};
303
304			vcc_0v9_s0: LDO_REG3 {
305				regulator-always-on;
306				regulator-boot-on;
307				regulator-min-microvolt = <900000>;
308				regulator-max-microvolt = <900000>;
309				regulator-name = "vcc_0v9_s0";
310				regulator-state-mem {
311					regulator-on-in-suspend;
312					regulator-suspend-microvolt = <900000>;
313				};
314			};
315
316			vcc_1v8_s0: LDO_REG4 {
317				regulator-always-on;
318				regulator-boot-on;
319				regulator-min-microvolt = <1800000>;
320				regulator-max-microvolt = <1800000>;
321				regulator-name = "vcc_1v8_s0";
322				regulator-state-mem {
323					regulator-off-in-suspend;
324				};
325			};
326
327			vcc_mipi: LDO_REG5 {
328				regulator-always-on;
329				regulator-boot-on;
330				regulator-min-microvolt = <3000000>;
331				regulator-max-microvolt = <3000000>;
332				regulator-name = "vcc_mipi";
333				regulator-state-mem {
334					regulator-off-in-suspend;
335				};
336			};
337
338			vcc_1v5_s0: LDO_REG6 {
339				regulator-always-on;
340				regulator-boot-on;
341				regulator-min-microvolt = <1500000>;
342				regulator-max-microvolt = <1500000>;
343				regulator-name = "vcc_1v5_s0";
344				regulator-state-mem {
345					regulator-off-in-suspend;
346				};
347			};
348
349			vcc_3v0_s0: LDO_REG7 {
350				regulator-always-on;
351				regulator-boot-on;
352				regulator-min-microvolt = <3000000>;
353				regulator-max-microvolt = <3000000>;
354				regulator-name = "vcc_3v0_s0";
355				regulator-state-mem {
356					regulator-off-in-suspend;
357				};
358			};
359
360			vcc_sdio_s0: LDO_REG8 {
361				regulator-always-on;
362				regulator-boot-on;
363				regulator-min-microvolt = <1800000>;
364				regulator-max-microvolt = <3300000>;
365				regulator-name = "vcc_sdio_s0";
366				regulator-state-mem {
367					regulator-off-in-suspend;
368				};
369			};
370
371			vcc_cam: LDO_REG9 {
372				regulator-always-on;
373				regulator-boot-on;
374				regulator-min-microvolt = <3300000>;
375				regulator-max-microvolt = <3300000>;
376				regulator-name = "vcc_cam";
377				regulator-state-mem {
378					regulator-off-in-suspend;
379				};
380			};
381
382			vcc5v0_host0_s0: SWITCH_REG1 {
383				regulator-always-on;
384				regulator-boot-on;
385				regulator-name = "vcc5v0_host0_s0";
386				regulator-state-mem {
387					regulator-on-in-suspend;
388				};
389			};
390
391			lcd_3v3: SWITCH_REG2 {
392				regulator-always-on;
393				regulator-boot-on;
394				regulator-name = "lcd_3v3";
395				regulator-state-mem {
396					regulator-off-in-suspend;
397				};
398			};
399		};
400	};
401
402	vdd_cpu_b: regulator@40 {
403		compatible = "silergy,syr827";
404		reg = <0x40>;
405		fcs,suspend-voltage-selector = <1>;
406		regulator-compatible = "fan53555-reg";
407		pinctrl-0 = <&vsel1_gpio>;
408		vsel-gpios = <&gpio1 RK_PC1 GPIO_ACTIVE_HIGH>;
409		regulator-name = "vdd_cpu_b";
410		regulator-min-microvolt = <712500>;
411		regulator-max-microvolt = <1500000>;
412		regulator-ramp-delay = <1000>;
413		regulator-always-on;
414		regulator-boot-on;
415		vin-supply = <&vcc5v0_sys>;
416		regulator-state-mem {
417			regulator-off-in-suspend;
418		};
419	};
420
421	vdd_gpu: regulator@41 {
422		compatible = "silergy,syr828";
423		reg = <0x41>;
424		fcs,suspend-voltage-selector = <1>;
425		regulator-compatible = "fan53555-reg";
426		pinctrl-0 = <&vsel2_gpio>;
427		vsel-gpios = <&gpio1 RK_PB6 GPIO_ACTIVE_HIGH>;
428		regulator-name = "vdd_gpu";
429		regulator-min-microvolt = <712500>;
430		regulator-max-microvolt = <1500000>;
431		regulator-ramp-delay = <1000>;
432		regulator-always-on;
433		regulator-boot-on;
434		vin-supply = <&vcc5v0_sys>;
435		regulator-initial-mode = <1>; /* 1:force PWM 2:auto */
436		regulator-state-mem {
437			regulator-off-in-suspend;
438		};
439	};
440};
441
442&i2c3 {
443	i2c-scl-rising-time-ns = <450>;
444	i2c-scl-falling-time-ns = <15>;
445	status = "okay";
446};
447
448&i2s2 {
449	status = "okay";
450};
451
452&io_domains {
453	audio-supply = <&vcc_1v8_s0>;
454	bt656-supply = <&vcc_3v0_s0>;
455	gpio1830-supply = <&vcc_3v0_s0>;
456	sdmmc-supply = <&vcc_sdio_s0>;
457	status = "okay";
458};
459
460&pinctrl {
461	bt {
462		bt_enable_h: bt-enable-h {
463			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
464		};
465
466		bt_host_wake_l: bt-host-wake-l {
467			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
468		};
469
470		bt_wake_l: bt-wake-l {
471			rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>;
472		};
473	};
474
475	leds {
476		user_led1: user-led1 {
477			rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
478		};
479
480		user_led2: user-led2 {
481			rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
482		};
483	};
484
485	pmic {
486		pmic_int_l: pmic-int-l {
487			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
488		};
489
490		vsel1_gpio: vsel1-gpio {
491			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
492		};
493
494		vsel2_gpio: vsel2-gpio {
495			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
496		};
497	};
498
499	sdmmc {
500		sdmmc_bus4: sdmmc-bus4 {
501			rockchip,pins = <4 8 1 &pcfg_pull_up_8ma>,
502					<4 9 1 &pcfg_pull_up_8ma>,
503					<4 10 1 &pcfg_pull_up_8ma>,
504					<4 11 1 &pcfg_pull_up_8ma>;
505		};
506
507		sdmmc_clk: sdmmc-clk {
508			rockchip,pins = <4 12 1 &pcfg_pull_none_18ma>;
509		};
510
511		sdmmc_cmd: sdmmc-cmd {
512			rockchip,pins = <4 13 1 &pcfg_pull_up_8ma>;
513		};
514	};
515
516	usb-typec {
517		vcc5v0_typec0_en: vcc5v0-typec-en {
518			rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
519		};
520	};
521
522	usb2 {
523		vcc5v0_host_en: vcc5v0-host-en {
524			rockchip,pins = <3 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
525		};
526	};
527
528	wifi {
529		wifi_enable_h: wifi-enable-h {
530			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
531		};
532
533		wifi_host_wake_l: wifi-host-wake-l {
534			rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>;
535		};
536	};
537};
538
539&pmu_io_domains {
540	pmu1830-supply = <&vcc_3v0_s0>;
541	status = "okay";
542};
543
544&saradc {
545	status = "okay";
546	vref-supply = <&vcc_1v8_s3>;
547};
548
549&sdhci {
550	max-frequency = <150000000>;
551	bus-width = <8>;
552	mmc-hs200-1_8v;
553	non-removable;
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&tsadc {
605	rockchip,hw-tshut-mode = <1>;
606	rockchip,hw-tshut-polarity = <1>;
607	status = "okay";
608};
609
610&u2phy0 {
611	status = "okay";
612
613	u2phy0_otg: otg-port {
614		status = "okay";
615	};
616
617	u2phy0_host: host-port {
618		phy-supply = <&vcc5v0_host1>;
619		status = "okay";
620	};
621};
622
623&u2phy1 {
624	status = "okay";
625
626	u2phy1_otg: otg-port {
627		status = "okay";
628	};
629
630	u2phy1_host: host-port {
631		phy-supply = <&vcc5v0_host1>;
632		status = "okay";
633	};
634};
635
636&uart0 {
637	pinctrl-names = "default";
638	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
639	status = "okay";
640
641	bluetooth {
642		compatible = "brcm,bcm4345c5";
643		clocks = <&rk809 1>;
644		clock-names = "lpo";
645		device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>;
646		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
647		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
648		max-speed = <1500000>;
649		pinctrl-names = "default";
650		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
651		vbat-supply = <&vcc3v3_sys>;
652		vddio-supply = <&vcc_1v8_s3>;
653	};
654};
655
656&uart2 {
657	status = "okay";
658};
659
660&usb_host0_ehci {
661	status = "okay";
662};
663
664&usb_host0_ohci {
665	status = "okay";
666};
667
668&usb_host1_ehci {
669	status = "okay";
670};
671
672&usb_host1_ohci {
673	status = "okay";
674};
675
676&usbdrd3_0 {
677	extcon = <&u2phy0>;
678	status = "okay";
679};
680
681&usbdrd_dwc3_0 {
682	status = "okay";
683	dr_mode = "host";
684};
685
686&usbdrd3_1 {
687	status = "okay";
688};
689
690&usbdrd_dwc3_1 {
691	status = "okay";
692	dr_mode = "host";
693};
694
695&vopb {
696	status = "okay";
697};
698
699&vopb_mmu {
700	status = "okay";
701};
702
703&vopl {
704	status = "okay";
705};
706
707&vopl_mmu {
708	status = "okay";
709};
710