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 { 16 serial0 = &uart0; 17 }; 18 19 backlight: backlight { 20 compatible = "pwm-backlight"; 21 pwms = <&r_pwm 0 50000 PWM_POLARITY_INVERTED>; 22 enable-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */ 23 /* Backlight configuration differs per PinePhone revision. */ 24 }; 25 26 chosen { 27 stdout-path = "serial0:115200n8"; 28 }; 29 30 leds { 31 compatible = "gpio-leds"; 32 33 blue { 34 function = LED_FUNCTION_INDICATOR; 35 color = <LED_COLOR_ID_BLUE>; 36 gpios = <&pio 3 20 GPIO_ACTIVE_HIGH>; /* PD20 */ 37 }; 38 39 green { 40 function = LED_FUNCTION_INDICATOR; 41 color = <LED_COLOR_ID_GREEN>; 42 gpios = <&pio 3 18 GPIO_ACTIVE_HIGH>; /* PD18 */ 43 }; 44 45 red { 46 function = LED_FUNCTION_INDICATOR; 47 color = <LED_COLOR_ID_RED>; 48 gpios = <&pio 3 19 GPIO_ACTIVE_HIGH>; /* PD19 */ 49 }; 50 }; 51 52 speaker_amp: audio-amplifier { 53 compatible = "simple-audio-amplifier"; 54 enable-gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */ 55 sound-name-prefix = "Speaker Amp"; 56 }; 57 58 vibrator { 59 compatible = "gpio-vibrator"; 60 enable-gpios = <&pio 3 2 GPIO_ACTIVE_HIGH>; /* PD2 */ 61 vcc-supply = <®_dcdc1>; 62 }; 63}; 64 65&codec { 66 status = "okay"; 67}; 68 69&codec_analog { 70 cpvdd-supply = <®_eldo1>; 71 status = "okay"; 72}; 73 74&cpu0 { 75 cpu-supply = <®_dcdc2>; 76}; 77 78&cpu1 { 79 cpu-supply = <®_dcdc2>; 80}; 81 82&cpu2 { 83 cpu-supply = <®_dcdc2>; 84}; 85 86&cpu3 { 87 cpu-supply = <®_dcdc2>; 88}; 89 90&dai { 91 status = "okay"; 92}; 93 94&de { 95 status = "okay"; 96}; 97 98&dphy { 99 status = "okay"; 100}; 101 102&dsi { 103 vcc-dsi-supply = <®_dldo1>; 104 status = "okay"; 105 106 panel@0 { 107 compatible = "xingbangda,xbd599"; 108 reg = <0>; 109 reset-gpios = <&pio 3 23 GPIO_ACTIVE_LOW>; /* PD23 */ 110 iovcc-supply = <®_dldo2>; 111 vcc-supply = <®_ldo_io0>; 112 backlight = <&backlight>; 113 }; 114}; 115 116&ehci0 { 117 status = "okay"; 118}; 119 120&ehci1 { 121 status = "okay"; 122}; 123 124&i2c1 { 125 status = "okay"; 126 127 /* Magnetometer */ 128 lis3mdl@1e { 129 compatible = "st,lis3mdl-magn"; 130 reg = <0x1e>; 131 vdd-supply = <®_dldo1>; 132 vddio-supply = <®_dldo1>; 133 }; 134 135 /* Accelerometer/gyroscope */ 136 mpu6050@68 { 137 compatible = "invensense,mpu6050"; 138 reg = <0x68>; 139 interrupt-parent = <&pio>; 140 interrupts = <7 5 IRQ_TYPE_EDGE_RISING>; /* PH5 */ 141 vdd-supply = <®_dldo1>; 142 vddio-supply = <®_dldo1>; 143 }; 144}; 145 146/* Connected to pogo pins (external spring based pinheader for user addons) */ 147&i2c2 { 148 status = "okay"; 149}; 150 151&lradc { 152 vref-supply = <®_aldo3>; 153 status = "okay"; 154 155 button-200 { 156 label = "Volume Up"; 157 linux,code = <KEY_VOLUMEUP>; 158 channel = <0>; 159 voltage = <200000>; 160 }; 161 162 button-400 { 163 label = "Volume Down"; 164 linux,code = <KEY_VOLUMEDOWN>; 165 channel = <0>; 166 voltage = <400000>; 167 }; 168}; 169 170&mmc0 { 171 pinctrl-names = "default"; 172 pinctrl-0 = <&mmc0_pins>; 173 vmmc-supply = <®_dcdc1>; 174 vqmmc-supply = <®_dcdc1>; 175 cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ 176 disable-wp; 177 bus-width = <4>; 178 status = "okay"; 179}; 180 181&mmc2 { 182 pinctrl-names = "default"; 183 pinctrl-0 = <&mmc2_pins>; 184 vmmc-supply = <®_dcdc1>; 185 vqmmc-supply = <®_dcdc1>; 186 bus-width = <8>; 187 non-removable; 188 cap-mmc-hw-reset; 189 status = "okay"; 190}; 191 192&ohci0 { 193 status = "okay"; 194}; 195 196&ohci1 { 197 status = "okay"; 198}; 199 200&pio { 201 vcc-pb-supply = <®_dcdc1>; 202 vcc-pc-supply = <®_dcdc1>; 203 vcc-pd-supply = <®_dcdc1>; 204 vcc-pe-supply = <®_aldo1>; 205 vcc-pf-supply = <®_dcdc1>; 206 vcc-pg-supply = <®_dldo4>; 207 vcc-ph-supply = <®_dcdc1>; 208}; 209 210&r_pio { 211 /* 212 * FIXME: We can't add that supply for now since it would 213 * create a circular dependency between pinctrl, the regulator 214 * and the RSB Bus. 215 * 216 * vcc-pl-supply = <®_aldo2>; 217 */ 218}; 219 220&r_pwm { 221 status = "okay"; 222}; 223 224&r_rsb { 225 status = "okay"; 226 227 axp803: pmic@3a3 { 228 compatible = "x-powers,axp803"; 229 reg = <0x3a3>; 230 interrupt-parent = <&r_intc>; 231 interrupts = <0 IRQ_TYPE_LEVEL_LOW>; 232 }; 233}; 234 235#include "axp803.dtsi" 236 237&ac_power_supply { 238 status = "okay"; 239}; 240 241&battery_power_supply { 242 status = "okay"; 243}; 244 245®_aldo1 { 246 regulator-min-microvolt = <1800000>; 247 regulator-max-microvolt = <1800000>; 248 regulator-name = "dovdd-csi"; 249}; 250 251®_aldo2 { 252 regulator-always-on; 253 regulator-min-microvolt = <1800000>; 254 regulator-max-microvolt = <1800000>; 255 regulator-name = "vcc-pl"; 256}; 257 258®_aldo3 { 259 regulator-always-on; 260 regulator-min-microvolt = <2700000>; 261 regulator-max-microvolt = <3300000>; 262 regulator-name = "vcc-pll-avcc"; 263}; 264 265®_dcdc1 { 266 regulator-always-on; 267 regulator-min-microvolt = <3300000>; 268 regulator-max-microvolt = <3300000>; 269 regulator-name = "vcc-3v3"; 270}; 271 272®_dcdc2 { 273 regulator-always-on; 274 regulator-min-microvolt = <1000000>; 275 regulator-max-microvolt = <1300000>; 276 regulator-name = "vdd-cpux"; 277}; 278 279/* DCDC3 is polyphased with DCDC2 */ 280 281®_dcdc5 { 282 regulator-always-on; 283 regulator-min-microvolt = <1200000>; 284 regulator-max-microvolt = <1200000>; 285 regulator-name = "vcc-dram"; 286}; 287 288®_dcdc6 { 289 regulator-always-on; 290 regulator-min-microvolt = <1100000>; 291 regulator-max-microvolt = <1100000>; 292 regulator-name = "vdd-sys"; 293}; 294 295®_dldo1 { 296 regulator-min-microvolt = <3300000>; 297 regulator-max-microvolt = <3300000>; 298 regulator-name = "vcc-dsi-sensor"; 299}; 300 301®_dldo2 { 302 regulator-min-microvolt = <1800000>; 303 regulator-max-microvolt = <1800000>; 304 regulator-name = "vcc-mipi-io"; 305}; 306 307®_dldo3 { 308 regulator-min-microvolt = <2800000>; 309 regulator-max-microvolt = <2800000>; 310 regulator-name = "avdd-csi"; 311}; 312 313®_dldo4 { 314 regulator-min-microvolt = <1800000>; 315 regulator-max-microvolt = <3300000>; 316 regulator-name = "vcc-wifi-io"; 317}; 318 319®_eldo1 { 320 regulator-always-on; 321 regulator-min-microvolt = <1800000>; 322 regulator-max-microvolt = <1800000>; 323 regulator-name = "vcc-lpddr"; 324}; 325 326®_eldo3 { 327 regulator-min-microvolt = <1800000>; 328 regulator-max-microvolt = <1800000>; 329 regulator-name = "dvdd-1v8-csi"; 330}; 331 332®_fldo1 { 333 regulator-min-microvolt = <1200000>; 334 regulator-max-microvolt = <1200000>; 335 regulator-name = "vcc-1v2-hsic"; 336}; 337 338®_fldo2 { 339 regulator-always-on; 340 regulator-min-microvolt = <1100000>; 341 regulator-max-microvolt = <1100000>; 342 regulator-name = "vdd-cpus"; 343}; 344 345®_ldo_io0 { 346 regulator-min-microvolt = <3300000>; 347 regulator-max-microvolt = <3300000>; 348 regulator-name = "vcc-lcd-ctp-stk"; 349 status = "okay"; 350}; 351 352®_ldo_io1 { 353 regulator-min-microvolt = <1800000>; 354 regulator-max-microvolt = <1800000>; 355 regulator-name = "vcc-1v8-typec"; 356 status = "okay"; 357}; 358 359®_rtc_ldo { 360 regulator-name = "vcc-rtc"; 361}; 362 363&sound { 364 status = "okay"; 365 simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>; 366 simple-audio-card,widgets = "Microphone", "Headset Microphone", 367 "Microphone", "Internal Microphone", 368 "Headphone", "Headphone Jack", 369 "Speaker", "Internal Earpiece", 370 "Speaker", "Internal Speaker"; 371 simple-audio-card,routing = 372 "Headphone Jack", "HP", 373 "Internal Earpiece", "EARPIECE", 374 "Internal Speaker", "Speaker Amp OUTL", 375 "Internal Speaker", "Speaker Amp OUTR", 376 "Speaker Amp INL", "LINEOUT", 377 "Speaker Amp INR", "LINEOUT", 378 "Left DAC", "AIF1 Slot 0 Left", 379 "Right DAC", "AIF1 Slot 0 Right", 380 "AIF1 Slot 0 Left ADC", "Left ADC", 381 "AIF1 Slot 0 Right ADC", "Right ADC", 382 "Internal Microphone", "MBIAS", 383 "MIC1", "Internal Microphone", 384 "Headset Microphone", "HBIAS", 385 "MIC2", "Headset Microphone"; 386}; 387 388&uart0 { 389 pinctrl-names = "default"; 390 pinctrl-0 = <&uart0_pb_pins>; 391 status = "okay"; 392}; 393 394/* Connected to the modem (hardware flow control can't be used) */ 395&uart3 { 396 pinctrl-names = "default"; 397 pinctrl-0 = <&uart3_pins>; 398 status = "okay"; 399}; 400 401&usb_otg { 402 dr_mode = "peripheral"; 403 status = "okay"; 404}; 405 406&usb_power_supply { 407 status = "okay"; 408}; 409 410&usbphy { 411 status = "okay"; 412}; 413