xref: /linux/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts (revision d53b8e36925256097a08d7cb749198d85cbf9b2b)
1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2/*
3 * Copyright (C) 2024 Ryan Walklin <ryan@testtoast.com>.
4 */
5
6/dts-v1/;
7
8#include "sun50i-h616.dtsi"
9#include "sun50i-h616-cpu-opp.dtsi"
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/linux-event-codes.h>
12#include <dt-bindings/interrupt-controller/arm-gic.h>
13#include <dt-bindings/leds/common.h>
14
15/ {
16	model = "Anbernic RG35XX 2024";
17	chassis-type = "handset";
18	compatible = "anbernic,rg35xx-2024", "allwinner,sun50i-h700";
19
20	aliases {
21		serial0 = &uart0;
22	};
23
24	chosen {
25		stdout-path = "serial0:115200n8";
26	};
27
28	gpio_keys_gamepad: gpio-keys-gamepad {
29		compatible = "gpio-keys";
30
31		button-a {
32			label = "Action-Pad A";
33			gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */
34			linux,input-type = <EV_KEY>;
35			linux,code = <BTN_EAST>;
36		};
37
38		button-b {
39			label = "Action-Pad B";
40			gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */
41			linux,input-type = <EV_KEY>;
42			linux,code = <BTN_SOUTH>;
43		};
44
45		button-down {
46			label = "D-Pad Down";
47			gpios = <&pio 4 0 GPIO_ACTIVE_LOW>; /* PE0 */
48			linux,input-type = <EV_KEY>;
49			linux,code = <BTN_DPAD_DOWN>;
50		};
51
52		button-l1 {
53			label = "Key L1";
54			gpios = <&pio 0 10 GPIO_ACTIVE_LOW>; /* PA10 */
55			linux,input-type = <EV_KEY>;
56			linux,code = <BTN_TL>;
57		};
58
59		button-l2 {
60			label = "Key L2";
61			gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */
62			linux,input-type = <EV_KEY>;
63			linux,code = <BTN_TL2>;
64		};
65
66		button-left {
67			label = "D-Pad left";
68			gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
69			linux,input-type = <EV_KEY>;
70			linux,code = <BTN_DPAD_LEFT>;
71		};
72
73		button-menu {
74			label = "Key Menu";
75			gpios = <&pio 4 3 GPIO_ACTIVE_LOW>; /* PE3 */
76			linux,input-type = <EV_KEY>;
77			linux,code = <BTN_MODE>;
78		};
79
80		button-r1 {
81			label = "Key R1";
82			gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */
83			linux,input-type = <EV_KEY>;
84			linux,code = <BTN_TR>;
85		};
86
87		button-r2 {
88			label = "Key R2";
89			gpios = <&pio 0 7 GPIO_ACTIVE_LOW>; /* PA7 */
90			linux,input-type = <EV_KEY>;
91			linux,code = <BTN_TR2>;
92		};
93
94		button-right {
95			label = "D-Pad Right";
96			gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
97			linux,input-type = <EV_KEY>;
98			linux,code = <BTN_DPAD_RIGHT>;
99		};
100
101		button-select {
102			label = "Key Select";
103			gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */
104			linux,input-type = <EV_KEY>;
105			linux,code = <BTN_SELECT>;
106		};
107		button-start {
108			label = "Key Start";
109			gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */
110			linux,input-type = <EV_KEY>;
111			linux,code = <BTN_START>;
112		};
113
114		button-up {
115			label = "D-Pad Up";
116			gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */
117			linux,input-type = <EV_KEY>;
118			linux,code = <BTN_DPAD_UP>;
119		};
120
121		button-x {
122			label = "Action-Pad X";
123			gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */
124			linux,input-type = <EV_KEY>;
125			linux,code = <BTN_NORTH>;
126		};
127
128		button-y {
129			label = "Action Pad Y";
130			gpios = <&pio 0 2 GPIO_ACTIVE_LOW>; /* PA2 */
131			linux,input-type = <EV_KEY>;
132			linux,code = <BTN_WEST>;
133		};
134	};
135
136	gpio-keys-volume {
137		compatible = "gpio-keys";
138		autorepeat;
139
140		button-vol-up {
141			label = "Key Volume Up";
142			gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; /* PE1 */
143			linux,input-type = <EV_KEY>;
144			linux,code = <KEY_VOLUMEUP>;
145		};
146
147		button-vol-down {
148			label = "Key Volume Down";
149			gpios = <&pio 4 2 GPIO_ACTIVE_LOW>; /* PE2 */
150			linux,input-type = <EV_KEY>;
151			linux,code = <KEY_VOLUMEDOWN>;
152		};
153	};
154
155	leds {
156		compatible = "gpio-leds";
157
158		led-0 {
159			function = LED_FUNCTION_POWER;
160			color = <LED_COLOR_ID_GREEN>;
161			gpios = <&pio 8 12 GPIO_ACTIVE_HIGH>; /* PI12 */
162			default-state = "on";
163		};
164	};
165
166	reg_vcc5v: regulator-vcc5v { /* USB-C power input */
167		compatible = "regulator-fixed";
168		regulator-name = "vcc-5v";
169		regulator-min-microvolt = <5000000>;
170		regulator-max-microvolt = <5000000>;
171	};
172};
173
174&cpu0 {
175	cpu-supply = <&reg_dcdc1>;
176};
177
178&ehci0 {
179	status = "okay";
180};
181
182&mmc0 {
183	vmmc-supply = <&reg_cldo3>;
184	disable-wp;
185	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;  /* PF6 */
186	bus-width = <4>;
187	status = "okay";
188};
189
190&ohci0 {
191	status = "okay";
192};
193
194&pio {
195	vcc-pa-supply = <&reg_cldo3>;
196	vcc-pc-supply = <&reg_cldo3>;
197	vcc-pe-supply = <&reg_cldo3>;
198	vcc-pf-supply = <&reg_cldo3>;
199	vcc-pg-supply = <&reg_aldo4>;
200	vcc-ph-supply = <&reg_cldo3>;
201	vcc-pi-supply = <&reg_cldo3>;
202};
203
204&r_rsb {
205	status = "okay";
206
207	axp717: pmic@3a3 {
208		compatible = "x-powers,axp717";
209		reg = <0x3a3>;
210		interrupt-controller;
211		#interrupt-cells = <1>;
212		interrupt-parent = <&nmi_intc>;
213		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
214
215		vin1-supply = <&reg_vcc5v>;
216		vin2-supply = <&reg_vcc5v>;
217		vin3-supply = <&reg_vcc5v>;
218		vin4-supply = <&reg_vcc5v>;
219
220		regulators {
221			reg_dcdc1: dcdc1 {
222				regulator-always-on;
223				regulator-min-microvolt = <900000>;
224				regulator-max-microvolt = <1160000>;
225				regulator-name = "vdd-cpu";
226			};
227
228			reg_dcdc2: dcdc2 {
229				regulator-always-on;
230				regulator-min-microvolt = <940000>;
231				regulator-max-microvolt = <940000>;
232				regulator-name = "vdd-gpu-sys";
233			};
234
235			reg_dcdc3: dcdc3 {
236				regulator-always-on;
237				regulator-min-microvolt = <1100000>;
238				regulator-max-microvolt = <1100000>;
239				regulator-name = "vdd-dram";
240			};
241
242			reg_aldo1: aldo1 {
243				/* 1.8v - unused */
244			};
245
246			reg_aldo2: aldo2 {
247				/* 1.8v - unused */
248			};
249
250			reg_aldo3: aldo3 {
251				/* 1.8v - unused */
252			};
253
254			reg_aldo4: aldo4 {
255				regulator-min-microvolt = <1800000>;
256				regulator-max-microvolt = <1800000>;
257				regulator-name = "vcc-pg";
258			};
259
260			reg_bldo1: bldo1 {
261				/* 1.8v - unused */
262			};
263
264			reg_bldo2: bldo2 {
265				regulator-always-on;
266				regulator-min-microvolt = <1800000>;
267				regulator-max-microvolt = <1800000>;
268				regulator-name = "vcc-pll";
269			};
270
271			reg_bldo3: bldo3 {
272				/* 2.8v - unused */
273			};
274
275			reg_bldo4: bldo4 {
276				/* 1.2v - unused */
277			};
278
279			reg_cldo1: cldo1 {
280				/* 3.3v - audio codec - not yet implemented */
281			};
282
283			reg_cldo2: cldo2 {
284				/* 3.3v - unused */
285			};
286
287			reg_cldo3: cldo3 {
288				regulator-always-on;
289				regulator-min-microvolt = <3300000>;
290				regulator-max-microvolt = <3300000>;
291				regulator-name = "vcc-io";
292			};
293
294			reg_cldo4: cldo4 {
295				regulator-min-microvolt = <3300000>;
296				regulator-max-microvolt = <3300000>;
297				regulator-name = "vcc-wifi";
298			};
299
300			reg_boost: boost {
301				regulator-min-microvolt = <5000000>;
302				regulator-max-microvolt = <5200000>;
303				regulator-name = "boost";
304			};
305
306			reg_cpusldo: cpusldo {
307				/* unused */
308			};
309		};
310	};
311};
312
313&uart0 {
314	pinctrl-names = "default";
315	pinctrl-0 = <&uart0_ph_pins>;
316	status = "okay";
317};
318
319/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */
320&usbotg {
321	dr_mode = "peripheral";   /* USB type-C receptable */
322	status = "okay";
323};
324
325&usbphy {
326	status = "okay";
327};
328