1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Fuzhou Rockchip Electronics Co., Ltd.
4 */
5
6#include "dt-bindings/pwm/pwm.h"
7#include "dt-bindings/input/input.h"
8#include "rk3399.dtsi"
9#include "rk3399-opp.dtsi"
10
11/ {
12	compatible = "rockchip,rk3399-sapphire", "rockchip,rk3399";
13
14	backlight: backlight {
15		compatible = "pwm-backlight";
16		brightness-levels = <
17			  0   1   2   3   4   5   6   7
18			  8   9  10  11  12  13  14  15
19			 16  17  18  19  20  21  22  23
20			 24  25  26  27  28  29  30  31
21			 32  33  34  35  36  37  38  39
22			 40  41  42  43  44  45  46  47
23			 48  49  50  51  52  53  54  55
24			 56  57  58  59  60  61  62  63
25			 64  65  66  67  68  69  70  71
26			 72  73  74  75  76  77  78  79
27			 80  81  82  83  84  85  86  87
28			 88  89  90  91  92  93  94  95
29			 96  97  98  99 100 101 102 103
30			104 105 106 107 108 109 110 111
31			112 113 114 115 116 117 118 119
32			120 121 122 123 124 125 126 127
33			128 129 130 131 132 133 134 135
34			136 137 138 139 140 141 142 143
35			144 145 146 147 148 149 150 151
36			152 153 154 155 156 157 158 159
37			160 161 162 163 164 165 166 167
38			168 169 170 171 172 173 174 175
39			176 177 178 179 180 181 182 183
40			184 185 186 187 188 189 190 191
41			192 193 194 195 196 197 198 199
42			200 201 202 203 204 205 206 207
43			208 209 210 211 212 213 214 215
44			216 217 218 219 220 221 222 223
45			224 225 226 227 228 229 230 231
46			232 233 234 235 236 237 238 239
47			240 241 242 243 244 245 246 247
48			248 249 250 251 252 253 254 255>;
49		default-brightness-level = <200>;
50		pwms = <&pwm0 0 25000 0>;
51	};
52
53	clkin_gmac: external-gmac-clock {
54		compatible = "fixed-clock";
55		clock-frequency = <125000000>;
56		clock-output-names = "clkin_gmac";
57		#clock-cells = <0>;
58	};
59
60	dc_12v: dc-12v {
61		compatible = "regulator-fixed";
62		regulator-name = "dc_12v";
63		regulator-always-on;
64		regulator-boot-on;
65		regulator-min-microvolt = <12000000>;
66		regulator-max-microvolt = <12000000>;
67	};
68
69	keys: gpio-keys {
70		compatible = "gpio-keys";
71		autorepeat;
72
73		power {
74			debounce-interval = <100>;
75			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
76			label = "GPIO Power";
77			linux,code = <KEY_POWER>;
78			linux,input-type = <1>;
79			pinctrl-names = "default";
80			pinctrl-0 = <&pwr_btn>;
81			wakeup-source;
82		};
83	};
84
85	/* switched by pmic_sleep */
86	vcc1v8_s3: vcca1v8_s3: vcc1v8-s3 {
87		compatible = "regulator-fixed";
88		regulator-name = "vcc1v8_s3";
89		regulator-always-on;
90		regulator-boot-on;
91		regulator-min-microvolt = <1800000>;
92		regulator-max-microvolt = <1800000>;
93		vin-supply = <&vcc_1v8>;
94	};
95
96	vcc3v3_sys: vcc3v3-sys {
97		compatible = "regulator-fixed";
98		regulator-name = "vcc3v3_sys";
99		regulator-always-on;
100		regulator-boot-on;
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103		vin-supply = <&vcc_sys>;
104	};
105
106	vcc_sys: vcc-sys {
107		compatible = "regulator-fixed";
108		regulator-name = "vcc_sys";
109		regulator-always-on;
110		regulator-boot-on;
111		regulator-min-microvolt = <5000000>;
112		regulator-max-microvolt = <5000000>;
113		vin-supply = <&dc_12v>;
114	};
115
116	vcc5v0_host: vcc5v0-host-regulator {
117		compatible = "regulator-fixed";
118		enable-active-high;
119		gpio = <&gpio1 RK_PD1 GPIO_ACTIVE_HIGH>;
120		pinctrl-names = "default";
121		pinctrl-0 = <&vcc5v0_host_en>;
122		regulator-name = "vcc5v0_host";
123		regulator-always-on;
124		vin-supply = <&vcc_sys>;
125	};
126
127	vdd_log: vdd-log {
128		compatible = "pwm-regulator";
129		pwms = <&pwm2 0 25000 1>;
130		regulator-name = "vdd_log";
131		regulator-always-on;
132		regulator-boot-on;
133		regulator-min-microvolt = <800000>;
134		regulator-max-microvolt = <1400000>;
135		vin-supply = <&vcc_sys>;
136	};
137};
138
139&cpu_l0 {
140	cpu-supply = <&vdd_cpu_l>;
141};
142
143&cpu_l1 {
144	cpu-supply = <&vdd_cpu_l>;
145};
146
147&cpu_l2 {
148	cpu-supply = <&vdd_cpu_l>;
149};
150
151&cpu_l3 {
152	cpu-supply = <&vdd_cpu_l>;
153};
154
155&cpu_b0 {
156	cpu-supply = <&vdd_cpu_b>;
157};
158
159&cpu_b1 {
160	cpu-supply = <&vdd_cpu_b>;
161};
162
163&emmc_phy {
164	status = "okay";
165};
166
167&gmac {
168	assigned-clocks = <&cru SCLK_RMII_SRC>;
169	assigned-clock-parents = <&clkin_gmac>;
170	clock_in_out = "input";
171	phy-supply = <&vcc_lan>;
172	phy-mode = "rgmii";
173	pinctrl-names = "default";
174	pinctrl-0 = <&rgmii_pins>;
175	snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>;
176	snps,reset-active-low;
177	snps,reset-delays-us = <0 10000 50000>;
178	tx_delay = <0x28>;
179	rx_delay = <0x11>;
180	status = "okay";
181};
182
183&gpu {
184	mali-supply = <&vdd_gpu>;
185	status = "okay";
186};
187
188&hdmi {
189	ddc-i2c-bus = <&i2c3>;
190	status = "okay";
191};
192
193&hdmi_sound {
194	status = "okay";
195};
196
197&i2c0 {
198	clock-frequency = <400000>;
199	i2c-scl-rising-time-ns = <168>;
200	i2c-scl-falling-time-ns = <4>;
201	status = "okay";
202
203	rk808: pmic@1b {
204		compatible = "rockchip,rk808";
205		reg = <0x1b>;
206		interrupt-parent = <&gpio1>;
207		interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
208		#clock-cells = <1>;
209		clock-output-names = "xin32k", "rk808-clkout2";
210		pinctrl-names = "default";
211		pinctrl-0 = <&pmic_int_l &pmic_dvs2>;
212		rockchip,system-power-controller;
213		wakeup-source;
214
215		vcc1-supply = <&vcc_sys>;
216		vcc2-supply = <&vcc_sys>;
217		vcc3-supply = <&vcc_sys>;
218		vcc4-supply = <&vcc_sys>;
219		vcc6-supply = <&vcc_sys>;
220		vcc7-supply = <&vcc_sys>;
221		vcc8-supply = <&vcc3v3_sys>;
222		vcc9-supply = <&vcc_sys>;
223		vcc10-supply = <&vcc_sys>;
224		vcc11-supply = <&vcc_sys>;
225		vcc12-supply = <&vcc3v3_sys>;
226		vddio-supply = <&vcc1v8_pmu>;
227
228		regulators {
229			vdd_center: DCDC_REG1 {
230				regulator-name = "vdd_center";
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-state-mem {
237					regulator-off-in-suspend;
238				};
239			};
240
241			vdd_cpu_l: DCDC_REG2 {
242				regulator-name = "vdd_cpu_l";
243				regulator-always-on;
244				regulator-boot-on;
245				regulator-min-microvolt = <750000>;
246				regulator-max-microvolt = <1350000>;
247				regulator-ramp-delay = <6001>;
248				regulator-state-mem {
249					regulator-off-in-suspend;
250				};
251			};
252
253			vcc_ddr: DCDC_REG3 {
254				regulator-name = "vcc_ddr";
255				regulator-always-on;
256				regulator-boot-on;
257				regulator-state-mem {
258					regulator-on-in-suspend;
259				};
260			};
261
262			vcc_1v8: DCDC_REG4 {
263				regulator-name = "vcc_1v8";
264				regulator-always-on;
265				regulator-boot-on;
266				regulator-min-microvolt = <1800000>;
267				regulator-max-microvolt = <1800000>;
268				regulator-state-mem {
269					regulator-on-in-suspend;
270					regulator-suspend-microvolt = <1800000>;
271				};
272			};
273
274			vcc1v8_dvp: LDO_REG1 {
275				regulator-name = "vcc1v8_dvp";
276				regulator-always-on;
277				regulator-boot-on;
278				regulator-min-microvolt = <1800000>;
279				regulator-max-microvolt = <1800000>;
280				regulator-state-mem {
281					regulator-off-in-suspend;
282				};
283			};
284
285			vcc3v0_tp: LDO_REG2 {
286				regulator-name = "vcc3v0_tp";
287				regulator-always-on;
288				regulator-boot-on;
289				regulator-min-microvolt = <3000000>;
290				regulator-max-microvolt = <3000000>;
291				regulator-state-mem {
292					regulator-off-in-suspend;
293				};
294			};
295
296			vcc1v8_pmu: LDO_REG3 {
297				regulator-name = "vcc1v8_pmu";
298				regulator-always-on;
299				regulator-boot-on;
300				regulator-min-microvolt = <1800000>;
301				regulator-max-microvolt = <1800000>;
302				regulator-state-mem {
303					regulator-on-in-suspend;
304					regulator-suspend-microvolt = <1800000>;
305				};
306			};
307
308			vcc_sdio: LDO_REG4 {
309				regulator-name = "vcc_sdio";
310				regulator-always-on;
311				regulator-boot-on;
312				regulator-min-microvolt = <1800000>;
313				regulator-max-microvolt = <3000000>;
314				regulator-state-mem {
315					regulator-on-in-suspend;
316					regulator-suspend-microvolt = <3000000>;
317				};
318			};
319
320			vcca3v0_codec: LDO_REG5 {
321				regulator-name = "vcca3v0_codec";
322				regulator-always-on;
323				regulator-boot-on;
324				regulator-min-microvolt = <3000000>;
325				regulator-max-microvolt = <3000000>;
326				regulator-state-mem {
327					regulator-off-in-suspend;
328				};
329			};
330
331			vcc_1v5: LDO_REG6 {
332				regulator-name = "vcc_1v5";
333				regulator-always-on;
334				regulator-boot-on;
335				regulator-min-microvolt = <1500000>;
336				regulator-max-microvolt = <1500000>;
337				regulator-state-mem {
338					regulator-on-in-suspend;
339					regulator-suspend-microvolt = <1500000>;
340				};
341			};
342
343			vcca1v8_codec: LDO_REG7 {
344				regulator-name = "vcca1v8_codec";
345				regulator-always-on;
346				regulator-boot-on;
347				regulator-min-microvolt = <1800000>;
348				regulator-max-microvolt = <1800000>;
349				regulator-state-mem {
350					regulator-off-in-suspend;
351				};
352			};
353
354			vcc_3v0: LDO_REG8 {
355				regulator-name = "vcc_3v0";
356				regulator-always-on;
357				regulator-boot-on;
358				regulator-min-microvolt = <3000000>;
359				regulator-max-microvolt = <3000000>;
360				regulator-state-mem {
361					regulator-on-in-suspend;
362					regulator-suspend-microvolt = <3000000>;
363				};
364			};
365
366			vcc3v3_s3: vcc_lan: SWITCH_REG1 {
367				regulator-name = "vcc3v3_s3";
368				regulator-always-on;
369				regulator-boot-on;
370				regulator-state-mem {
371					regulator-off-in-suspend;
372				};
373			};
374
375			vcc3v3_s0: SWITCH_REG2 {
376				regulator-name = "vcc3v3_s0";
377				regulator-always-on;
378				regulator-boot-on;
379				regulator-state-mem {
380					regulator-off-in-suspend;
381				};
382			};
383		};
384	};
385
386	vdd_cpu_b: regulator@40 {
387		compatible = "silergy,syr827";
388		reg = <0x40>;
389		fcs,suspend-voltage-selector = <1>;
390		regulator-name = "vdd_cpu_b";
391		regulator-min-microvolt = <712500>;
392		regulator-max-microvolt = <1500000>;
393		regulator-ramp-delay = <1000>;
394		regulator-always-on;
395		regulator-boot-on;
396		vin-supply = <&vcc_sys>;
397
398		regulator-state-mem {
399			regulator-off-in-suspend;
400		};
401	};
402
403	vdd_gpu: regulator@41 {
404		compatible = "silergy,syr828";
405		reg = <0x41>;
406		fcs,suspend-voltage-selector = <1>;
407		regulator-name = "vdd_gpu";
408		regulator-min-microvolt = <712500>;
409		regulator-max-microvolt = <1500000>;
410		regulator-ramp-delay = <1000>;
411		regulator-always-on;
412		regulator-boot-on;
413		vin-supply = <&vcc_sys>;
414
415		regulator-state-mem {
416			regulator-off-in-suspend;
417		};
418	};
419};
420
421&i2c3 {
422	i2c-scl-rising-time-ns = <450>;
423	i2c-scl-falling-time-ns = <15>;
424	status = "okay";
425};
426
427&i2s2 {
428	status = "okay";
429};
430
431&io_domains {
432	status = "okay";
433
434	bt656-supply = <&vcc_3v0>;
435	audio-supply = <&vcca1v8_codec>;
436	sdmmc-supply = <&vcc_sdio>;
437	gpio1830-supply = <&vcc_3v0>;
438};
439
440&pmu_io_domains {
441	pmu1830-supply = <&vcc_3v0>;
442	status = "okay";
443};
444
445&pinctrl {
446	buttons {
447		pwr_btn: pwr-btn {
448			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
449		};
450	};
451
452	pmic {
453		pmic_int_l: pmic-int-l {
454			rockchip,pins =
455				<1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
456		};
457
458		pmic_dvs2: pmic-dvs2 {
459			rockchip,pins =
460				<1 RK_PC2 RK_FUNC_GPIO &pcfg_pull_down>;
461		};
462
463		vsel1_gpio: vsel1-gpio {
464			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
465		};
466
467		vsel2_gpio: vsel2-gpio {
468			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
469		};
470	};
471
472	usb2 {
473		vcc5v0_host_en: vcc5v0-host-en {
474			rockchip,pins =
475				<4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
476		};
477	};
478};
479
480&pwm0 {
481	status = "okay";
482};
483
484&pwm2 {
485	status = "okay";
486};
487
488&saradc {
489	vref-supply = <&vcca1v8_s3>;
490	status = "okay";
491};
492
493&sdhci {
494	bus-width = <8>;
495	mmc-hs400-1_8v;
496	mmc-hs400-enhanced-strobe;
497	non-removable;
498	status = "okay";
499};
500
501&sdmmc {
502	bus-width = <4>;
503	cap-mmc-highspeed;
504	cap-sd-highspeed;
505	clock-frequency = <150000000>;
506	disable-wp;
507	max-frequency = <150000000>;
508	pinctrl-names = "default";
509	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
510	vqmmc-supply = <&vcc_sdio>;
511	status = "okay";
512};
513
514&tcphy0 {
515	status = "okay";
516};
517
518&tcphy1 {
519	status = "okay";
520};
521
522&tsadc {
523	/* tshut mode 0:CRU 1:GPIO */
524	rockchip,hw-tshut-mode = <1>;
525	/* tshut polarity 0:LOW 1:HIGH */
526	rockchip,hw-tshut-polarity = <1>;
527	status = "okay";
528};
529
530&u2phy0 {
531	status = "okay";
532
533	u2phy0_otg: otg-port {
534		status = "okay";
535	};
536
537	u2phy0_host: host-port {
538		phy-supply = <&vcc5v0_host>;
539		status = "okay";
540	};
541};
542
543&u2phy1 {
544	status = "okay";
545
546	u2phy1_otg: otg-port {
547		status = "okay";
548	};
549
550	u2phy1_host: host-port {
551		phy-supply = <&vcc5v0_host>;
552		status = "okay";
553	};
554};
555
556&uart0 {
557	pinctrl-names = "default";
558	pinctrl-0 = <&uart0_xfer &uart0_cts>;
559	status = "okay";
560};
561
562&uart2 {
563	status = "okay";
564};
565
566&usb_host0_ehci {
567	status = "okay";
568};
569
570&usb_host0_ohci {
571	status = "okay";
572};
573
574&usb_host1_ehci {
575	status = "okay";
576};
577
578&usb_host1_ohci {
579	status = "okay";
580};
581
582&usbdrd3_0 {
583	status = "okay";
584};
585
586&usbdrd_dwc3_0 {
587	status = "okay";
588	dr_mode = "otg";
589};
590
591&usbdrd3_1 {
592	status = "okay";
593};
594
595&usbdrd_dwc3_1 {
596	status = "okay";
597	dr_mode = "host";
598};
599
600&vopb {
601	status = "okay";
602};
603
604&vopb_mmu {
605	status = "okay";
606};
607
608&vopl {
609	status = "okay";
610};
611
612&vopl_mmu {
613	status = "okay";
614};
615