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