Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) |
| 2 | // Copyright (C) 2019 Icenowy Zheng <icenowy@aosc.xyz> |
| 3 | // Copyright (C) 2020 Martijn Braam <martijn@brixit.nl> |
| 4 | // Copyright (C) 2020 Ondrej Jirman <megous@megous.com> |
| 5 | |
| 6 | #include "sun50i-a64.dtsi" |
| 7 | #include "sun50i-a64-cpu-opp.dtsi" |
| 8 | |
| 9 | #include <dt-bindings/gpio/gpio.h> |
| 10 | #include <dt-bindings/input/input.h> |
| 11 | #include <dt-bindings/leds/common.h> |
| 12 | #include <dt-bindings/pwm/pwm.h> |
| 13 | |
| 14 | / { |
| 15 | aliases { |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 16 | ethernet0 = &rtl8723cs; |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 17 | serial0 = &uart0; |
| 18 | }; |
| 19 | |
| 20 | backlight: backlight { |
| 21 | compatible = "pwm-backlight"; |
| 22 | pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; |
| 23 | enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 24 | power-supply = <®_ps>; |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 25 | /* Backlight configuration differs per PinePhone revision. */ |
| 26 | }; |
| 27 | |
| 28 | chosen { |
| 29 | stdout-path = "serial0:115200n8"; |
| 30 | }; |
| 31 | |
| 32 | leds { |
| 33 | compatible = "gpio-leds"; |
| 34 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 35 | led-0 { |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 36 | function = LED_FUNCTION_INDICATOR; |
| 37 | color = <LED_COLOR_ID_BLUE>; |
| 38 | gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ |
| 39 | }; |
| 40 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 41 | led-1 { |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 42 | function = LED_FUNCTION_INDICATOR; |
| 43 | color = <LED_COLOR_ID_GREEN>; |
| 44 | gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */ |
| 45 | }; |
| 46 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 47 | led-2 { |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 48 | function = LED_FUNCTION_INDICATOR; |
| 49 | color = <LED_COLOR_ID_RED>; |
| 50 | gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ |
| 51 | }; |
| 52 | }; |
| 53 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 54 | reg_ps: ps-regulator { |
| 55 | compatible = "regulator-fixed"; |
| 56 | regulator-name = "ps"; |
| 57 | regulator-min-microvolt = <5000000>; |
| 58 | regulator-max-microvolt = <5000000>; |
| 59 | regulator-boot-on; |
| 60 | }; |
| 61 | |
| 62 | reg_vbat_wifi: vbat-wifi { |
| 63 | compatible = "regulator-fixed"; |
| 64 | regulator-min-microvolt = <3300000>; |
| 65 | regulator-max-microvolt = <3300000>; |
| 66 | regulator-name = "vbat-wifi"; |
| 67 | }; |
| 68 | |
| 69 | sgm3140: led-controller { |
| 70 | compatible = "sgmicro,sgm3140"; |
| 71 | vin-supply = <®_dcdc1>; |
| 72 | |
| 73 | sgm3140_flash: led { |
| 74 | function = LED_FUNCTION_FLASH; |
| 75 | color = <LED_COLOR_ID_WHITE>; |
| 76 | flash-max-timeout-us = <250000>; |
| 77 | }; |
| 78 | }; |
| 79 | |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 80 | speaker_amp: audio-amplifier { |
| 81 | compatible = "simple-audio-amplifier"; |
| 82 | enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */ |
| 83 | sound-name-prefix = "Speaker Amp"; |
| 84 | }; |
| 85 | |
| 86 | vibrator { |
| 87 | compatible = "gpio-vibrator"; |
| 88 | enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */ |
| 89 | vcc-supply = <®_dcdc1>; |
| 90 | }; |
| 91 | }; |
| 92 | |
| 93 | &codec { |
| 94 | status = "okay"; |
| 95 | }; |
| 96 | |
| 97 | &codec_analog { |
| 98 | cpvdd-supply = <®_eldo1>; |
| 99 | status = "okay"; |
| 100 | }; |
| 101 | |
| 102 | &cpu0 { |
| 103 | cpu-supply = <®_dcdc2>; |
| 104 | }; |
| 105 | |
| 106 | &cpu1 { |
| 107 | cpu-supply = <®_dcdc2>; |
| 108 | }; |
| 109 | |
| 110 | &cpu2 { |
| 111 | cpu-supply = <®_dcdc2>; |
| 112 | }; |
| 113 | |
| 114 | &cpu3 { |
| 115 | cpu-supply = <®_dcdc2>; |
| 116 | }; |
| 117 | |
| 118 | &dai { |
| 119 | status = "okay"; |
| 120 | }; |
| 121 | |
| 122 | &de { |
| 123 | status = "okay"; |
| 124 | }; |
| 125 | |
| 126 | &dphy { |
| 127 | status = "okay"; |
| 128 | }; |
| 129 | |
| 130 | &dsi { |
| 131 | vcc-dsi-supply = <®_dldo1>; |
| 132 | status = "okay"; |
| 133 | |
| 134 | panel@0 { |
| 135 | compatible = "xingbangda,xbd599"; |
| 136 | reg = <0>; |
| 137 | reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */ |
| 138 | iovcc-supply = <®_dldo2>; |
| 139 | vcc-supply = <®_ldo_io0>; |
| 140 | backlight = <&backlight>; |
| 141 | }; |
| 142 | }; |
| 143 | |
| 144 | &ehci0 { |
| 145 | status = "okay"; |
| 146 | }; |
| 147 | |
| 148 | &ehci1 { |
| 149 | status = "okay"; |
| 150 | }; |
| 151 | |
| 152 | &i2c0 { |
| 153 | status = "okay"; |
| 154 | |
| 155 | touchscreen@5d { |
| 156 | compatible = "goodix,gt917s"; |
| 157 | reg = <0x5d>; |
| 158 | interrupt-parent = <&pio>; |
| 159 | interrupts = <7 4 IRQ_TYPE_LEVEL_HIGH>; /* PH4 */ |
| 160 | irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ |
| 161 | reset-gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ |
| 162 | AVDD28-supply = <®_ldo_io0>; |
| 163 | VDDIO-supply = <®_ldo_io0>; |
| 164 | touchscreen-size-x = <720>; |
| 165 | touchscreen-size-y = <1440>; |
| 166 | }; |
| 167 | }; |
| 168 | |
| 169 | &i2c1 { |
| 170 | status = "okay"; |
| 171 | |
| 172 | /* Magnetometer */ |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 173 | lis3mdl: magnetometer@1e { |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 174 | compatible = "st,lis3mdl-magn"; |
| 175 | reg = <0x1e>; |
| 176 | vdd-supply = <®_dldo1>; |
| 177 | vddio-supply = <®_dldo1>; |
| 178 | }; |
| 179 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 180 | /* Light/proximity sensor */ |
| 181 | light-sensor@48 { |
| 182 | compatible = "sensortek,stk3311"; |
| 183 | reg = <0x48>; |
| 184 | interrupt-parent = <&pio>; |
| 185 | interrupts = <1 0 IRQ_TYPE_EDGE_FALLING>; /* PB0 */ |
| 186 | }; |
| 187 | |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 188 | /* Accelerometer/gyroscope */ |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 189 | accelerometer@68 { |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 190 | compatible = "invensense,mpu6050"; |
| 191 | reg = <0x68>; |
| 192 | interrupt-parent = <&pio>; |
| 193 | interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */ |
| 194 | vdd-supply = <®_dldo1>; |
| 195 | vddio-supply = <®_dldo1>; |
| 196 | }; |
| 197 | }; |
| 198 | |
| 199 | /* Connected to pogo pins (external spring based pinheader for user addons) */ |
| 200 | &i2c2 { |
| 201 | status = "okay"; |
| 202 | }; |
| 203 | |
| 204 | &lradc { |
| 205 | vref-supply = <®_aldo3>; |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 206 | wakeup-source; |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 207 | status = "okay"; |
| 208 | |
| 209 | button-200 { |
| 210 | label = "Volume Up"; |
| 211 | linux,code = <KEY_VOLUMEUP>; |
| 212 | channel = <0>; |
| 213 | voltage = <200000>; |
| 214 | }; |
| 215 | |
| 216 | button-400 { |
| 217 | label = "Volume Down"; |
| 218 | linux,code = <KEY_VOLUMEDOWN>; |
| 219 | channel = <0>; |
| 220 | voltage = <400000>; |
| 221 | }; |
| 222 | }; |
| 223 | |
| 224 | &mmc0 { |
| 225 | pinctrl-names = "default"; |
| 226 | pinctrl-0 = <&mmc0_pins>; |
| 227 | vmmc-supply = <®_dcdc1>; |
| 228 | vqmmc-supply = <®_dcdc1>; |
| 229 | cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ |
| 230 | disable-wp; |
| 231 | bus-width = <4>; |
| 232 | status = "okay"; |
| 233 | }; |
| 234 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 235 | &mmc1 { |
| 236 | pinctrl-names = "default"; |
| 237 | pinctrl-0 = <&mmc1_pins>; |
| 238 | vmmc-supply = <®_vbat_wifi>; |
| 239 | vqmmc-supply = <®_dldo4>; |
| 240 | bus-width = <4>; |
| 241 | non-removable; |
| 242 | status = "okay"; |
| 243 | |
| 244 | rtl8723cs: wifi@1 { |
| 245 | reg = <1>; |
| 246 | }; |
| 247 | }; |
| 248 | |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 249 | &mmc2 { |
| 250 | pinctrl-names = "default"; |
| 251 | pinctrl-0 = <&mmc2_pins>; |
| 252 | vmmc-supply = <®_dcdc1>; |
| 253 | vqmmc-supply = <®_dcdc1>; |
| 254 | bus-width = <8>; |
| 255 | non-removable; |
| 256 | cap-mmc-hw-reset; |
| 257 | status = "okay"; |
| 258 | }; |
| 259 | |
| 260 | &ohci0 { |
| 261 | status = "okay"; |
| 262 | }; |
| 263 | |
| 264 | &ohci1 { |
| 265 | status = "okay"; |
| 266 | }; |
| 267 | |
| 268 | &pio { |
| 269 | vcc-pb-supply = <®_dcdc1>; |
| 270 | vcc-pc-supply = <®_dcdc1>; |
| 271 | vcc-pd-supply = <®_dcdc1>; |
| 272 | vcc-pe-supply = <®_aldo1>; |
| 273 | vcc-pf-supply = <®_dcdc1>; |
| 274 | vcc-pg-supply = <®_dldo4>; |
| 275 | vcc-ph-supply = <®_dcdc1>; |
| 276 | }; |
| 277 | |
| 278 | &r_pio { |
| 279 | /* |
| 280 | * FIXME: We can't add that supply for now since it would |
| 281 | * create a circular dependency between pinctrl, the regulator |
| 282 | * and the RSB Bus. |
| 283 | * |
| 284 | * vcc-pl-supply = <®_aldo2>; |
| 285 | */ |
| 286 | }; |
| 287 | |
| 288 | &r_pwm { |
| 289 | status = "okay"; |
| 290 | }; |
| 291 | |
| 292 | &r_rsb { |
| 293 | status = "okay"; |
| 294 | |
| 295 | axp803: pmic@3a3 { |
| 296 | compatible = "x-powers,axp803"; |
| 297 | reg = <0x3a3>; |
| 298 | interrupt-parent = <&r_intc>; |
| 299 | interrupts = <0 IRQ_TYPE_LEVEL_LOW>; |
| 300 | }; |
| 301 | }; |
| 302 | |
| 303 | #include "axp803.dtsi" |
| 304 | |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 305 | &battery_power_supply { |
| 306 | status = "okay"; |
| 307 | }; |
| 308 | |
| 309 | ®_aldo1 { |
| 310 | regulator-min-microvolt = <1800000>; |
| 311 | regulator-max-microvolt = <1800000>; |
| 312 | regulator-name = "dovdd-csi"; |
| 313 | }; |
| 314 | |
| 315 | ®_aldo2 { |
| 316 | regulator-always-on; |
| 317 | regulator-min-microvolt = <1800000>; |
| 318 | regulator-max-microvolt = <1800000>; |
| 319 | regulator-name = "vcc-pl"; |
| 320 | }; |
| 321 | |
| 322 | ®_aldo3 { |
| 323 | regulator-always-on; |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 324 | regulator-min-microvolt = <3000000>; |
| 325 | regulator-max-microvolt = <3000000>; |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 326 | regulator-name = "vcc-pll-avcc"; |
| 327 | }; |
| 328 | |
| 329 | ®_dcdc1 { |
| 330 | regulator-always-on; |
| 331 | regulator-min-microvolt = <3300000>; |
| 332 | regulator-max-microvolt = <3300000>; |
| 333 | regulator-name = "vcc-3v3"; |
| 334 | }; |
| 335 | |
| 336 | ®_dcdc2 { |
| 337 | regulator-always-on; |
| 338 | regulator-min-microvolt = <1000000>; |
| 339 | regulator-max-microvolt = <1300000>; |
| 340 | regulator-name = "vdd-cpux"; |
| 341 | }; |
| 342 | |
| 343 | /* DCDC3 is polyphased with DCDC2 */ |
| 344 | |
| 345 | ®_dcdc5 { |
| 346 | regulator-always-on; |
| 347 | regulator-min-microvolt = <1200000>; |
| 348 | regulator-max-microvolt = <1200000>; |
| 349 | regulator-name = "vcc-dram"; |
| 350 | }; |
| 351 | |
| 352 | ®_dcdc6 { |
| 353 | regulator-always-on; |
| 354 | regulator-min-microvolt = <1100000>; |
| 355 | regulator-max-microvolt = <1100000>; |
| 356 | regulator-name = "vdd-sys"; |
| 357 | }; |
| 358 | |
| 359 | ®_dldo1 { |
| 360 | regulator-min-microvolt = <3300000>; |
| 361 | regulator-max-microvolt = <3300000>; |
| 362 | regulator-name = "vcc-dsi-sensor"; |
| 363 | }; |
| 364 | |
| 365 | ®_dldo2 { |
| 366 | regulator-min-microvolt = <1800000>; |
| 367 | regulator-max-microvolt = <1800000>; |
| 368 | regulator-name = "vcc-mipi-io"; |
| 369 | }; |
| 370 | |
| 371 | ®_dldo3 { |
| 372 | regulator-min-microvolt = <2800000>; |
| 373 | regulator-max-microvolt = <2800000>; |
| 374 | regulator-name = "avdd-csi"; |
| 375 | }; |
| 376 | |
| 377 | ®_dldo4 { |
| 378 | regulator-min-microvolt = <1800000>; |
| 379 | regulator-max-microvolt = <1800000>; |
| 380 | regulator-name = "vcc-wifi-io"; |
| 381 | }; |
| 382 | |
| 383 | ®_eldo1 { |
| 384 | regulator-always-on; |
| 385 | regulator-min-microvolt = <1800000>; |
| 386 | regulator-max-microvolt = <1800000>; |
| 387 | regulator-name = "vcc-lpddr"; |
| 388 | }; |
| 389 | |
| 390 | ®_eldo3 { |
| 391 | regulator-min-microvolt = <1800000>; |
| 392 | regulator-max-microvolt = <1800000>; |
| 393 | regulator-name = "dvdd-1v8-csi"; |
| 394 | }; |
| 395 | |
| 396 | ®_fldo1 { |
| 397 | regulator-min-microvolt = <1200000>; |
| 398 | regulator-max-microvolt = <1200000>; |
| 399 | regulator-name = "vcc-1v2-hsic"; |
| 400 | }; |
| 401 | |
| 402 | ®_fldo2 { |
| 403 | regulator-always-on; |
| 404 | regulator-min-microvolt = <1100000>; |
| 405 | regulator-max-microvolt = <1100000>; |
| 406 | regulator-name = "vdd-cpus"; |
| 407 | }; |
| 408 | |
| 409 | ®_ldo_io0 { |
| 410 | regulator-min-microvolt = <3300000>; |
| 411 | regulator-max-microvolt = <3300000>; |
| 412 | regulator-name = "vcc-lcd-ctp-stk"; |
| 413 | status = "okay"; |
| 414 | }; |
| 415 | |
| 416 | ®_ldo_io1 { |
| 417 | regulator-min-microvolt = <1800000>; |
| 418 | regulator-max-microvolt = <1800000>; |
| 419 | regulator-name = "vcc-1v8-typec"; |
| 420 | status = "okay"; |
| 421 | }; |
| 422 | |
| 423 | ®_rtc_ldo { |
| 424 | regulator-name = "vcc-rtc"; |
| 425 | }; |
| 426 | |
| 427 | &sound { |
| 428 | status = "okay"; |
| 429 | simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; |
| 430 | simple-audio-card,widgets = "Microphone", "Headset Microphone", |
| 431 | "Microphone", "Internal Microphone", |
| 432 | "Headphone", "Headphone Jack", |
| 433 | "Speaker", "Internal Earpiece", |
| 434 | "Speaker", "Internal Speaker"; |
| 435 | simple-audio-card,routing = |
| 436 | "Headphone Jack", "HP", |
| 437 | "Internal Earpiece", "EARPIECE", |
| 438 | "Internal Speaker", "Speaker Amp OUTL", |
| 439 | "Internal Speaker", "Speaker Amp OUTR", |
| 440 | "Speaker Amp INL", "LINEOUT", |
| 441 | "Speaker Amp INR", "LINEOUT", |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 442 | "Left DAC", "DACL", |
| 443 | "Right DAC", "DACR", |
| 444 | "ADCL", "Left ADC", |
| 445 | "ADCR", "Right ADC", |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 446 | "Internal Microphone", "MBIAS", |
| 447 | "MIC1", "Internal Microphone", |
| 448 | "Headset Microphone", "HBIAS", |
| 449 | "MIC2", "Headset Microphone"; |
| 450 | }; |
| 451 | |
| 452 | &uart0 { |
| 453 | pinctrl-names = "default"; |
| 454 | pinctrl-0 = <&uart0_pb_pins>; |
| 455 | status = "okay"; |
| 456 | }; |
| 457 | |
Andre Przywara | fb67547 | 2021-04-17 22:55:19 +0100 | [diff] [blame] | 458 | &uart1 { |
| 459 | pinctrl-names = "default"; |
| 460 | pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>; |
| 461 | status = "okay"; |
| 462 | |
| 463 | bluetooth { |
| 464 | compatible = "realtek,rtl8723cs-bt"; |
| 465 | device-wake-gpios = <&pio 7 6 GPIO_ACTIVE_LOW>; /* PH6 */ |
| 466 | enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */ |
| 467 | host-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */ |
| 468 | }; |
| 469 | }; |
| 470 | |
Samuel Holland | 26bc4e7 | 2020-10-24 10:21:55 -0500 | [diff] [blame] | 471 | /* Connected to the modem (hardware flow control can't be used) */ |
| 472 | &uart3 { |
| 473 | pinctrl-names = "default"; |
| 474 | pinctrl-0 = <&uart3_pins>; |
| 475 | status = "okay"; |
| 476 | }; |
| 477 | |
| 478 | &usb_otg { |
| 479 | dr_mode = "peripheral"; |
| 480 | status = "okay"; |
| 481 | }; |
| 482 | |
| 483 | &usb_power_supply { |
| 484 | status = "okay"; |
| 485 | }; |
| 486 | |
| 487 | &usbphy { |
| 488 | status = "okay"; |
| 489 | }; |