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