1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2020 Martijn Braam <martijn@brixit.nl>
4 * Copyright (c) 2021 Kamil Trzciński <ayufan@ayufan.eu>
5 */
6
7/*
8 * PinePhone Pro datasheet:
9 * https://files.pine64.org/doc/PinePhonePro/PinephonePro-Schematic-V1.0-20211127.pdf
10 */
11
12/dts-v1/;
13#include <dt-bindings/input/linux-event-codes.h>
14#include "rk3399.dtsi"
15#include "rk3399-opp.dtsi"
16
17/ {
18	model = "Pine64 PinePhonePro";
19	compatible = "pine64,pinephone-pro", "rockchip,rk3399";
20	chassis-type = "handset";
21
22	aliases {
23		mmc0 = &sdio0;
24		mmc1 = &sdmmc;
25		mmc2 = &sdhci;
26	};
27
28	chosen {
29		stdout-path = "serial2:115200n8";
30	};
31
32	gpio-keys {
33		compatible = "gpio-keys";
34		pinctrl-names = "default";
35		pinctrl-0 = <&pwrbtn_pin>;
36
37		key-power {
38			debounce-interval = <20>;
39			gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
40			label = "Power";
41			linux,code = <KEY_POWER>;
42			wakeup-source;
43		};
44	};
45
46	vcc_sys: vcc-sys-regulator {
47		compatible = "regulator-fixed";
48		regulator-name = "vcc_sys";
49		regulator-always-on;
50		regulator-boot-on;
51	};
52
53	vcc3v3_sys: vcc3v3-sys-regulator {
54		compatible = "regulator-fixed";
55		regulator-name = "vcc3v3_sys";
56		regulator-always-on;
57		regulator-boot-on;
58		regulator-min-microvolt = <3300000>;
59		regulator-max-microvolt = <3300000>;
60		vin-supply = <&vcc_sys>;
61	};
62
63	vcca1v8_s3: vcc1v8-s3-regulator {
64		compatible = "regulator-fixed";
65		regulator-name = "vcca1v8_s3";
66		regulator-min-microvolt = <1800000>;
67		regulator-max-microvolt = <1800000>;
68		vin-supply = <&vcc3v3_sys>;
69		regulator-always-on;
70		regulator-boot-on;
71	};
72
73	vcc1v8_codec: vcc1v8-codec-regulator {
74		compatible = "regulator-fixed";
75		enable-active-high;
76		gpio = <&gpio3 RK_PA4 GPIO_ACTIVE_HIGH>;
77		pinctrl-names = "default";
78		pinctrl-0 = <&vcc1v8_codec_en>;
79		regulator-name = "vcc1v8_codec";
80		regulator-min-microvolt = <1800000>;
81		regulator-max-microvolt = <1800000>;
82		vin-supply = <&vcc3v3_sys>;
83	};
84
85	wifi_pwrseq: sdio-wifi-pwrseq {
86		compatible = "mmc-pwrseq-simple";
87		clocks = <&rk818 1>;
88		clock-names = "ext_clock";
89		pinctrl-names = "default";
90		pinctrl-0 = <&wifi_enable_h_pin>;
91		/*
92		 * Wait between power-on and SDIO access for CYP43455
93		 * POR circuit.
94		 */
95		post-power-on-delay-ms = <110>;
96		/*
97		 * Wait between consecutive toggles for CYP43455 CBUCK
98		 * regulator discharge.
99		 */
100		power-off-delay-us = <10000>;
101
102		/* WL_REG_ON on module */
103		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
104	};
105};
106
107&cpu_alert0 {
108	temperature = <65000>;
109};
110&cpu_alert1 {
111	temperature = <68000>;
112};
113
114&cpu_l0 {
115	cpu-supply = <&vdd_cpu_l>;
116};
117
118&cpu_l1 {
119	cpu-supply = <&vdd_cpu_l>;
120};
121
122&cpu_l2 {
123	cpu-supply = <&vdd_cpu_l>;
124};
125
126&cpu_l3 {
127	cpu-supply = <&vdd_cpu_l>;
128};
129
130&cpu_b0 {
131	cpu-supply = <&vdd_cpu_b>;
132};
133
134&cpu_b1 {
135	cpu-supply = <&vdd_cpu_b>;
136};
137
138&emmc_phy {
139	status = "okay";
140};
141
142&i2c0 {
143	clock-frequency = <400000>;
144	i2c-scl-rising-time-ns = <168>;
145	i2c-scl-falling-time-ns = <4>;
146	status = "okay";
147
148	rk818: pmic@1c {
149		compatible = "rockchip,rk818";
150		reg = <0x1c>;
151		interrupt-parent = <&gpio1>;
152		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
153		#clock-cells = <1>;
154		clock-output-names = "xin32k", "rk808-clkout2";
155		pinctrl-names = "default";
156		pinctrl-0 = <&pmic_int_l>;
157		rockchip,system-power-controller;
158		wakeup-source;
159
160		vcc1-supply = <&vcc_sys>;
161		vcc2-supply = <&vcc_sys>;
162		vcc3-supply = <&vcc_sys>;
163		vcc4-supply = <&vcc_sys>;
164		vcc6-supply = <&vcc_sys>;
165		vcc7-supply = <&vcc3v3_sys>;
166		vcc8-supply = <&vcc_sys>;
167		vcc9-supply = <&vcc3v3_sys>;
168
169		regulators {
170			vdd_cpu_l: DCDC_REG1 {
171				regulator-name = "vdd_cpu_l";
172				regulator-always-on;
173				regulator-boot-on;
174				regulator-min-microvolt = <875000>;
175				regulator-max-microvolt = <975000>;
176				regulator-ramp-delay = <6001>;
177				regulator-state-mem {
178					regulator-off-in-suspend;
179				};
180			};
181
182			vdd_center: DCDC_REG2 {
183				regulator-name = "vdd_center";
184				regulator-always-on;
185				regulator-boot-on;
186				regulator-min-microvolt = <800000>;
187				regulator-max-microvolt = <1000000>;
188				regulator-ramp-delay = <6001>;
189				regulator-state-mem {
190					regulator-off-in-suspend;
191				};
192			};
193
194			vcc_ddr: DCDC_REG3 {
195				regulator-name = "vcc_ddr";
196				regulator-always-on;
197				regulator-boot-on;
198				regulator-state-mem {
199					regulator-on-in-suspend;
200				};
201			};
202
203			vcc_1v8: DCDC_REG4 {
204				regulator-name = "vcc_1v8";
205				regulator-always-on;
206				regulator-boot-on;
207				regulator-min-microvolt = <1800000>;
208				regulator-max-microvolt = <1800000>;
209				regulator-state-mem {
210					regulator-on-in-suspend;
211				};
212			};
213
214			vcca3v0_codec: LDO_REG1 {
215				regulator-name = "vcca3v0_codec";
216				regulator-min-microvolt = <3000000>;
217				regulator-max-microvolt = <3000000>;
218			};
219
220			vcc3v0_touch: LDO_REG2 {
221				regulator-name = "vcc3v0_touch";
222				regulator-min-microvolt = <3000000>;
223				regulator-max-microvolt = <3000000>;
224			};
225
226			vcca1v8_codec: LDO_REG3 {
227				regulator-name = "vcca1v8_codec";
228				regulator-min-microvolt = <1800000>;
229				regulator-max-microvolt = <1800000>;
230			};
231
232			rk818_pwr_on: LDO_REG4 {
233				regulator-name = "rk818_pwr_on";
234				regulator-always-on;
235				regulator-boot-on;
236				regulator-min-microvolt = <3300000>;
237				regulator-max-microvolt = <3300000>;
238				regulator-state-mem {
239					regulator-on-in-suspend;
240				};
241			};
242
243			vcc_3v0: LDO_REG5 {
244				regulator-name = "vcc_3v0";
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <3000000>;
248				regulator-max-microvolt = <3000000>;
249				regulator-state-mem {
250					regulator-on-in-suspend;
251				};
252			};
253
254			vcc_1v5: LDO_REG6 {
255				regulator-name = "vcc_1v5";
256				regulator-always-on;
257				regulator-boot-on;
258				regulator-min-microvolt = <1500000>;
259				regulator-max-microvolt = <1500000>;
260				regulator-state-mem {
261					regulator-on-in-suspend;
262				};
263			};
264
265			vcc1v8_dvp: LDO_REG7 {
266				regulator-name = "vcc1v8_dvp";
267				regulator-min-microvolt = <1800000>;
268				regulator-max-microvolt = <1800000>;
269			};
270
271			vcc3v3_s3: LDO_REG8 {
272				regulator-name = "vcc3v3_s3";
273				regulator-always-on;
274				regulator-boot-on;
275				regulator-min-microvolt = <3300000>;
276				regulator-max-microvolt = <3300000>;
277				regulator-state-mem {
278					regulator-off-in-suspend;
279				};
280			};
281
282			vccio_sd: LDO_REG9 {
283				regulator-name = "vccio_sd";
284				regulator-min-microvolt = <1800000>;
285				regulator-max-microvolt = <3300000>;
286			};
287
288			vcc3v3_s0: SWITCH_REG {
289				regulator-name = "vcc3v3_s0";
290				regulator-always-on;
291				regulator-boot-on;
292				regulator-state-mem {
293					regulator-on-in-suspend;
294				};
295			};
296		};
297	};
298
299	vdd_cpu_b: regulator@40 {
300		compatible = "silergy,syr827";
301		reg = <0x40>;
302		fcs,suspend-voltage-selector = <1>;
303		pinctrl-names = "default";
304		pinctrl-0 = <&vsel1_pin>;
305		regulator-name = "vdd_cpu_b";
306		regulator-min-microvolt = <875000>;
307		regulator-max-microvolt = <1150000>;
308		regulator-ramp-delay = <1000>;
309		regulator-always-on;
310		regulator-boot-on;
311
312		regulator-state-mem {
313			regulator-off-in-suspend;
314		};
315	};
316
317	vdd_gpu: regulator@41 {
318		compatible = "silergy,syr828";
319		reg = <0x41>;
320		fcs,suspend-voltage-selector = <1>;
321		pinctrl-names = "default";
322		pinctrl-0 = <&vsel2_pin>;
323		regulator-name = "vdd_gpu";
324		regulator-min-microvolt = <875000>;
325		regulator-max-microvolt = <975000>;
326		regulator-ramp-delay = <1000>;
327		regulator-always-on;
328		regulator-boot-on;
329
330		regulator-state-mem {
331			regulator-off-in-suspend;
332		};
333	};
334};
335
336&cluster0_opp {
337	opp04 {
338		status = "disabled";
339	};
340
341	opp05 {
342		status = "disabled";
343	};
344};
345
346&cluster1_opp {
347	opp06 {
348		opp-hz = /bits/ 64 <1500000000>;
349		opp-microvolt = <1100000 1100000 1150000>;
350	};
351
352	opp07 {
353		status = "disabled";
354	};
355};
356
357&io_domains {
358	bt656-supply = <&vcc1v8_dvp>;
359	audio-supply = <&vcca1v8_codec>;
360	sdmmc-supply = <&vccio_sd>;
361	gpio1830-supply = <&vcc_3v0>;
362	status = "okay";
363};
364
365&pmu_io_domains {
366	pmu1830-supply = <&vcc_1v8>;
367	status = "okay";
368};
369
370&pinctrl {
371	buttons {
372		pwrbtn_pin: pwrbtn-pin {
373			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
374		};
375	};
376
377	pmic {
378		pmic_int_l: pmic-int-l {
379			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
380		};
381
382		vsel1_pin: vsel1-pin {
383			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
384		};
385
386		vsel2_pin: vsel2-pin {
387			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
388		};
389	};
390
391	sdio-pwrseq {
392		wifi_enable_h_pin: wifi-enable-h-pin {
393			rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
394		};
395	};
396
397	sound {
398		vcc1v8_codec_en: vcc1v8-codec-en {
399			rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
400		};
401	};
402
403	wireless-bluetooth {
404		bt_wake_pin: bt-wake-pin {
405			rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>;
406		};
407
408		bt_host_wake_pin: bt-host-wake-pin {
409			rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>;
410		};
411
412		bt_reset_pin: bt-reset-pin {
413			rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
414		};
415	};
416};
417
418&sdio0 {
419	bus-width = <4>;
420	cap-sd-highspeed;
421	cap-sdio-irq;
422	disable-wp;
423	keep-power-in-suspend;
424	mmc-pwrseq = <&wifi_pwrseq>;
425	non-removable;
426	pinctrl-names = "default";
427	pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
428	sd-uhs-sdr104;
429	status = "okay";
430};
431
432&sdmmc {
433	bus-width = <4>;
434	cap-sd-highspeed;
435	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
436	disable-wp;
437	max-frequency = <150000000>;
438	pinctrl-names = "default";
439	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
440	vmmc-supply = <&vcc3v3_sys>;
441	vqmmc-supply = <&vccio_sd>;
442	status = "okay";
443};
444
445&sdhci {
446	bus-width = <8>;
447	mmc-hs200-1_8v;
448	non-removable;
449	status = "okay";
450};
451
452&tsadc {
453	rockchip,hw-tshut-mode = <1>;
454	rockchip,hw-tshut-polarity = <1>;
455	status = "okay";
456};
457
458&uart0 {
459	pinctrl-names = "default";
460	pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>;
461	uart-has-rtscts;
462	status = "okay";
463
464	bluetooth {
465		compatible = "brcm,bcm4345c5";
466		clocks = <&rk818 1>;
467		clock-names = "lpo";
468		device-wakeup-gpios = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>;
469		host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>;
470		max-speed = <1500000>;
471		pinctrl-names = "default";
472		pinctrl-0 = <&bt_host_wake_pin &bt_wake_pin &bt_reset_pin>;
473		shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>;
474		vbat-supply = <&vcc3v3_sys>;
475		vddio-supply = <&vcc_1v8>;
476	};
477};
478
479&uart2 {
480	status = "okay";
481};
482