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