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