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
86&cpu_l0 {
87	cpu-supply = <&vdd_cpu_l>;
88};
89
90&cpu_l1 {
91	cpu-supply = <&vdd_cpu_l>;
92};
93
94&cpu_l2 {
95	cpu-supply = <&vdd_cpu_l>;
96};
97
98&cpu_l3 {
99	cpu-supply = <&vdd_cpu_l>;
100};
101
102&cpu_b0 {
103	cpu-supply = <&vdd_cpu_b>;
104};
105
106&cpu_b1 {
107	cpu-supply = <&vdd_cpu_b>;
108};
109
110&emmc_phy {
111	status = "okay";
112};
113
114&i2c0 {
115	clock-frequency = <400000>;
116	i2c-scl-rising-time-ns = <168>;
117	i2c-scl-falling-time-ns = <4>;
118	status = "okay";
119
120	rk818: pmic@1c {
121		compatible = "rockchip,rk818";
122		reg = <0x1c>;
123		interrupt-parent = <&gpio1>;
124		interrupts = <RK_PC5 IRQ_TYPE_LEVEL_LOW>;
125		#clock-cells = <1>;
126		clock-output-names = "xin32k", "rk808-clkout2";
127		pinctrl-names = "default";
128		pinctrl-0 = <&pmic_int_l>;
129		rockchip,system-power-controller;
130		wakeup-source;
131
132		vcc1-supply = <&vcc_sys>;
133		vcc2-supply = <&vcc_sys>;
134		vcc3-supply = <&vcc_sys>;
135		vcc4-supply = <&vcc_sys>;
136		vcc6-supply = <&vcc_sys>;
137		vcc7-supply = <&vcc3v3_sys>;
138		vcc8-supply = <&vcc_sys>;
139		vcc9-supply = <&vcc3v3_sys>;
140
141		regulators {
142			vdd_cpu_l: DCDC_REG1 {
143				regulator-name = "vdd_cpu_l";
144				regulator-always-on;
145				regulator-boot-on;
146				regulator-min-microvolt = <875000>;
147				regulator-max-microvolt = <975000>;
148				regulator-ramp-delay = <6001>;
149				regulator-state-mem {
150					regulator-off-in-suspend;
151				};
152			};
153
154			vdd_center: DCDC_REG2 {
155				regulator-name = "vdd_center";
156				regulator-always-on;
157				regulator-boot-on;
158				regulator-min-microvolt = <800000>;
159				regulator-max-microvolt = <1000000>;
160				regulator-ramp-delay = <6001>;
161				regulator-state-mem {
162					regulator-off-in-suspend;
163				};
164			};
165
166			vcc_ddr: DCDC_REG3 {
167				regulator-name = "vcc_ddr";
168				regulator-always-on;
169				regulator-boot-on;
170				regulator-state-mem {
171					regulator-on-in-suspend;
172				};
173			};
174
175			vcc_1v8: DCDC_REG4 {
176				regulator-name = "vcc_1v8";
177				regulator-always-on;
178				regulator-boot-on;
179				regulator-min-microvolt = <1800000>;
180				regulator-max-microvolt = <1800000>;
181				regulator-state-mem {
182					regulator-on-in-suspend;
183				};
184			};
185
186			vcca3v0_codec: LDO_REG1 {
187				regulator-name = "vcca3v0_codec";
188				regulator-min-microvolt = <3000000>;
189				regulator-max-microvolt = <3000000>;
190			};
191
192			vcc3v0_touch: LDO_REG2 {
193				regulator-name = "vcc3v0_touch";
194				regulator-min-microvolt = <3000000>;
195				regulator-max-microvolt = <3000000>;
196			};
197
198			vcca1v8_codec: LDO_REG3 {
199				regulator-name = "vcca1v8_codec";
200				regulator-min-microvolt = <1800000>;
201				regulator-max-microvolt = <1800000>;
202			};
203
204			rk818_pwr_on: LDO_REG4 {
205				regulator-name = "rk818_pwr_on";
206				regulator-always-on;
207				regulator-boot-on;
208				regulator-min-microvolt = <3300000>;
209				regulator-max-microvolt = <3300000>;
210				regulator-state-mem {
211					regulator-on-in-suspend;
212				};
213			};
214
215			vcc_3v0: LDO_REG5 {
216				regulator-name = "vcc_3v0";
217				regulator-always-on;
218				regulator-boot-on;
219				regulator-min-microvolt = <3000000>;
220				regulator-max-microvolt = <3000000>;
221				regulator-state-mem {
222					regulator-on-in-suspend;
223				};
224			};
225
226			vcc_1v5: LDO_REG6 {
227				regulator-name = "vcc_1v5";
228				regulator-always-on;
229				regulator-boot-on;
230				regulator-min-microvolt = <1500000>;
231				regulator-max-microvolt = <1500000>;
232				regulator-state-mem {
233					regulator-on-in-suspend;
234				};
235			};
236
237			vcc1v8_dvp: LDO_REG7 {
238				regulator-name = "vcc1v8_dvp";
239				regulator-min-microvolt = <1800000>;
240				regulator-max-microvolt = <1800000>;
241			};
242
243			vcc3v3_s3: LDO_REG8 {
244				regulator-name = "vcc3v3_s3";
245				regulator-always-on;
246				regulator-boot-on;
247				regulator-min-microvolt = <3300000>;
248				regulator-max-microvolt = <3300000>;
249				regulator-state-mem {
250					regulator-off-in-suspend;
251				};
252			};
253
254			vccio_sd: LDO_REG9 {
255				regulator-name = "vccio_sd";
256				regulator-min-microvolt = <1800000>;
257				regulator-max-microvolt = <3300000>;
258			};
259
260			vcc3v3_s0: SWITCH_REG {
261				regulator-name = "vcc3v3_s0";
262				regulator-always-on;
263				regulator-boot-on;
264				regulator-state-mem {
265					regulator-on-in-suspend;
266				};
267			};
268		};
269	};
270
271	vdd_cpu_b: regulator@40 {
272		compatible = "silergy,syr827";
273		reg = <0x40>;
274		fcs,suspend-voltage-selector = <1>;
275		pinctrl-names = "default";
276		pinctrl-0 = <&vsel1_pin>;
277		regulator-name = "vdd_cpu_b";
278		regulator-min-microvolt = <875000>;
279		regulator-max-microvolt = <1150000>;
280		regulator-ramp-delay = <1000>;
281		regulator-always-on;
282		regulator-boot-on;
283
284		regulator-state-mem {
285			regulator-off-in-suspend;
286		};
287	};
288
289	vdd_gpu: regulator@41 {
290		compatible = "silergy,syr828";
291		reg = <0x41>;
292		fcs,suspend-voltage-selector = <1>;
293		pinctrl-names = "default";
294		pinctrl-0 = <&vsel2_pin>;
295		regulator-name = "vdd_gpu";
296		regulator-min-microvolt = <875000>;
297		regulator-max-microvolt = <975000>;
298		regulator-ramp-delay = <1000>;
299		regulator-always-on;
300		regulator-boot-on;
301
302		regulator-state-mem {
303			regulator-off-in-suspend;
304		};
305	};
306};
307
308&cluster0_opp {
309	opp04 {
310		status = "disabled";
311	};
312
313	opp05 {
314		status = "disabled";
315	};
316};
317
318&cluster1_opp {
319	opp06 {
320		opp-hz = /bits/ 64 <1500000000>;
321		opp-microvolt = <1100000 1100000 1150000>;
322	};
323
324	opp07 {
325		status = "disabled";
326	};
327};
328
329&io_domains {
330	bt656-supply = <&vcc1v8_dvp>;
331	audio-supply = <&vcca1v8_codec>;
332	sdmmc-supply = <&vccio_sd>;
333	gpio1830-supply = <&vcc_3v0>;
334	status = "okay";
335};
336
337&pmu_io_domains {
338	pmu1830-supply = <&vcc_1v8>;
339	status = "okay";
340};
341
342&pinctrl {
343	buttons {
344		pwrbtn_pin: pwrbtn-pin {
345			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
346		};
347	};
348
349	pmic {
350		pmic_int_l: pmic-int-l {
351			rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>;
352		};
353
354		vsel1_pin: vsel1-pin {
355			rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>;
356		};
357
358		vsel2_pin: vsel2-pin {
359			rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>;
360		};
361	};
362
363	sound {
364		vcc1v8_codec_en: vcc1v8-codec-en {
365			rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>;
366		};
367	};
368};
369
370&sdmmc {
371	bus-width = <4>;
372	cap-sd-highspeed;
373	cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>;
374	disable-wp;
375	max-frequency = <150000000>;
376	pinctrl-names = "default";
377	pinctrl-0 = <&sdmmc_clk &sdmmc_cmd &sdmmc_cd &sdmmc_bus4>;
378	vmmc-supply = <&vcc3v3_sys>;
379	vqmmc-supply = <&vccio_sd>;
380	status = "okay";
381};
382
383&sdhci {
384	bus-width = <8>;
385	mmc-hs200-1_8v;
386	non-removable;
387	status = "okay";
388};
389
390&tsadc {
391	rockchip,hw-tshut-mode = <1>;
392	rockchip,hw-tshut-polarity = <1>;
393	status = "okay";
394};
395
396&uart2 {
397	status = "okay";
398};
399