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