1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2/* 3 * Copyright (c) 2019 Akash Gajjar <Akash_Gajjar@mentor.com> 4 * Copyright (c) 2019 Pragnesh Patel <Pragnesh_Patel@mentor.com> 5 */ 6 7/dts-v1/; 8#include <dt-bindings/input/linux-event-codes.h> 9#include <dt-bindings/pwm/pwm.h> 10#include "rk3399.dtsi" 11#include "rk3399-opp.dtsi" 12 13/ { 14 model = "Radxa ROCK Pi 4"; 15 compatible = "radxa,rockpi4", "rockchip,rk3399"; 16 17 chosen { 18 stdout-path = "serial2:1500000n8"; 19 }; 20 21 clkin_gmac: external-gmac-clock { 22 compatible = "fixed-clock"; 23 clock-frequency = <125000000>; 24 clock-output-names = "clkin_gmac"; 25 #clock-cells = <0>; 26 }; 27 28 sdio_pwrseq: sdio-pwrseq { 29 compatible = "mmc-pwrseq-simple"; 30 clocks = <&rk808 1>; 31 clock-names = "ext_clock"; 32 pinctrl-names = "default"; 33 pinctrl-0 = <&wifi_enable_h>; 34 reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; 35 }; 36 37 vcc12v_dcin: dc-12v { 38 compatible = "regulator-fixed"; 39 regulator-name = "vcc12v_dcin"; 40 regulator-always-on; 41 regulator-boot-on; 42 regulator-min-microvolt = <12000000>; 43 regulator-max-microvolt = <12000000>; 44 }; 45 46 vcc5v0_sys: vcc-sys { 47 compatible = "regulator-fixed"; 48 regulator-name = "vcc5v0_sys"; 49 regulator-always-on; 50 regulator-boot-on; 51 regulator-min-microvolt = <5000000>; 52 regulator-max-microvolt = <5000000>; 53 vin-supply = <&vcc12v_dcin>; 54 }; 55 56 vcc3v3_pcie: vcc3v3-pcie-regulator { 57 compatible = "regulator-fixed"; 58 enable-active-high; 59 gpio = <&gpio2 RK_PD2 GPIO_ACTIVE_HIGH>; 60 pinctrl-names = "default"; 61 pinctrl-0 = <&pcie_pwr_en>; 62 regulator-name = "vcc3v3_pcie"; 63 regulator-always-on; 64 regulator-boot-on; 65 vin-supply = <&vcc5v0_sys>; 66 }; 67 68 vcc3v3_sys: vcc3v3-sys { 69 compatible = "regulator-fixed"; 70 regulator-name = "vcc3v3_sys"; 71 regulator-always-on; 72 regulator-boot-on; 73 regulator-min-microvolt = <3300000>; 74 regulator-max-microvolt = <3300000>; 75 vin-supply = <&vcc5v0_sys>; 76 }; 77 78 vcc5v0_host: vcc5v0-host-regulator { 79 compatible = "regulator-fixed"; 80 enable-active-high; 81 gpio = <&gpio4 RK_PD1 GPIO_ACTIVE_HIGH>; 82 pinctrl-names = "default"; 83 pinctrl-0 = <&vcc5v0_host_en>; 84 regulator-name = "vcc5v0_host"; 85 regulator-always-on; 86 vin-supply = <&vcc5v0_sys>; 87 }; 88 89 vcc5v0_typec: vcc5v0-typec-regulator { 90 compatible = "regulator-fixed"; 91 enable-active-high; 92 gpio = <&gpio1 RK_PA3 GPIO_ACTIVE_HIGH>; 93 pinctrl-names = "default"; 94 pinctrl-0 = <&vcc5v0_typec_en>; 95 regulator-name = "vcc5v0_typec"; 96 regulator-always-on; 97 vin-supply = <&vcc5v0_sys>; 98 }; 99 100 vcc_lan: vcc3v3-phy-regulator { 101 compatible = "regulator-fixed"; 102 regulator-name = "vcc_lan"; 103 regulator-always-on; 104 regulator-boot-on; 105 regulator-min-microvolt = <3300000>; 106 regulator-max-microvolt = <3300000>; 107 108 regulator-state-mem { 109 regulator-off-in-suspend; 110 }; 111 }; 112 113 vdd_log: vdd-log { 114 compatible = "pwm-regulator"; 115 pwms = <&pwm2 0 25000 1>; 116 regulator-name = "vdd_log"; 117 regulator-always-on; 118 regulator-boot-on; 119 regulator-min-microvolt = <800000>; 120 regulator-max-microvolt = <1400000>; 121 vin-supply = <&vcc5v0_sys>; 122 }; 123}; 124 125&cpu_l0 { 126 cpu-supply = <&vdd_cpu_l>; 127}; 128 129&cpu_l1 { 130 cpu-supply = <&vdd_cpu_l>; 131}; 132 133&cpu_l2 { 134 cpu-supply = <&vdd_cpu_l>; 135}; 136 137&cpu_l3 { 138 cpu-supply = <&vdd_cpu_l>; 139}; 140 141&cpu_b0 { 142 cpu-supply = <&vdd_cpu_b>; 143}; 144 145&cpu_b1 { 146 cpu-supply = <&vdd_cpu_b>; 147}; 148 149&emmc_phy { 150 status = "okay"; 151}; 152 153&gmac { 154 assigned-clocks = <&cru SCLK_RMII_SRC>; 155 assigned-clock-parents = <&clkin_gmac>; 156 clock_in_out = "input"; 157 phy-supply = <&vcc_lan>; 158 phy-mode = "rgmii"; 159 pinctrl-names = "default"; 160 pinctrl-0 = <&rgmii_pins>; 161 snps,reset-gpio = <&gpio3 RK_PB7 GPIO_ACTIVE_LOW>; 162 snps,reset-active-low; 163 snps,reset-delays-us = <0 10000 50000>; 164 tx_delay = <0x28>; 165 rx_delay = <0x11>; 166 status = "okay"; 167}; 168 169&gpu { 170 mali-supply = <&vdd_gpu>; 171 status = "okay"; 172}; 173 174&hdmi { 175 ddc-i2c-bus = <&i2c3>; 176 pinctrl-names = "default"; 177 pinctrl-0 = <&hdmi_cec>; 178 status = "okay"; 179}; 180 181&hdmi_sound { 182 status = "okay"; 183}; 184 185&i2c0 { 186 clock-frequency = <400000>; 187 i2c-scl-rising-time-ns = <168>; 188 i2c-scl-falling-time-ns = <4>; 189 status = "okay"; 190 191 rk808: pmic@1b { 192 compatible = "rockchip,rk808"; 193 reg = <0x1b>; 194 interrupt-parent = <&gpio1>; 195 interrupts = <21 IRQ_TYPE_LEVEL_LOW>; 196 #clock-cells = <1>; 197 clock-output-names = "xin32k", "rk808-clkout2"; 198 pinctrl-names = "default"; 199 pinctrl-0 = <&pmic_int_l>; 200 rockchip,system-power-controller; 201 wakeup-source; 202 203 vcc1-supply = <&vcc5v0_sys>; 204 vcc2-supply = <&vcc5v0_sys>; 205 vcc3-supply = <&vcc5v0_sys>; 206 vcc4-supply = <&vcc5v0_sys>; 207 vcc6-supply = <&vcc5v0_sys>; 208 vcc7-supply = <&vcc5v0_sys>; 209 vcc8-supply = <&vcc3v3_sys>; 210 vcc9-supply = <&vcc5v0_sys>; 211 vcc10-supply = <&vcc5v0_sys>; 212 vcc11-supply = <&vcc5v0_sys>; 213 vcc12-supply = <&vcc3v3_sys>; 214 vddio-supply = <&vcc_1v8>; 215 216 regulators { 217 vdd_center: DCDC_REG1 { 218 regulator-name = "vdd_center"; 219 regulator-always-on; 220 regulator-boot-on; 221 regulator-min-microvolt = <750000>; 222 regulator-max-microvolt = <1350000>; 223 regulator-ramp-delay = <6001>; 224 regulator-state-mem { 225 regulator-off-in-suspend; 226 }; 227 }; 228 229 vdd_cpu_l: DCDC_REG2 { 230 regulator-name = "vdd_cpu_l"; 231 regulator-always-on; 232 regulator-boot-on; 233 regulator-min-microvolt = <750000>; 234 regulator-max-microvolt = <1350000>; 235 regulator-ramp-delay = <6001>; 236 regulator-state-mem { 237 regulator-off-in-suspend; 238 }; 239 }; 240 241 vcc_ddr: DCDC_REG3 { 242 regulator-name = "vcc_ddr"; 243 regulator-always-on; 244 regulator-boot-on; 245 regulator-state-mem { 246 regulator-on-in-suspend; 247 }; 248 }; 249 250 vcc_1v8: DCDC_REG4 { 251 regulator-name = "vcc_1v8"; 252 regulator-always-on; 253 regulator-boot-on; 254 regulator-min-microvolt = <1800000>; 255 regulator-max-microvolt = <1800000>; 256 regulator-state-mem { 257 regulator-on-in-suspend; 258 regulator-suspend-microvolt = <1800000>; 259 }; 260 }; 261 262 vcc1v8_codec: LDO_REG1 { 263 regulator-name = "vcc1v8_codec"; 264 regulator-always-on; 265 regulator-boot-on; 266 regulator-min-microvolt = <1800000>; 267 regulator-max-microvolt = <1800000>; 268 regulator-state-mem { 269 regulator-off-in-suspend; 270 }; 271 }; 272 273 vcc1v8_hdmi: LDO_REG2 { 274 regulator-name = "vcc1v8_hdmi"; 275 regulator-always-on; 276 regulator-boot-on; 277 regulator-min-microvolt = <1800000>; 278 regulator-max-microvolt = <1800000>; 279 regulator-state-mem { 280 regulator-off-in-suspend; 281 }; 282 }; 283 284 vcca_1v8: LDO_REG3 { 285 regulator-name = "vcca_1v8"; 286 regulator-always-on; 287 regulator-boot-on; 288 regulator-min-microvolt = <1800000>; 289 regulator-max-microvolt = <1800000>; 290 regulator-state-mem { 291 regulator-on-in-suspend; 292 regulator-suspend-microvolt = <1800000>; 293 }; 294 }; 295 296 vcc_sdio: LDO_REG4 { 297 regulator-name = "vcc_sdio"; 298 regulator-always-on; 299 regulator-boot-on; 300 regulator-min-microvolt = <3000000>; 301 regulator-max-microvolt = <3000000>; 302 regulator-state-mem { 303 regulator-on-in-suspend; 304 regulator-suspend-microvolt = <3000000>; 305 }; 306 }; 307 308 vcca3v0_codec: LDO_REG5 { 309 regulator-name = "vcca3v0_codec"; 310 regulator-always-on; 311 regulator-boot-on; 312 regulator-min-microvolt = <3000000>; 313 regulator-max-microvolt = <3000000>; 314 regulator-state-mem { 315 regulator-off-in-suspend; 316 }; 317 }; 318 319 vcc_1v5: LDO_REG6 { 320 regulator-name = "vcc_1v5"; 321 regulator-always-on; 322 regulator-boot-on; 323 regulator-min-microvolt = <1500000>; 324 regulator-max-microvolt = <1500000>; 325 regulator-state-mem { 326 regulator-on-in-suspend; 327 regulator-suspend-microvolt = <1500000>; 328 }; 329 }; 330 331 vcc0v9_hdmi: LDO_REG7 { 332 regulator-name = "vcc0v9_hdmi"; 333 regulator-always-on; 334 regulator-boot-on; 335 regulator-min-microvolt = <900000>; 336 regulator-max-microvolt = <900000>; 337 regulator-state-mem { 338 regulator-off-in-suspend; 339 }; 340 }; 341 342 vcc_3v0: LDO_REG8 { 343 regulator-name = "vcc_3v0"; 344 regulator-always-on; 345 regulator-boot-on; 346 regulator-min-microvolt = <3000000>; 347 regulator-max-microvolt = <3000000>; 348 regulator-state-mem { 349 regulator-on-in-suspend; 350 regulator-suspend-microvolt = <3000000>; 351 }; 352 }; 353 354 vcc_cam: SWITCH_REG1 { 355 regulator-name = "vcc_cam"; 356 regulator-always-on; 357 regulator-boot-on; 358 regulator-min-microvolt = <3300000>; 359 regulator-max-microvolt = <3300000>; 360 regulator-state-mem { 361 regulator-off-in-suspend; 362 }; 363 }; 364 365 vcc_mipi: SWITCH_REG2 { 366 regulator-name = "vcc_mipi"; 367 regulator-always-on; 368 regulator-boot-on; 369 regulator-min-microvolt = <3300000>; 370 regulator-max-microvolt = <3300000>; 371 regulator-state-mem { 372 regulator-off-in-suspend; 373 }; 374 }; 375 }; 376 }; 377 378 vdd_cpu_b: regulator@40 { 379 compatible = "silergy,syr827"; 380 reg = <0x40>; 381 fcs,suspend-voltage-selector = <1>; 382 pinctrl-names = "default"; 383 pinctrl-0 = <&vsel1_gpio>; 384 regulator-name = "vdd_cpu_b"; 385 regulator-min-microvolt = <712500>; 386 regulator-max-microvolt = <1500000>; 387 regulator-ramp-delay = <1000>; 388 regulator-always-on; 389 regulator-boot-on; 390 vin-supply = <&vcc5v0_sys>; 391 392 regulator-state-mem { 393 regulator-off-in-suspend; 394 }; 395 }; 396 397 vdd_gpu: regulator@41 { 398 compatible = "silergy,syr828"; 399 reg = <0x41>; 400 fcs,suspend-voltage-selector = <1>; 401 pinctrl-names = "default"; 402 pinctrl-0 = <&vsel2_gpio>; 403 regulator-name = "vdd_gpu"; 404 regulator-min-microvolt = <712500>; 405 regulator-max-microvolt = <1500000>; 406 regulator-ramp-delay = <1000>; 407 regulator-always-on; 408 regulator-boot-on; 409 vin-supply = <&vcc5v0_sys>; 410 411 regulator-state-mem { 412 regulator-off-in-suspend; 413 }; 414 }; 415}; 416 417&i2c1 { 418 i2c-scl-rising-time-ns = <300>; 419 i2c-scl-falling-time-ns = <15>; 420 status = "okay"; 421}; 422 423&i2c3 { 424 i2c-scl-rising-time-ns = <450>; 425 i2c-scl-falling-time-ns = <15>; 426 status = "okay"; 427}; 428 429&i2c4 { 430 i2c-scl-rising-time-ns = <600>; 431 i2c-scl-falling-time-ns = <20>; 432 status = "okay"; 433}; 434 435&i2s0 { 436 rockchip,playback-channels = <8>; 437 rockchip,capture-channels = <8>; 438 status = "okay"; 439}; 440 441&i2s1 { 442 rockchip,playback-channels = <2>; 443 rockchip,capture-channels = <2>; 444}; 445 446&i2s2 { 447 status = "okay"; 448}; 449 450&io_domains { 451 status = "okay"; 452 453 bt656-supply = <&vcc_3v0>; 454 audio-supply = <&vcc1v8_codec>; 455 sdmmc-supply = <&vcc_sdio>; 456 gpio1830-supply = <&vcc_3v0>; 457}; 458 459&pmu_io_domains { 460 status = "okay"; 461 462 pmu1830-supply = <&vcc_3v0>; 463}; 464 465&pinctrl { 466 bt { 467 bt_enable_h: bt-enable-h { 468 rockchip,pins = <0 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>; 469 }; 470 471 bt_host_wake_l: bt-host-wake-l { 472 rockchip,pins = <0 RK_PA4 RK_FUNC_GPIO &pcfg_pull_none>; 473 }; 474 475 bt_wake_l: bt-wake-l { 476 rockchip,pins = <2 RK_PD3 RK_FUNC_GPIO &pcfg_pull_none>; 477 }; 478 }; 479 480 pcie { 481 pcie_pwr_en: pcie-pwr-en { 482 rockchip,pins = <2 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; 483 }; 484 }; 485 486 sdio0 { 487 sdio0_bus4: sdio0-bus4 { 488 rockchip,pins = 489 <2 20 RK_FUNC_1 &pcfg_pull_up_20ma>, 490 <2 21 RK_FUNC_1 &pcfg_pull_up_20ma>, 491 <2 22 RK_FUNC_1 &pcfg_pull_up_20ma>, 492 <2 23 RK_FUNC_1 &pcfg_pull_up_20ma>; 493 }; 494 495 sdio0_cmd: sdio0-cmd { 496 rockchip,pins = 497 <2 24 RK_FUNC_1 &pcfg_pull_up_20ma>; 498 }; 499 500 sdio0_clk: sdio0-clk { 501 rockchip,pins = 502 <2 25 RK_FUNC_1 &pcfg_pull_none_20ma>; 503 }; 504 }; 505 506 pmic { 507 pmic_int_l: pmic-int-l { 508 rockchip,pins = <1 RK_PC5 RK_FUNC_GPIO &pcfg_pull_up>; 509 }; 510 511 vsel1_gpio: vsel1-gpio { 512 rockchip,pins = <1 RK_PC1 RK_FUNC_GPIO &pcfg_pull_down>; 513 }; 514 515 vsel2_gpio: vsel2-gpio { 516 rockchip,pins = <1 RK_PB6 RK_FUNC_GPIO &pcfg_pull_down>; 517 }; 518 }; 519 520 usb-typec { 521 vcc5v0_typec_en: vcc5v0-typec-en { 522 rockchip,pins = <1 RK_PA3 RK_FUNC_GPIO &pcfg_pull_up>; 523 }; 524 }; 525 526 usb2 { 527 vcc5v0_host_en: vcc5v0-host-en { 528 rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>; 529 }; 530 }; 531 532 wifi { 533 wifi_enable_h: wifi-enable-h { 534 rockchip,pins = 535 <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>; 536 }; 537 538 wifi_host_wake_l: wifi-host-wake-l { 539 rockchip,pins = <0 RK_PA3 RK_FUNC_GPIO &pcfg_pull_none>; 540 }; 541 }; 542}; 543 544&pwm2 { 545 status = "okay"; 546}; 547 548&saradc { 549 status = "okay"; 550 551 vref-supply = <&vcc_1v8>; 552}; 553 554&sdio0 { 555 #address-cells = <1>; 556 #size-cells = <0>; 557 bus-width = <4>; 558 clock-frequency = <50000000>; 559 cap-sdio-irq; 560 cap-sd-highspeed; 561 keep-power-in-suspend; 562 mmc-pwrseq = <&sdio_pwrseq>; 563 non-removable; 564 pinctrl-names = "default"; 565 pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>; 566 sd-uhs-sdr104; 567 status = "okay"; 568 569 brcmf: wifi@1 { 570 compatible = "brcm,bcm4329-fmac"; 571 reg = <1>; 572 interrupt-parent = <&gpio0>; 573 interrupts = <RK_PA3 GPIO_ACTIVE_HIGH>; 574 interrupt-names = "host-wake"; 575 pinctrl-names = "default"; 576 pinctrl-0 = <&wifi_host_wake_l>; 577 }; 578}; 579 580&sdmmc { 581 bus-width = <4>; 582 cap-mmc-highspeed; 583 cap-sd-highspeed; 584 cd-gpios = <&gpio0 RK_PA7 GPIO_ACTIVE_LOW>; 585 disable-wp; 586 max-frequency = <150000000>; 587 pinctrl-names = "default"; 588 pinctrl-0 = <&sdmmc_clk &sdmmc_cd &sdmmc_cmd &sdmmc_bus4>; 589 status = "okay"; 590}; 591 592&sdhci { 593 bus-width = <8>; 594 mmc-hs400-1_8v; 595 mmc-hs400-enhanced-strobe; 596 non-removable; 597 status = "okay"; 598}; 599 600&tcphy0 { 601 status = "okay"; 602}; 603 604&tcphy1 { 605 status = "okay"; 606}; 607 608&tsadc { 609 status = "okay"; 610 611 /* tshut mode 0:CRU 1:GPIO */ 612 rockchip,hw-tshut-mode = <1>; 613 /* tshut polarity 0:LOW 1:HIGH */ 614 rockchip,hw-tshut-polarity = <1>; 615}; 616 617&u2phy0 { 618 status = "okay"; 619 620 u2phy0_otg: otg-port { 621 status = "okay"; 622 }; 623 624 u2phy0_host: host-port { 625 phy-supply = <&vcc5v0_host>; 626 status = "okay"; 627 }; 628}; 629 630&u2phy1 { 631 status = "okay"; 632 633 u2phy1_otg: otg-port { 634 status = "okay"; 635 }; 636 637 u2phy1_host: host-port { 638 phy-supply = <&vcc5v0_host>; 639 status = "okay"; 640 }; 641}; 642 643&uart0 { 644 pinctrl-names = "default"; 645 pinctrl-0 = <&uart0_xfer &uart0_cts &uart0_rts>; 646 status = "okay"; 647 648 bluetooth { 649 compatible = "brcm,bcm43438-bt"; 650 clocks = <&rk808 1>; 651 clock-names = "ext_clock"; 652 device-wakeup-gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_HIGH>; 653 host-wakeup-gpios = <&gpio0 RK_PA4 GPIO_ACTIVE_HIGH>; 654 shutdown-gpios = <&gpio0 RK_PB1 GPIO_ACTIVE_HIGH>; 655 pinctrl-names = "default"; 656 pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>; 657 }; 658}; 659 660&uart2 { 661 status = "okay"; 662}; 663 664&usb_host0_ehci { 665 status = "okay"; 666}; 667 668&usb_host0_ohci { 669 status = "okay"; 670}; 671 672&usb_host1_ehci { 673 status = "okay"; 674}; 675 676&usb_host1_ohci { 677 status = "okay"; 678}; 679 680&usbdrd3_0 { 681 status = "okay"; 682}; 683 684&usbdrd_dwc3_0 { 685 status = "okay"; 686 dr_mode = "otg"; 687}; 688 689&usbdrd3_1 { 690 status = "okay"; 691}; 692 693&usbdrd_dwc3_1 { 694 status = "okay"; 695 dr_mode = "host"; 696}; 697 698&vopb { 699 status = "okay"; 700}; 701 702&vopb_mmu { 703 status = "okay"; 704}; 705 706&vopl { 707 status = "okay"; 708}; 709 710&vopl_mmu { 711 status = "okay"; 712}; 713