1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2018 Fuzhou Rockchip Electronics Co., Ltd
4 */
5
6/dts-v1/;
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/pinctrl/rockchip.h>
10#include "px30.dtsi"
11
12/ {
13	model = "Rockchip PX30 EVB";
14	compatible = "rockchip,px30-evb", "rockchip,px30";
15
16	chosen {
17		stdout-path = "serial5:115200n8";
18	};
19
20	adc-keys {
21		compatible = "adc-keys";
22		io-channels = <&saradc 2>;
23		io-channel-names = "buttons";
24		keyup-threshold-microvolt = <1800000>;
25		poll-interval = <100>;
26
27		esc-key {
28			label = "esc";
29			linux,code = <KEY_ESC>;
30			press-threshold-microvolt = <1310000>;
31		};
32
33		home-key {
34			label = "home";
35			linux,code = <KEY_HOME>;
36			press-threshold-microvolt = <624000>;
37		};
38
39		menu-key {
40			label = "menu";
41			linux,code = <KEY_MENU>;
42			press-threshold-microvolt = <987000>;
43		};
44
45		vol-down-key {
46			label = "volume down";
47			linux,code = <KEY_VOLUMEDOWN>;
48			press-threshold-microvolt = <300000>;
49		};
50
51		vol-up-key {
52			label = "volume up";
53			linux,code = <KEY_VOLUMEUP>;
54			press-threshold-microvolt = <17000>;
55		};
56	};
57
58	backlight: backlight {
59		compatible = "pwm-backlight";
60		pwms = <&pwm1 0 25000 0>;
61		power-supply = <&vcc3v3_lcd>;
62	};
63
64	emmc_pwrseq: emmc-pwrseq {
65		compatible = "mmc-pwrseq-emmc";
66		pinctrl-0 = <&emmc_reset>;
67		pinctrl-names = "default";
68		reset-gpios = <&gpio1 RK_PB3 GPIO_ACTIVE_HIGH>;
69	};
70
71	sdio_pwrseq: sdio-pwrseq {
72		compatible = "mmc-pwrseq-simple";
73		pinctrl-names = "default";
74		pinctrl-0 = <&wifi_enable_h>;
75
76		/*
77		 * On the module itself this is one of these (depending
78		 * on the actual card populated):
79		 * - SDIO_RESET_L_WL_REG_ON
80		 * - PDN (power down when low)
81		 */
82		reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>; /* GPIO3_A4 */
83	};
84
85	vcc5v0_sys: vccsys {
86		compatible = "regulator-fixed";
87		regulator-name = "vcc5v0_sys";
88		regulator-always-on;
89		regulator-boot-on;
90		regulator-min-microvolt = <5000000>;
91		regulator-max-microvolt = <5000000>;
92	};
93};
94
95&cpu0 {
96	cpu-supply = <&vdd_arm>;
97};
98
99&cpu1 {
100	cpu-supply = <&vdd_arm>;
101};
102
103&cpu2 {
104	cpu-supply = <&vdd_arm>;
105};
106
107&cpu3 {
108	cpu-supply = <&vdd_arm>;
109};
110
111&display_subsystem {
112	status = "okay";
113};
114
115&dsi {
116	status = "okay";
117
118	ports {
119		mipi_out: port@1 {
120			reg = <1>;
121
122			mipi_out_panel: endpoint {
123				remote-endpoint = <&mipi_in_panel>;
124			};
125		};
126	};
127
128	panel@0 {
129		compatible = "xinpeng,xpp055c272";
130		reg = <0>;
131		backlight = <&backlight>;
132		iovcc-supply = <&vcc_1v8>;
133		vci-supply = <&vcc3v3_lcd>;
134
135		port {
136			mipi_in_panel: endpoint {
137				remote-endpoint = <&mipi_out_panel>;
138			};
139		};
140	};
141};
142
143&dsi_dphy {
144	status = "okay";
145};
146
147&emmc {
148	bus-width = <8>;
149	cap-mmc-highspeed;
150	mmc-hs200-1_8v;
151	non-removable;
152	mmc-pwrseq = <&emmc_pwrseq>;
153	vmmc-supply = <&vcc_3v0>;
154	vqmmc-supply = <&vccio_flash>;
155	status = "okay";
156};
157
158&gmac {
159	clock_in_out = "output";
160	phy-supply = <&vcc_rmii>;
161	snps,reset-gpio = <&gpio2 13 GPIO_ACTIVE_LOW>;
162	snps,reset-active-low;
163	snps,reset-delays-us = <0 50000 50000>;
164	status = "okay";
165};
166
167&gpu {
168	mali-supply = <&vdd_log>;
169	status = "okay";
170};
171
172&i2c0 {
173	status = "okay";
174
175	rk809: pmic@20 {
176		compatible = "rockchip,rk809";
177		reg = <0x20>;
178		interrupt-parent = <&gpio0>;
179		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
180		pinctrl-names = "default";
181		pinctrl-0 = <&pmic_int>;
182		rockchip,system-power-controller;
183		wakeup-source;
184		#clock-cells = <0>;
185		clock-output-names = "xin32k";
186
187		vcc1-supply = <&vcc5v0_sys>;
188		vcc2-supply = <&vcc5v0_sys>;
189		vcc3-supply = <&vcc5v0_sys>;
190		vcc4-supply = <&vcc5v0_sys>;
191		vcc5-supply = <&vcc3v3_sys>;
192		vcc6-supply = <&vcc3v3_sys>;
193		vcc7-supply = <&vcc3v3_sys>;
194		vcc8-supply = <&vcc3v3_sys>;
195		vcc9-supply = <&vcc5v0_sys>;
196
197		regulators {
198			vdd_log: DCDC_REG1 {
199				regulator-name = "vdd_log";
200				regulator-min-microvolt = <950000>;
201				regulator-max-microvolt = <1350000>;
202				regulator-ramp-delay = <6001>;
203				regulator-always-on;
204				regulator-boot-on;
205
206				regulator-state-mem {
207					regulator-on-in-suspend;
208					regulator-suspend-microvolt = <950000>;
209				};
210			};
211
212			vdd_arm: DCDC_REG2 {
213				regulator-name = "vdd_arm";
214				regulator-min-microvolt = <950000>;
215				regulator-max-microvolt = <1350000>;
216				regulator-ramp-delay = <6001>;
217				regulator-always-on;
218				regulator-boot-on;
219
220				regulator-state-mem {
221					regulator-off-in-suspend;
222					regulator-suspend-microvolt = <950000>;
223				};
224			};
225
226			vcc_ddr: DCDC_REG3 {
227				regulator-name = "vcc_ddr";
228				regulator-always-on;
229				regulator-boot-on;
230
231				regulator-state-mem {
232					regulator-on-in-suspend;
233				};
234			};
235
236			vcc_3v0: vcc_rmii: DCDC_REG4 {
237				regulator-name = "vcc_3v0";
238				regulator-min-microvolt = <3000000>;
239				regulator-max-microvolt = <3000000>;
240				regulator-always-on;
241				regulator-boot-on;
242
243				regulator-state-mem {
244					regulator-on-in-suspend;
245					regulator-suspend-microvolt = <3000000>;
246				};
247			};
248
249			vcc3v3_sys: DCDC_REG5 {
250				regulator-name = "vcc3v3_sys";
251				regulator-min-microvolt = <3300000>;
252				regulator-max-microvolt = <3300000>;
253				regulator-always-on;
254				regulator-boot-on;
255
256				regulator-state-mem {
257					regulator-on-in-suspend;
258					regulator-suspend-microvolt = <3300000>;
259				};
260			};
261
262			vcc_1v0: LDO_REG1 {
263				regulator-name = "vcc_1v0";
264				regulator-min-microvolt = <1000000>;
265				regulator-max-microvolt = <1000000>;
266				regulator-always-on;
267				regulator-boot-on;
268
269				regulator-state-mem {
270					regulator-on-in-suspend;
271					regulator-suspend-microvolt = <1000000>;
272				};
273			};
274
275			vcc_1v8: vccio_flash: vccio_sdio: LDO_REG2 {
276				regulator-name = "vcc_1v8";
277				regulator-min-microvolt = <1800000>;
278				regulator-max-microvolt = <1800000>;
279				regulator-always-on;
280				regulator-boot-on;
281
282				regulator-state-mem {
283					regulator-on-in-suspend;
284					regulator-suspend-microvolt = <1800000>;
285				};
286			};
287
288			vdd_1v0: LDO_REG3 {
289				regulator-name = "vdd_1v0";
290				regulator-min-microvolt = <1000000>;
291				regulator-max-microvolt = <1000000>;
292				regulator-always-on;
293				regulator-boot-on;
294
295				regulator-state-mem {
296					regulator-on-in-suspend;
297					regulator-suspend-microvolt = <1000000>;
298				};
299			};
300
301			vcc3v0_pmu: LDO_REG4 {
302				regulator-name = "vcc3v0_pmu";
303				regulator-min-microvolt = <3000000>;
304				regulator-max-microvolt = <3000000>;
305				regulator-always-on;
306				regulator-boot-on;
307
308				regulator-state-mem {
309					regulator-on-in-suspend;
310					regulator-suspend-microvolt = <3000000>;
311				};
312			};
313
314			vccio_sd: LDO_REG5 {
315				regulator-name = "vccio_sd";
316				regulator-min-microvolt = <1800000>;
317				regulator-max-microvolt = <3300000>;
318				regulator-always-on;
319				regulator-boot-on;
320
321				regulator-state-mem {
322					regulator-on-in-suspend;
323					regulator-suspend-microvolt = <3300000>;
324				};
325			};
326
327			vcc_sd: LDO_REG6 {
328				regulator-name = "vcc_sd";
329				regulator-min-microvolt = <3300000>;
330				regulator-max-microvolt = <3300000>;
331				regulator-boot-on;
332
333				regulator-state-mem {
334					regulator-on-in-suspend;
335					regulator-suspend-microvolt = <3300000>;
336				};
337			};
338
339			vcc2v8_dvp: LDO_REG7 {
340				regulator-name = "vcc2v8_dvp";
341				regulator-min-microvolt = <2800000>;
342				regulator-max-microvolt = <2800000>;
343				regulator-boot-on;
344
345				regulator-state-mem {
346					regulator-off-in-suspend;
347					regulator-suspend-microvolt = <2800000>;
348				};
349			};
350
351			vcc1v8_dvp: LDO_REG8 {
352				regulator-name = "vcc1v8_dvp";
353				regulator-min-microvolt = <1800000>;
354				regulator-max-microvolt = <1800000>;
355				regulator-boot-on;
356
357				regulator-state-mem {
358					regulator-on-in-suspend;
359					regulator-suspend-microvolt = <1800000>;
360				};
361			};
362
363			vcc1v5_dvp: LDO_REG9 {
364				regulator-name = "vcc1v5_dvp";
365				regulator-min-microvolt = <1500000>;
366				regulator-max-microvolt = <1500000>;
367				regulator-boot-on;
368
369				regulator-state-mem {
370					regulator-off-in-suspend;
371					regulator-suspend-microvolt = <1500000>;
372				};
373			};
374
375			vcc3v3_lcd: SWITCH_REG1 {
376				regulator-name = "vcc3v3_lcd";
377				regulator-boot-on;
378			};
379
380			vcc5v0_host: SWITCH_REG2 {
381				regulator-name = "vcc5v0_host";
382				regulator-always-on;
383				regulator-boot-on;
384			};
385		};
386	};
387};
388
389&i2c1 {
390	status = "okay";
391
392	sensor@d {
393		compatible = "asahi-kasei,ak8963";
394		reg = <0x0d>;
395		gpios = <&gpio0 RK_PB7 GPIO_ACTIVE_HIGH>;
396		vdd-supply = <&vcc3v0_pmu>;
397		mount-matrix = "1", /* x0 */
398			       "0", /* y0 */
399			       "0", /* z0 */
400			       "0", /* x1 */
401			       "1", /* y1 */
402			       "0", /* z1 */
403			       "0", /* x2 */
404			       "0", /* y2 */
405			       "1"; /* z2 */
406	};
407
408	touchscreen@14 {
409		compatible = "goodix,gt1151";
410		reg = <0x14>;
411		interrupt-parent = <&gpio0>;
412		interrupts = <RK_PA5 IRQ_TYPE_LEVEL_LOW>;
413		irq-gpios = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
414		reset-gpios = <&gpio0 RK_PB4 GPIO_ACTIVE_HIGH>;
415		VDDIO-supply = <&vcc3v3_lcd>;
416	};
417
418	sensor@4c {
419		compatible = "fsl,mma7660";
420		reg = <0x4c>;
421		interrupt-parent = <&gpio0>;
422		interrupts = <RK_PB7 IRQ_TYPE_LEVEL_LOW>;
423	};
424};
425
426&i2s1_2ch {
427	status = "okay";
428};
429
430&io_domains {
431	status = "okay";
432
433	vccio1-supply = <&vccio_sdio>;
434	vccio2-supply = <&vccio_sd>;
435	vccio3-supply = <&vcc_3v0>;
436	vccio4-supply = <&vcc3v0_pmu>;
437	vccio5-supply = <&vcc_3v0>;
438	vccio6-supply = <&vccio_flash>;
439};
440
441&pinctrl {
442	headphone {
443		hp_det: hp-det {
444			rockchip,pins =
445				<2 RK_PB0 RK_FUNC_GPIO &pcfg_pull_down>;
446		};
447	};
448
449	emmc {
450		emmc_reset: emmc-reset {
451			rockchip,pins = <1 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
452		};
453	};
454
455	pmic {
456		pmic_int: pmic_int {
457			rockchip,pins =
458				<0 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>;
459		};
460
461		soc_slppin_gpio: soc_slppin_gpio {
462			rockchip,pins =
463				<0 RK_PA4 RK_FUNC_GPIO &pcfg_output_low>;
464		};
465
466		soc_slppin_slp: soc_slppin_slp {
467			rockchip,pins =
468				<0 RK_PA4 1 &pcfg_pull_none>;
469		};
470
471		soc_slppin_rst: soc_slppin_rst {
472			rockchip,pins =
473				<0 RK_PA4 2 &pcfg_pull_none>;
474		};
475	};
476
477	sdio-pwrseq {
478		wifi_enable_h: wifi-enable-h {
479			rockchip,pins =
480				<0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
481		};
482	};
483};
484
485&pmu_io_domains {
486	status = "okay";
487
488	pmuio1-supply = <&vcc3v0_pmu>;
489	pmuio2-supply = <&vcc3v0_pmu>;
490};
491
492&pwm1 {
493	status = "okay";
494};
495
496&saradc {
497	vref-supply = <&vcc_1v8>;
498	status = "okay";
499};
500
501&sdmmc {
502	bus-width = <4>;
503	cap-mmc-highspeed;
504	cap-sd-highspeed;
505	card-detect-delay = <800>;
506	sd-uhs-sdr12;
507	sd-uhs-sdr25;
508	sd-uhs-sdr50;
509	sd-uhs-sdr104;
510	vmmc-supply = <&vcc_sd>;
511	vqmmc-supply = <&vccio_sd>;
512	status = "okay";
513};
514
515&sdio {
516	bus-width = <4>;
517	cap-sd-highspeed;
518	keep-power-in-suspend;
519	non-removable;
520	mmc-pwrseq = <&sdio_pwrseq>;
521	sd-uhs-sdr104;
522	status = "okay";
523};
524
525&tsadc {
526	rockchip,hw-tshut-mode = <1>;
527	rockchip,hw-tshut-polarity = <1>;
528	status = "okay";
529};
530
531&u2phy {
532	status = "okay";
533
534	u2phy_host: host-port {
535		status = "okay";
536	};
537
538	u2phy_otg: otg-port {
539		status = "okay";
540	};
541};
542
543&uart1 {
544	pinctrl-names = "default";
545	pinctrl-0 = <&uart1_xfer &uart1_cts>;
546	status = "okay";
547};
548
549&uart5 {
550	status = "okay";
551};
552
553&usb20_otg {
554	status = "okay";
555};
556
557&usb_host0_ehci {
558	status = "okay";
559};
560
561&usb_host0_ohci {
562	status = "okay";
563};
564
565&vopb {
566	status = "okay";
567};
568
569&vopb_mmu {
570	status = "okay";
571};
572
573&vopl {
574	status = "okay";
575};
576
577&vopl_mmu {
578	status = "okay";
579};
580