1// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2/* 3 * Copyright (C) 2024 Ryan Walklin <[email protected]>. 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 battery: battery { 25 compatible = "simple-battery"; 26 constant-charge-current-max-microamp = <1024000>; 27 voltage-max-design-microvolt = <4200000>; 28 }; 29 30 chosen { 31 stdout-path = "serial0:115200n8"; 32 }; 33 34 gpio_keys_gamepad: gpio-keys-gamepad { 35 compatible = "gpio-keys"; 36 37 button-a { 38 label = "Action-Pad A"; 39 gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */ 40 linux,input-type = <EV_KEY>; 41 linux,code = <BTN_EAST>; 42 }; 43 44 button-b { 45 label = "Action-Pad B"; 46 gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */ 47 linux,input-type = <EV_KEY>; 48 linux,code = <BTN_SOUTH>; 49 }; 50 51 button-down { 52 label = "D-Pad Down"; 53 gpios = <&pio 4 0 GPIO_ACTIVE_LOW>; /* PE0 */ 54 linux,input-type = <EV_KEY>; 55 linux,code = <BTN_DPAD_DOWN>; 56 }; 57 58 button-l1 { 59 label = "Key L1"; 60 gpios = <&pio 0 10 GPIO_ACTIVE_LOW>; /* PA10 */ 61 linux,input-type = <EV_KEY>; 62 linux,code = <BTN_TL>; 63 }; 64 65 button-l2 { 66 label = "Key L2"; 67 gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */ 68 linux,input-type = <EV_KEY>; 69 linux,code = <BTN_TL2>; 70 }; 71 72 button-left { 73 label = "D-Pad left"; 74 gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */ 75 linux,input-type = <EV_KEY>; 76 linux,code = <BTN_DPAD_LEFT>; 77 }; 78 79 button-menu { 80 label = "Key Menu"; 81 gpios = <&pio 4 3 GPIO_ACTIVE_LOW>; /* PE3 */ 82 linux,input-type = <EV_KEY>; 83 linux,code = <BTN_MODE>; 84 }; 85 86 button-r1 { 87 label = "Key R1"; 88 gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */ 89 linux,input-type = <EV_KEY>; 90 linux,code = <BTN_TR>; 91 }; 92 93 button-r2 { 94 label = "Key R2"; 95 gpios = <&pio 0 7 GPIO_ACTIVE_LOW>; /* PA7 */ 96 linux,input-type = <EV_KEY>; 97 linux,code = <BTN_TR2>; 98 }; 99 100 button-right { 101 label = "D-Pad Right"; 102 gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */ 103 linux,input-type = <EV_KEY>; 104 linux,code = <BTN_DPAD_RIGHT>; 105 }; 106 107 button-select { 108 label = "Key Select"; 109 gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */ 110 linux,input-type = <EV_KEY>; 111 linux,code = <BTN_SELECT>; 112 }; 113 button-start { 114 label = "Key Start"; 115 gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */ 116 linux,input-type = <EV_KEY>; 117 linux,code = <BTN_START>; 118 }; 119 120 button-up { 121 label = "D-Pad Up"; 122 gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */ 123 linux,input-type = <EV_KEY>; 124 linux,code = <BTN_DPAD_UP>; 125 }; 126 127 button-x { 128 label = "Action-Pad X"; 129 gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */ 130 linux,input-type = <EV_KEY>; 131 linux,code = <BTN_NORTH>; 132 }; 133 134 button-y { 135 label = "Action Pad Y"; 136 gpios = <&pio 0 2 GPIO_ACTIVE_LOW>; /* PA2 */ 137 linux,input-type = <EV_KEY>; 138 linux,code = <BTN_WEST>; 139 }; 140 }; 141 142 gpio-keys-volume { 143 compatible = "gpio-keys"; 144 autorepeat; 145 146 button-vol-up { 147 label = "Key Volume Up"; 148 gpios = <&pio 4 1 GPIO_ACTIVE_LOW>; /* PE1 */ 149 linux,input-type = <EV_KEY>; 150 linux,code = <KEY_VOLUMEUP>; 151 }; 152 153 button-vol-down { 154 label = "Key Volume Down"; 155 gpios = <&pio 4 2 GPIO_ACTIVE_LOW>; /* PE2 */ 156 linux,input-type = <EV_KEY>; 157 linux,code = <KEY_VOLUMEDOWN>; 158 }; 159 }; 160 161 leds { 162 compatible = "gpio-leds"; 163 164 led-0 { 165 function = LED_FUNCTION_POWER; 166 color = <LED_COLOR_ID_GREEN>; 167 gpios = <&pio 8 12 GPIO_ACTIVE_HIGH>; /* PI12 */ 168 default-state = "on"; 169 }; 170 171 led-1 { 172 function = LED_FUNCTION_STATUS; 173 color = <LED_COLOR_ID_GREEN>; 174 gpios = <&pio 8 11 GPIO_ACTIVE_HIGH>; /* PI11 */ 175 }; 176 }; 177 178 reg_vcc5v: regulator-vcc5v { /* USB-C power input */ 179 compatible = "regulator-fixed"; 180 regulator-name = "vcc-5v"; 181 regulator-min-microvolt = <5000000>; 182 regulator-max-microvolt = <5000000>; 183 }; 184}; 185 186&codec { 187 allwinner,audio-routing = "Line Out", "LINEOUT"; 188 allwinner,pa-gpios = <&pio 8 5 GPIO_ACTIVE_HIGH>; // PI5 189 status = "okay"; 190}; 191 192&cpu0 { 193 cpu-supply = <®_dcdc1>; 194}; 195 196&ehci0 { 197 status = "okay"; 198}; 199 200&mmc0 { 201 vmmc-supply = <®_cldo3>; 202 disable-wp; 203 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ 204 bus-width = <4>; 205 status = "okay"; 206}; 207 208&ohci0 { 209 status = "okay"; 210}; 211 212&pio { 213 vcc-pa-supply = <®_cldo3>; 214 vcc-pc-supply = <®_cldo3>; 215 vcc-pe-supply = <®_cldo3>; 216 vcc-pf-supply = <®_cldo3>; 217 vcc-pg-supply = <®_aldo4>; 218 vcc-ph-supply = <®_cldo3>; 219 vcc-pi-supply = <®_cldo3>; 220}; 221 222&r_i2c { 223 status = "okay"; 224 225 axp717: pmic@34 { 226 compatible = "x-powers,axp717"; 227 reg = <0x34>; 228 interrupt-controller; 229 #interrupt-cells = <1>; 230 interrupt-parent = <&nmi_intc>; 231 interrupts = <0 IRQ_TYPE_LEVEL_LOW>; 232 233 vin1-supply = <®_vcc5v>; 234 vin2-supply = <®_vcc5v>; 235 vin3-supply = <®_vcc5v>; 236 vin4-supply = <®_vcc5v>; 237 238 axp_adc: adc { 239 compatible = "x-powers,axp717-adc"; 240 #io-channel-cells = <1>; 241 }; 242 243 battery_power: battery-power { 244 compatible = "x-powers,axp717-battery-power-supply"; 245 monitored-battery = <&battery>; 246 x-powers,no-thermistor; 247 }; 248 249 regulators { 250 reg_dcdc1: dcdc1 { 251 regulator-always-on; 252 regulator-min-microvolt = <900000>; 253 regulator-max-microvolt = <1160000>; 254 regulator-name = "vdd-cpu"; 255 }; 256 257 reg_dcdc2: dcdc2 { 258 regulator-always-on; 259 regulator-min-microvolt = <940000>; 260 regulator-max-microvolt = <940000>; 261 regulator-name = "vdd-gpu-sys"; 262 }; 263 264 reg_dcdc3: dcdc3 { 265 regulator-always-on; 266 regulator-min-microvolt = <1100000>; 267 regulator-max-microvolt = <1100000>; 268 regulator-name = "vdd-dram"; 269 }; 270 271 reg_aldo1: aldo1 { 272 /* 1.8v - unused */ 273 }; 274 275 reg_aldo2: aldo2 { 276 /* 1.8v - unused */ 277 }; 278 279 reg_aldo3: aldo3 { 280 /* 1.8v - unused */ 281 }; 282 283 reg_aldo4: aldo4 { 284 regulator-min-microvolt = <1800000>; 285 regulator-max-microvolt = <1800000>; 286 regulator-name = "avcc"; 287 }; 288 289 reg_bldo1: bldo1 { 290 /* 1.8v - unused */ 291 }; 292 293 reg_bldo2: bldo2 { 294 regulator-always-on; 295 regulator-min-microvolt = <1800000>; 296 regulator-max-microvolt = <1800000>; 297 regulator-name = "vcc-pll"; 298 }; 299 300 reg_bldo3: bldo3 { 301 /* 2.8v - unused */ 302 }; 303 304 reg_bldo4: bldo4 { 305 /* 1.2v - unused */ 306 }; 307 308 reg_cldo1: cldo1 { 309 regulator-always-on; 310 regulator-min-microvolt = <3300000>; 311 regulator-max-microvolt = <3300000>; 312 regulator-name = "vcc-spkr-amp"; 313 }; 314 315 reg_cldo2: cldo2 { 316 /* 3.3v - unused */ 317 }; 318 319 reg_cldo3: cldo3 { 320 regulator-always-on; 321 regulator-min-microvolt = <3300000>; 322 regulator-max-microvolt = <3300000>; 323 regulator-name = "vcc-io"; 324 }; 325 326 reg_cldo4: cldo4 { 327 regulator-min-microvolt = <3300000>; 328 regulator-max-microvolt = <3300000>; 329 regulator-name = "vcc-wifi"; 330 }; 331 332 reg_boost: boost { 333 regulator-min-microvolt = <5000000>; 334 regulator-max-microvolt = <5200000>; 335 regulator-name = "boost"; 336 }; 337 338 /* 339 * Regulator function is unknown, but reading 340 * GPIO values in bootloader is inconsistent 341 * on reboot if this is disabled. Setting to 342 * default value from regulator OTP mem. 343 */ 344 reg_cpusldo: cpusldo { 345 regulator-always-on; 346 regulator-boot-on; 347 regulator-min-microvolt = <900000>; 348 regulator-max-microvolt = <900000>; 349 }; 350 }; 351 352 usb_power: usb-power { 353 compatible = "x-powers,axp717-usb-power-supply"; 354 input-current-limit-microamp = <1500000>; 355 }; 356 }; 357}; 358 359&uart0 { 360 pinctrl-names = "default"; 361 pinctrl-0 = <&uart0_ph_pins>; 362 status = "okay"; 363}; 364 365/* the AXP717 has USB type-C role switch functionality, not yet described by the binding */ 366&usbotg { 367 dr_mode = "peripheral"; /* USB type-C receptable */ 368 status = "okay"; 369}; 370 371&usbphy { 372 status = "okay"; 373}; 374