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