xref: /linux/arch/arm64/boot/dts/rockchip/rk3566-anbernic-rgxx3.dtsi (revision 55d0969c451159cff86949b38c39171cab962069)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2
3/dts-v1/;
4
5#include <dt-bindings/gpio/gpio.h>
6#include <dt-bindings/input/linux-event-codes.h>
7#include <dt-bindings/leds/common.h>
8#include <dt-bindings/pinctrl/rockchip.h>
9#include <dt-bindings/soc/rockchip,vop2.h>
10#include "rk3566.dtsi"
11
12/ {
13	chassis-type = "handset";
14
15	chosen: chosen {
16		stdout-path = "serial2:1500000n8";
17	};
18
19	adc_keys: adc-keys {
20		compatible = "adc-keys";
21		io-channels = <&saradc 0>;
22		io-channel-names = "buttons";
23		keyup-threshold-microvolt = <1800000>;
24		poll-interval = <60>;
25
26		/*
27		 * Button is mapped to F key in BSP kernel, but
28		 * according to input guidelines it should be mode.
29		 */
30		button-mode {
31			label = "MODE";
32			linux,code = <BTN_MODE>;
33			press-threshold-microvolt = <1750>;
34		};
35	};
36
37	gpio_keys_control: gpio-keys-control {
38		compatible = "gpio-keys";
39		pinctrl-0 = <&btn_pins_ctrl>;
40		pinctrl-names = "default";
41
42		button-b {
43			gpios = <&gpio3 RK_PC3 GPIO_ACTIVE_LOW>;
44			label = "SOUTH";
45			linux,code = <BTN_SOUTH>;
46		};
47
48		button-down {
49			gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
50			label = "DPAD-DOWN";
51			linux,code = <BTN_DPAD_DOWN>;
52		};
53
54		button-l1 {
55			gpios = <&gpio3 RK_PB1 GPIO_ACTIVE_LOW>;
56			label = "TL";
57			linux,code = <BTN_TL>;
58		};
59
60		button-l2 {
61			gpios = <&gpio3 RK_PB2 GPIO_ACTIVE_LOW>;
62			label = "TL2";
63			linux,code = <BTN_TL2>;
64		};
65
66		button-select {
67			gpios = <&gpio3 RK_PB6 GPIO_ACTIVE_LOW>;
68			label = "SELECT";
69			linux,code = <BTN_SELECT>;
70		};
71
72		button-start {
73			gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_LOW>;
74			label = "START";
75			linux,code = <BTN_START>;
76		};
77
78		button-up {
79			gpios = <&gpio3 RK_PA3 GPIO_ACTIVE_LOW>;
80			label = "DPAD-UP";
81			linux,code = <BTN_DPAD_UP>;
82		};
83
84		button-x {
85			gpios = <&gpio3 RK_PC0 GPIO_ACTIVE_LOW>;
86			label = "NORTH";
87			linux,code = <BTN_NORTH>;
88		};
89	};
90
91	gpio_keys_vol: gpio-keys-vol {
92		compatible = "gpio-keys";
93		autorepeat;
94		pinctrl-0 = <&btn_pins_vol>;
95		pinctrl-names = "default";
96
97		button-vol-down {
98			gpios = <&gpio3 RK_PB0 GPIO_ACTIVE_LOW>;
99			label = "VOLUMEDOWN";
100			linux,code = <KEY_VOLUMEDOWN>;
101		};
102
103		button-vol-up {
104			gpios = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
105			label = "VOLUMEUP";
106			linux,code = <KEY_VOLUMEUP>;
107		};
108	};
109
110	hdmi-con {
111		compatible = "hdmi-connector";
112		ddc-i2c-bus = <&i2c5>;
113		type = "c";
114
115		port {
116			hdmi_con_in: endpoint {
117				remote-endpoint = <&hdmi_out_con>;
118			};
119		};
120	};
121
122	leds: pwm-leds {
123		compatible = "pwm-leds";
124
125		green_led: led-0 {
126			color = <LED_COLOR_ID_GREEN>;
127			default-state = "on";
128			function = LED_FUNCTION_POWER;
129			max-brightness = <255>;
130			pwms = <&pwm6 0 25000 0>;
131		};
132
133		amber_led: led-1 {
134			color = <LED_COLOR_ID_AMBER>;
135			function = LED_FUNCTION_CHARGING;
136			max-brightness = <255>;
137			pwms = <&pwm7 0 25000 0>;
138		};
139
140		red_led: led-2 {
141			color = <LED_COLOR_ID_RED>;
142			default-state = "off";
143			function = LED_FUNCTION_STATUS;
144			max-brightness = <255>;
145			pwms = <&pwm0 0 25000 0>;
146		};
147	};
148
149	sdio_pwrseq: sdio-pwrseq {
150		compatible = "mmc-pwrseq-simple";
151		clocks = <&rk817 1>;
152		clock-names = "ext_clock";
153		pinctrl-0 = <&wifi_enable_h>;
154		pinctrl-names = "default";
155		post-power-on-delay-ms = <200>;
156		reset-gpios = <&gpio4 RK_PA2 GPIO_ACTIVE_LOW>;
157	};
158
159	vcc3v3_lcd0_n: regulator-vcc3v3-lcd0 {
160		compatible = "regulator-fixed";
161		gpio = <&gpio0 RK_PC2 GPIO_ACTIVE_HIGH>;
162		enable-active-high;
163		pinctrl-0 = <&vcc_lcd_h>;
164		pinctrl-names = "default";
165		regulator-boot-on;
166		regulator-min-microvolt = <3300000>;
167		regulator-max-microvolt = <3300000>;
168		regulator-name = "vcc3v3_lcd0_n";
169		vin-supply = <&vcc_3v3>;
170		regulator-state-mem {
171			regulator-off-in-suspend;
172		};
173	};
174
175	vcc_sys: regulator-vcc-sys {
176		compatible = "regulator-fixed";
177		regulator-always-on;
178		regulator-boot-on;
179		regulator-min-microvolt = <3800000>;
180		regulator-max-microvolt = <3800000>;
181		regulator-name = "vcc_sys";
182	};
183
184	vcc_wifi: regulator-vcc-wifi {
185		compatible = "regulator-fixed";
186		enable-active-high;
187		gpio = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
188		pinctrl-0 = <&vcc_wifi_h>;
189		pinctrl-names = "default";
190		regulator-always-on;
191		regulator-boot-on;
192		regulator-min-microvolt = <3300000>;
193		regulator-max-microvolt = <3300000>;
194		regulator-name = "vcc_wifi";
195	};
196
197	vibrator: pwm-vibrator {
198		compatible = "pwm-vibrator";
199		pwm-names = "enable";
200		pwms = <&pwm5 0 1000000000 0>;
201	};
202};
203
204&combphy1 {
205	status = "okay";
206};
207
208&cpu0 {
209	cpu-supply = <&vdd_cpu>;
210};
211
212&cpu1 {
213	cpu-supply = <&vdd_cpu>;
214};
215
216&cpu2 {
217	cpu-supply = <&vdd_cpu>;
218};
219
220&cpu3 {
221	cpu-supply = <&vdd_cpu>;
222};
223
224&gpu {
225	mali-supply = <&vdd_gpu>;
226	status = "okay";
227};
228
229&hdmi {
230	ddc-i2c-bus = <&i2c5>;
231	pinctrl-0 = <&hdmitxm0_cec>;
232	pinctrl-names = "default";
233	status = "okay";
234};
235
236&hdmi_in {
237	hdmi_in_vp0: endpoint {
238		remote-endpoint = <&vp0_out_hdmi>;
239	};
240};
241
242&hdmi_out {
243	hdmi_out_con: endpoint {
244		remote-endpoint = <&hdmi_con_in>;
245	};
246};
247
248&hdmi_sound {
249	status = "okay";
250};
251
252&i2c0 {
253	status = "okay";
254
255	rk817: pmic@20 {
256		compatible = "rockchip,rk817";
257		reg = <0x20>;
258		interrupt-parent = <&gpio0>;
259		interrupts = <RK_PA3 IRQ_TYPE_LEVEL_LOW>;
260		clock-output-names = "rk808-clkout1", "rk808-clkout2";
261		clock-names = "mclk";
262		clocks = <&cru I2S1_MCLKOUT_TX>;
263		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
264		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
265		#clock-cells = <1>;
266		#sound-dai-cells = <0>;
267		pinctrl-names = "default";
268		pinctrl-0 = <&i2s1m0_mclk>, <&pmic_int_l>;
269		wakeup-source;
270
271		vcc1-supply = <&vcc_sys>;
272		vcc2-supply = <&vcc_sys>;
273		vcc3-supply = <&vcc_sys>;
274		vcc4-supply = <&vcc_sys>;
275		vcc5-supply = <&vcc_sys>;
276		vcc6-supply = <&vcc_sys>;
277		vcc7-supply = <&vcc_sys>;
278		vcc8-supply = <&vcc_sys>;
279		vcc9-supply = <&dcdc_boost>;
280
281		regulators {
282			vdd_logic: DCDC_REG1 {
283				regulator-always-on;
284				regulator-boot-on;
285				regulator-min-microvolt = <500000>;
286				regulator-max-microvolt = <1350000>;
287				regulator-ramp-delay = <6001>;
288				regulator-initial-mode = <0x2>;
289				regulator-name = "vdd_logic";
290				regulator-state-mem {
291					regulator-off-in-suspend;
292					regulator-suspend-microvolt = <900000>;
293				};
294			};
295
296			vdd_gpu: DCDC_REG2 {
297				regulator-always-on;
298				regulator-boot-on;
299				regulator-min-microvolt = <500000>;
300				regulator-max-microvolt = <1350000>;
301				regulator-ramp-delay = <6001>;
302				regulator-initial-mode = <0x2>;
303				regulator-name = "vdd_gpu";
304				regulator-state-mem {
305					regulator-off-in-suspend;
306				};
307			};
308
309			vcc_ddr: DCDC_REG3 {
310				regulator-always-on;
311				regulator-boot-on;
312				regulator-initial-mode = <0x2>;
313				regulator-name = "vcc_ddr";
314				regulator-state-mem {
315					regulator-on-in-suspend;
316				};
317			};
318
319			vcc_3v3: DCDC_REG4 {
320				regulator-always-on;
321				regulator-boot-on;
322				regulator-min-microvolt = <3300000>;
323				regulator-max-microvolt = <3300000>;
324				regulator-initial-mode = <0x2>;
325				regulator-name = "vcc_3v3";
326				regulator-state-mem {
327					regulator-on-in-suspend;
328					regulator-suspend-microvolt = <3300000>;
329				};
330			};
331
332			vcca1v8_pmu: LDO_REG1 {
333				regulator-always-on;
334				regulator-boot-on;
335				regulator-min-microvolt = <1800000>;
336				regulator-max-microvolt = <1800000>;
337				regulator-name = "vcca1v8_pmu";
338				regulator-state-mem {
339					regulator-on-in-suspend;
340					regulator-suspend-microvolt = <1800000>;
341				};
342			};
343
344			vdda_0v9: LDO_REG2 {
345				regulator-always-on;
346				regulator-boot-on;
347				regulator-min-microvolt = <900000>;
348				regulator-max-microvolt = <900000>;
349				regulator-name = "vdda_0v9";
350				regulator-state-mem {
351					regulator-off-in-suspend;
352				};
353			};
354
355			vdda0v9_pmu: LDO_REG3 {
356				regulator-always-on;
357				regulator-boot-on;
358				regulator-min-microvolt = <900000>;
359				regulator-max-microvolt = <900000>;
360				regulator-name = "vdda0v9_pmu";
361				regulator-state-mem {
362					regulator-on-in-suspend;
363					regulator-suspend-microvolt = <900000>;
364				};
365			};
366
367			vccio_acodec: LDO_REG4 {
368				regulator-always-on;
369				regulator-boot-on;
370				regulator-min-microvolt = <3300000>;
371				regulator-max-microvolt = <3300000>;
372				regulator-name = "vccio_acodec";
373				regulator-state-mem {
374					regulator-off-in-suspend;
375				};
376			};
377
378			vccio_sd: LDO_REG5 {
379				regulator-always-on;
380				regulator-boot-on;
381				regulator-min-microvolt = <1800000>;
382				regulator-max-microvolt = <3300000>;
383				regulator-name = "vccio_sd";
384				regulator-state-mem {
385					regulator-off-in-suspend;
386				};
387			};
388
389			vcc3v3_pmu: LDO_REG6 {
390				regulator-always-on;
391				regulator-boot-on;
392				regulator-min-microvolt = <3300000>;
393				regulator-max-microvolt = <3300000>;
394				regulator-name = "vcc3v3_pmu";
395				regulator-state-mem {
396					regulator-on-in-suspend;
397					regulator-suspend-microvolt = <3300000>;
398				};
399			};
400
401			vcc_1v8: LDO_REG7 {
402				regulator-always-on;
403				regulator-boot-on;
404				regulator-min-microvolt = <1800000>;
405				regulator-max-microvolt = <1800000>;
406				regulator-name = "vcc_1v8";
407				regulator-state-mem {
408					regulator-off-in-suspend;
409				};
410			};
411
412			vcc1v8_dvp: LDO_REG8 {
413				regulator-always-on;
414				regulator-boot-on;
415				regulator-min-microvolt = <1800000>;
416				regulator-max-microvolt = <3300000>;
417				regulator-name = "vcc1v8_dvp";
418				regulator-state-mem {
419					regulator-off-in-suspend;
420				};
421			};
422
423			vcc2v8_dvp: LDO_REG9 {
424				regulator-always-on;
425				regulator-boot-on;
426				regulator-min-microvolt = <2800000>;
427				regulator-max-microvolt = <2800000>;
428				regulator-name = "vcc2v8_dvp";
429				regulator-state-mem {
430					regulator-off-in-suspend;
431				};
432			};
433
434			dcdc_boost: BOOST {
435				regulator-always-on;
436				regulator-boot-on;
437				regulator-min-microvolt = <4700000>;
438				regulator-max-microvolt = <5400000>;
439				regulator-name = "boost";
440				regulator-state-mem {
441					regulator-off-in-suspend;
442				};
443			};
444
445			otg_switch: OTG_SWITCH {
446				regulator-name = "otg_switch";
447				regulator-state-mem {
448					regulator-off-in-suspend;
449				};
450			};
451		};
452	};
453
454	vdd_cpu: regulator@40 {
455		compatible = "fcs,fan53555";
456		reg = <0x40>;
457		fcs,suspend-voltage-selector = <1>;
458		regulator-always-on;
459		regulator-boot-on;
460		regulator-min-microvolt = <712500>;
461		regulator-max-microvolt = <1390000>;
462		regulator-name = "vdd_cpu";
463		regulator-ramp-delay = <2300>;
464		vin-supply = <&vcc_sys>;
465		regulator-state-mem {
466			regulator-off-in-suspend;
467		};
468	};
469};
470
471&i2c1 {
472	/* Unknown/unused device at 0x3c */
473	status = "disabled";
474};
475
476&i2c5 {
477	pinctrl-0 = <&i2c5m1_xfer>;
478	pinctrl-names = "default";
479	status = "okay";
480};
481
482&i2s0_8ch {
483	status = "okay";
484};
485
486&i2s1_8ch {
487	pinctrl-0 = <&i2s1m0_sclktx
488		     &i2s1m0_lrcktx
489		     &i2s1m0_sdi0
490		     &i2s1m0_sdo0>;
491	pinctrl-names = "default";
492	rockchip,trcm-sync-tx-only;
493	status = "okay";
494};
495
496&pinctrl {
497	gpio-btns {
498		btn_pins_ctrl: btn-pins-ctrl {
499			rockchip,pins =
500				<3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_up>,
501				<3 RK_PA2 RK_FUNC_GPIO &pcfg_pull_up>,
502				<3 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>,
503				<3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_up>,
504				<3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>,
505				<3 RK_PA6 RK_FUNC_GPIO &pcfg_pull_up>,
506				<3 RK_PB1 RK_FUNC_GPIO &pcfg_pull_up>,
507				<3 RK_PB2 RK_FUNC_GPIO &pcfg_pull_up>,
508				<3 RK_PB3 RK_FUNC_GPIO &pcfg_pull_up>,
509				<3 RK_PB4 RK_FUNC_GPIO &pcfg_pull_up>,
510				<3 RK_PB5 RK_FUNC_GPIO &pcfg_pull_up>,
511				<3 RK_PB6 RK_FUNC_GPIO &pcfg_pull_up>,
512				<3 RK_PC0 RK_FUNC_GPIO &pcfg_pull_up>,
513				<3 RK_PC1 RK_FUNC_GPIO &pcfg_pull_up>,
514				<3 RK_PC2 RK_FUNC_GPIO &pcfg_pull_up>,
515				<3 RK_PC3 RK_FUNC_GPIO &pcfg_pull_up>;
516		};
517
518		btn_pins_vol: btn-pins-vol {
519			rockchip,pins =
520			<3 RK_PA7 RK_FUNC_GPIO &pcfg_pull_up>,
521			<3 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
522		};
523	};
524
525	joy-mux {
526		joy_mux_en: joy-mux-en {
527			rockchip,pins =
528				<0 RK_PB5 RK_FUNC_GPIO &pcfg_output_low>;
529		};
530	};
531
532	pmic {
533		pmic_int_l: pmic-int-l {
534			rockchip,pins =
535				<0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>;
536		};
537	};
538
539	sdio-pwrseq {
540		wifi_enable_h: wifi-enable-h {
541			rockchip,pins =
542				<4 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
543		};
544	};
545
546	vcc3v3-lcd {
547		vcc_lcd_h: vcc-lcd-h {
548			rockchip,pins =
549				<0 RK_PC2 RK_FUNC_GPIO &pcfg_pull_none>;
550		};
551	};
552
553	vcc-wifi {
554		vcc_wifi_h: vcc-wifi-h {
555			rockchip,pins =
556				<0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_none>;
557		};
558	};
559};
560
561&pmu_io_domains {
562	status = "okay";
563	pmuio1-supply = <&vcc3v3_pmu>;
564	pmuio2-supply = <&vcc3v3_pmu>;
565	vccio1-supply = <&vccio_acodec>;
566	vccio3-supply = <&vccio_sd>;
567	vccio4-supply = <&vcc_1v8>;
568	vccio5-supply = <&vcc_3v3>;
569	vccio6-supply = <&vcc1v8_dvp>;
570	vccio7-supply = <&vcc_3v3>;
571};
572
573&pwm0 {
574	pinctrl-0 = <&pwm0m1_pins>;
575	pinctrl-names = "default";
576	status = "okay";
577};
578
579&pwm5 {
580	status = "okay";
581};
582
583&pwm6 {
584	status = "okay";
585};
586
587&pwm7 {
588	status = "okay";
589};
590
591&saradc {
592	vref-supply = <&vcc_1v8>;
593	status = "okay";
594};
595
596&sdmmc0 {
597	bus-width = <4>;
598	cap-sd-highspeed;
599	cd-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_LOW>;
600	disable-wp;
601	pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
602	pinctrl-names = "default";
603	sd-uhs-sdr104;
604	vmmc-supply = <&vcc_3v3>;
605	vqmmc-supply = <&vccio_sd>;
606	status = "okay";
607};
608
609&sdmmc1 {
610	bus-width = <4>;
611	cap-sd-highspeed;
612	cd-gpios = <&gpio2 RK_PB2 GPIO_ACTIVE_LOW>;
613	disable-wp;
614	pinctrl-0 = <&sdmmc1_bus4 &sdmmc1_cmd &sdmmc1_clk &sdmmc1_det>;
615	pinctrl-names = "default";
616	sd-uhs-sdr104;
617	vmmc-supply = <&vcc_3v3>;
618	vqmmc-supply = <&vcc1v8_dvp>;
619	status = "okay";
620};
621
622&sdmmc2 {
623	bus-width = <4>;
624	cap-sd-highspeed;
625	cap-sdio-irq;
626	keep-power-in-suspend;
627	mmc-pwrseq = <&sdio_pwrseq>;
628	no-mmc;
629	no-sd;
630	non-removable;
631	pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>;
632	pinctrl-names = "default";
633	sd-uhs-sdr50;
634	vmmc-supply = <&vcc_wifi>;
635	vqmmc-supply = <&vcca1v8_pmu>;
636	status = "okay";
637};
638
639&tsadc {
640	rockchip,hw-tshut-mode = <1>;
641	rockchip,hw-tshut-polarity = <0>;
642	status = "okay";
643};
644
645&uart1 {
646	pinctrl-0 = <&uart1m1_xfer &uart1m1_ctsn &uart1m1_rtsn>;
647	pinctrl-names = "default";
648	uart-has-rtscts;
649	status = "okay";
650
651	bluetooth {
652		compatible = "realtek,rtl8821cs-bt", "realtek,rtl8723bs-bt";
653		device-wake-gpios = <&gpio4 4 GPIO_ACTIVE_HIGH>;
654		enable-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
655		host-wake-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>;
656	};
657};
658
659&uart2 {
660	status = "okay";
661};
662
663/*
664 * Lack the schematics to verify, but port works as a peripheral
665 * (and not a host or OTG port).
666 */
667&usb_host0_xhci {
668	dr_mode = "peripheral";
669	phys = <&usb2phy0_otg>;
670	phy-names = "usb2-phy";
671	status = "okay";
672};
673
674&usb_host1_ehci {
675	status = "okay";
676};
677
678&usb_host1_ohci {
679	status = "okay";
680};
681
682&usb_host1_xhci {
683	phy-names = "usb2-phy", "usb3-phy";
684	phys = <&usb2phy1_host>, <&combphy1 PHY_TYPE_USB3>;
685	status = "okay";
686};
687
688&usb2phy0 {
689	status = "okay";
690};
691
692&usb2phy0_otg {
693	status = "okay";
694};
695
696&usb2phy1 {
697	status = "okay";
698};
699
700&usb2phy1_host {
701	status = "okay";
702};
703
704&vop {
705	assigned-clocks = <&cru DCLK_VOP0>, <&cru DCLK_VOP1>;
706	assigned-clock-parents = <&pmucru PLL_HPLL>, <&cru PLL_VPLL>;
707	status = "okay";
708};
709
710&vop_mmu {
711	status = "okay";
712};
713
714&vp0 {
715	vp0_out_hdmi: endpoint@ROCKCHIP_VOP2_EP_HDMI0 {
716		reg = <ROCKCHIP_VOP2_EP_HDMI0>;
717		remote-endpoint = <&hdmi_in_vp0>;
718	};
719};
720