1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2/* 3 * Copyright (c) 2019 BayLibre, SAS 4 * Author: Neil Armstrong <narmstrong@baylibre.com> 5 * Copyright (c) 2023 Christian Hewitt <christianshewitt@gmail.com> 6 */ 7 8#include <dt-bindings/input/input.h> 9#include <dt-bindings/leds/common.h> 10#include <dt-bindings/gpio/meson-g12a-gpio.h> 11#include <dt-bindings/sound/meson-g12a-tohdmitx.h> 12 13/ { 14 aliases { 15 serial0 = &uart_AO; 16 ethernet0 = ðmac; 17 rtc1 = &vrtc; 18 }; 19 20 chosen { 21 stdout-path = "serial0:115200n8"; 22 }; 23 24 memory@0 { 25 device_type = "memory"; 26 reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 4 GiB */ 27 }; 28 29 adc-keys { 30 compatible = "adc-keys"; 31 io-channels = <&saradc 2>; 32 io-channel-names = "buttons"; 33 keyup-threshold-microvolt = <1710000>; 34 35 button-function { 36 label = "RST"; 37 linux,code = <KEY_POWER>; 38 press-threshold-microvolt = <10000>; 39 }; 40 }; 41 42 emmc_pwrseq: emmc-pwrseq { 43 compatible = "mmc-pwrseq-emmc"; 44 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; 45 }; 46 47 fan0: pwm-fan { 48 compatible = "pwm-fan"; 49 #cooling-cells = <2>; 50 cooling-levels = <0 120 170 220>; 51 pwms = <&pwm_cd 1 40000 0>; 52 }; 53 54 hdmi-connector { 55 compatible = "hdmi-connector"; 56 type = "a"; 57 58 port { 59 hdmi_connector_in: endpoint { 60 remote-endpoint = <&hdmi_tx_tmds_out>; 61 }; 62 }; 63 }; 64 65 leds { 66 compatible = "gpio-leds"; 67 68 led-0 { 69 color = <LED_COLOR_ID_BLUE>; 70 function = LED_FUNCTION_STATUS; 71 gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>; 72 linux,default-trigger = "heartbeat"; 73 }; 74 75 led-1 { 76 color = <LED_COLOR_ID_GREEN>; 77 function = LED_FUNCTION_STATUS; 78 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; 79 }; 80 }; 81 82 sdio_pwrseq: sdio-pwrseq { 83 compatible = "mmc-pwrseq-simple"; 84 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; 85 clocks = <&wifi32k>; 86 clock-names = "ext_clock"; 87 }; 88 89 wifi32k: wifi32k { 90 compatible = "pwm-clock"; 91 #clock-cells = <0>; 92 clock-frequency = <32768>; 93 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ 94 }; 95 96 dc_in: regulator-dc-in { 97 compatible = "regulator-fixed"; 98 regulator-name = "DC_IN"; 99 regulator-min-microvolt = <5000000>; 100 regulator-max-microvolt = <5000000>; 101 regulator-always-on; 102 }; 103 104 vcc_5v: regulator-vcc-5v { 105 compatible = "regulator-fixed"; 106 regulator-name = "VCC_5V"; 107 regulator-min-microvolt = <5000000>; 108 regulator-max-microvolt = <5000000>; 109 vin-supply = <&dc_in>; 110 111 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; 112 enable-active-high; 113 }; 114 115 vcc_3v3: regulator-vcc-3v3 { 116 compatible = "regulator-fixed"; 117 regulator-name = "VCC_3V3"; 118 regulator-min-microvolt = <3300000>; 119 regulator-max-microvolt = <3300000>; 120 vin-supply = <&vsys_3v3>; 121 regulator-always-on; 122 }; 123 124 vcc_1v8: regulator-vcc-1v8 { 125 compatible = "regulator-fixed"; 126 regulator-name = "VCC_1V8"; 127 regulator-min-microvolt = <1800000>; 128 regulator-max-microvolt = <1800000>; 129 vin-supply = <&vcc_3v3>; 130 regulator-always-on; 131 }; 132 133 vddao_1v8: regulator-vddao-1v8 { 134 compatible = "regulator-fixed"; 135 regulator-name = "VDDIO_AO1V8"; 136 regulator-min-microvolt = <1800000>; 137 regulator-max-microvolt = <1800000>; 138 vin-supply = <&vsys_3v3>; 139 regulator-always-on; 140 }; 141 142 vddcpu_a: regulator-vddcpu-a { 143 compatible = "pwm-regulator"; 144 regulator-name = "VDDCPU_A"; 145 regulator-min-microvolt = <690000>; 146 regulator-max-microvolt = <1050000>; 147 pwm-supply = <&dc_in>; 148 pwms = <&pwm_ab 0 1250 0>; 149 pwm-dutycycle-range = <100 0>; 150 regulator-boot-on; 151 regulator-always-on; 152 }; 153 154 vddcpu_b: regulator-vddcpu-b { 155 compatible = "pwm-regulator"; 156 regulator-name = "VDDCPU_B"; 157 regulator-min-microvolt = <690000>; 158 regulator-max-microvolt = <1050000>; 159 pwm-supply = <&vsys_3v3>; 160 pwms = <&pwm_AO_cd 1 1250 0>; 161 pwm-dutycycle-range = <100 0>; 162 regulator-boot-on; 163 regulator-always-on; 164 }; 165 166 vsys_3v3: regulator-vsys-3v3 { 167 compatible = "regulator-fixed"; 168 regulator-name = "VSYS_3V3"; 169 regulator-min-microvolt = <3300000>; 170 regulator-max-microvolt = <3300000>; 171 vin-supply = <&dc_in>; 172 regulator-always-on; 173 }; 174 175 emmc_1v8: regulator-emmc-1v8 { 176 compatible = "regulator-fixed"; 177 regulator-name = "EMMC_AO1V8"; 178 regulator-min-microvolt = <1800000>; 179 regulator-max-microvolt = <1800000>; 180 vin-supply = <&vcc_3v3>; 181 regulator-always-on; 182 }; 183 184 usb_pwr: regulator-usb-pwr { 185 compatible = "regulator-fixed"; 186 regulator-name = "USB_PWR"; 187 regulator-min-microvolt = <5000000>; 188 regulator-max-microvolt = <5000000>; 189 vin-supply = <&vcc_5v>; 190 191 gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>; 192 enable-active-high; 193 }; 194 195 sound { 196 compatible = "amlogic,axg-sound-card"; 197 model = "BPI-M2S"; 198 audio-aux-devs = <&tdmout_b>; 199 audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1", 200 "TDMOUT_B IN 1", "FRDDR_B OUT 1", 201 "TDMOUT_B IN 2", "FRDDR_C OUT 1", 202 "TDM_B Playback", "TDMOUT_B OUT"; 203 204 assigned-clocks = <&clkc CLKID_MPLL2>, 205 <&clkc CLKID_MPLL0>, 206 <&clkc CLKID_MPLL1>; 207 assigned-clock-parents = <0>, <0>, <0>; 208 assigned-clock-rates = <294912000>, 209 <270950400>, 210 <393216000>; 211 212 dai-link-0 { 213 sound-dai = <&frddr_a>; 214 }; 215 216 dai-link-1 { 217 sound-dai = <&frddr_b>; 218 }; 219 220 dai-link-2 { 221 sound-dai = <&frddr_c>; 222 }; 223 224 /* 8ch hdmi interface */ 225 dai-link-3 { 226 sound-dai = <&tdmif_b>; 227 dai-format = "i2s"; 228 dai-tdm-slot-tx-mask-0 = <1 1>; 229 dai-tdm-slot-tx-mask-1 = <1 1>; 230 dai-tdm-slot-tx-mask-2 = <1 1>; 231 dai-tdm-slot-tx-mask-3 = <1 1>; 232 mclk-fs = <256>; 233 234 codec { 235 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>; 236 }; 237 }; 238 239 /* hdmi glue */ 240 dai-link-4 { 241 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; 242 243 codec { 244 sound-dai = <&hdmi_tx>; 245 }; 246 }; 247 }; 248}; 249 250&arb { 251 status = "okay"; 252}; 253 254&clkc_audio { 255 status = "okay"; 256}; 257 258&cecb_AO { 259 pinctrl-0 = <&cec_ao_b_h_pins>; 260 pinctrl-names = "default"; 261 status = "okay"; 262 hdmi-phandle = <&hdmi_tx>; 263}; 264 265&cpu0 { 266 cpu-supply = <&vddcpu_b>; 267 operating-points-v2 = <&cpu_opp_table_0>; 268 clocks = <&clkc CLKID_CPU_CLK>; 269 clock-latency = <50000>; 270}; 271 272&cpu1 { 273 cpu-supply = <&vddcpu_b>; 274 operating-points-v2 = <&cpu_opp_table_0>; 275 clocks = <&clkc CLKID_CPU_CLK>; 276 clock-latency = <50000>; 277}; 278 279&cpu100 { 280 cpu-supply = <&vddcpu_a>; 281 operating-points-v2 = <&cpub_opp_table_1>; 282 clocks = <&clkc CLKID_CPUB_CLK>; 283 clock-latency = <50000>; 284}; 285 286&cpu101 { 287 cpu-supply = <&vddcpu_a>; 288 operating-points-v2 = <&cpub_opp_table_1>; 289 clocks = <&clkc CLKID_CPUB_CLK>; 290 clock-latency = <50000>; 291}; 292 293&cpu102 { 294 cpu-supply = <&vddcpu_a>; 295 operating-points-v2 = <&cpub_opp_table_1>; 296 clocks = <&clkc CLKID_CPUB_CLK>; 297 clock-latency = <50000>; 298}; 299 300&cpu103 { 301 cpu-supply = <&vddcpu_a>; 302 operating-points-v2 = <&cpub_opp_table_1>; 303 clocks = <&clkc CLKID_CPUB_CLK>; 304 clock-latency = <50000>; 305}; 306 307ðmac { 308 pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; 309 pinctrl-names = "default"; 310 status = "okay"; 311 phy-mode = "rgmii"; 312 phy-handle = <&external_phy>; 313 amlogic,tx-delay-ns = <2>; 314}; 315 316&ext_mdio { 317 external_phy: ethernet-phy@0 { 318 /* Realtek RTL8211F (0x001cc916) */ 319 reg = <0>; 320 max-speed = <1000>; 321 322 reset-assert-us = <10000>; 323 reset-deassert-us = <80000>; 324 reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; 325 326 interrupt-parent = <&gpio_intc>; 327 /* MAC_INTR on GPIOZ_14 */ 328 interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>; 329 }; 330}; 331 332&frddr_a { 333 status = "okay"; 334}; 335 336&frddr_b { 337 status = "okay"; 338}; 339 340&frddr_c { 341 status = "okay"; 342}; 343 344&hdmi_tx { 345 status = "okay"; 346 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; 347 pinctrl-names = "default"; 348 hdmi-supply = <&vcc_5v>; 349}; 350 351&hdmi_tx_tmds_port { 352 hdmi_tx_tmds_out: endpoint { 353 remote-endpoint = <&hdmi_connector_in>; 354 }; 355}; 356 357/* Main i2c bus */ 358&i2c2 { 359 status = "okay"; 360 pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>; 361 pinctrl-names = "default"; 362}; 363 364&pcie { 365 status = "okay"; 366 reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>; 367}; 368 369&pwm_ab { 370 status = "okay"; 371 pinctrl-0 = <&pwm_a_e_pins>; 372 pinctrl-names = "default"; 373 clocks = <&xtal>; 374 clock-names = "clkin0"; 375}; 376 377&pwm_cd { 378 status = "okay"; 379 pinctrl-0 = <&pwm_d_x6_pins>; 380 pinctrl-names = "default"; 381 pwm-gpios = <&gpio GPIOAO_10 GPIO_ACTIVE_HIGH>; 382}; 383 384&pwm_ef { 385 status = "okay"; 386 pinctrl-0 = <&pwm_e_pins>; 387 pinctrl-names = "default"; 388}; 389 390&pwm_AO_cd { 391 pinctrl-0 = <&pwm_ao_d_e_pins>; 392 pinctrl-names = "default"; 393 clocks = <&xtal>; 394 clock-names = "clkin1"; 395 status = "okay"; 396}; 397 398&saradc { 399 status = "okay"; 400 vref-supply = <&vddao_1v8>; 401}; 402 403/* SDIO */ 404&sd_emmc_a { 405 /* enable if WiFi/BT board connected */ 406 status = "disabled"; 407 pinctrl-0 = <&sdio_pins>; 408 pinctrl-1 = <&sdio_clk_gate_pins>; 409 pinctrl-names = "default", "clk-gate"; 410 #address-cells = <1>; 411 #size-cells = <0>; 412 413 bus-width = <4>; 414 sd-uhs-sdr104; 415 max-frequency = <50000000>; 416 417 non-removable; 418 disable-wp; 419 420 /* WiFi firmware requires power in suspend */ 421 keep-power-in-suspend; 422 423 mmc-pwrseq = <&sdio_pwrseq>; 424 425 vmmc-supply = <&vsys_3v3>; 426 vqmmc-supply = <&vddao_1v8>; 427 428 rtl8822cs: wifi@1 { 429 reg = <1>; 430 }; 431}; 432 433/* SD card */ 434&sd_emmc_b { 435 status = "okay"; 436 pinctrl-0 = <&sdcard_c_pins>; 437 pinctrl-1 = <&sdcard_clk_gate_c_pins>; 438 pinctrl-names = "default", "clk-gate"; 439 440 bus-width = <4>; 441 cap-sd-highspeed; 442 max-frequency = <50000000>; 443 disable-wp; 444 445 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; 446 vmmc-supply = <&vsys_3v3>; 447 vqmmc-supply = <&vsys_3v3>; 448}; 449 450/* eMMC */ 451&sd_emmc_c { 452 status = "okay"; 453 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; 454 pinctrl-1 = <&emmc_clk_gate_pins>; 455 pinctrl-names = "default", "clk-gate"; 456 457 bus-width = <8>; 458 cap-mmc-highspeed; 459 mmc-ddr-1_8v; 460 mmc-hs200-1_8v; 461 max-frequency = <200000000>; 462 disable-wp; 463 464 mmc-pwrseq = <&emmc_pwrseq>; 465 vmmc-supply = <&vcc_3v3>; 466 vqmmc-supply = <&emmc_1v8>; 467}; 468 469&tdmif_b { 470 status = "okay"; 471}; 472 473&tdmout_b { 474 status = "okay"; 475}; 476 477&tohdmitx { 478 status = "okay"; 479}; 480 481&uart_A { 482 /* enable if WiFi/BT board connected */ 483 status = "disabled"; 484 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; 485 pinctrl-names = "default"; 486 uart-has-rtscts; 487 488 bluetooth { 489 compatible = "realtek,rtl8822cs-bt"; 490 enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; 491 host-wake-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>; 492 device-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>; 493 }; 494}; 495 496&uart_AO { 497 status = "okay"; 498 pinctrl-0 = <&uart_ao_a_pins>; 499 pinctrl-names = "default"; 500}; 501 502&usb2_phy0 { 503 phy-supply = <&dc_in>; 504}; 505 506&usb2_phy1 { 507 phy-supply = <&usb_pwr>; 508}; 509 510&usb3_pcie_phy { 511 phy-supply = <&usb_pwr>; 512}; 513 514&usb { 515 status = "okay"; 516 dr_mode = "peripheral"; 517 phys = <&usb2_phy0>, <&usb2_phy1>; 518 phy-names = "usb2-phy0", "usb2-phy1"; 519}; 520