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) 2019 Christian Hewitt <christianshewitt@gmail.com> 6 */ 7 8#include <dt-bindings/input/input.h> 9#include <dt-bindings/gpio/meson-g12a-gpio.h> 10#include <dt-bindings/sound/meson-g12a-tohdmitx.h> 11 12/ { 13 aliases { 14 serial0 = &uart_AO; 15 ethernet0 = ðmac; 16 rtc0 = &rtc; 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>; 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 = "Function"; 37 linux,code = <KEY_FN>; 38 press-threshold-microvolt = <10000>; 39 }; 40 }; 41 42 leds { 43 compatible = "gpio-leds"; 44 45 led-white { 46 label = "vim3:white:sys"; 47 gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>; 48 linux,default-trigger = "heartbeat"; 49 }; 50 51 led-red { 52 label = "vim3:red"; 53 gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>; 54 }; 55 }; 56 57 emmc_pwrseq: emmc-pwrseq { 58 compatible = "mmc-pwrseq-emmc"; 59 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>; 60 }; 61 62 gpio-keys-polled { 63 compatible = "gpio-keys-polled"; 64 poll-interval = <100>; 65 66 power-button { 67 label = "power"; 68 linux,code = <KEY_POWER>; 69 gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>; 70 }; 71 }; 72 73 sdio_pwrseq: sdio-pwrseq { 74 compatible = "mmc-pwrseq-simple"; 75 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; 76 clocks = <&wifi32k>; 77 clock-names = "ext_clock"; 78 }; 79 80 dc_in: regulator-dc_in { 81 compatible = "regulator-fixed"; 82 regulator-name = "DC_IN"; 83 regulator-min-microvolt = <5000000>; 84 regulator-max-microvolt = <5000000>; 85 regulator-always-on; 86 }; 87 88 vcc_5v: regulator-vcc_5v { 89 compatible = "regulator-fixed"; 90 regulator-name = "VCC_5V"; 91 regulator-min-microvolt = <5000000>; 92 regulator-max-microvolt = <5000000>; 93 vin-supply = <&dc_in>; 94 95 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>; 96 enable-active-high; 97 }; 98 99 vcc_1v8: regulator-vcc_1v8 { 100 compatible = "regulator-fixed"; 101 regulator-name = "VCC_1V8"; 102 regulator-min-microvolt = <1800000>; 103 regulator-max-microvolt = <1800000>; 104 vin-supply = <&vcc_3v3>; 105 regulator-always-on; 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 /* FIXME: actually controlled by VDDCPU_B_EN */ 116 }; 117 118 vddao_1v8: regulator-vddao_1v8 { 119 compatible = "regulator-fixed"; 120 regulator-name = "VDDIO_AO1V8"; 121 regulator-min-microvolt = <1800000>; 122 regulator-max-microvolt = <1800000>; 123 vin-supply = <&vsys_3v3>; 124 regulator-always-on; 125 }; 126 127 emmc_1v8: regulator-emmc_1v8 { 128 compatible = "regulator-fixed"; 129 regulator-name = "EMMC_AO1V8"; 130 regulator-min-microvolt = <1800000>; 131 regulator-max-microvolt = <1800000>; 132 vin-supply = <&vcc_3v3>; 133 regulator-always-on; 134 }; 135 136 vsys_3v3: regulator-vsys_3v3 { 137 compatible = "regulator-fixed"; 138 regulator-name = "VSYS_3V3"; 139 regulator-min-microvolt = <3300000>; 140 regulator-max-microvolt = <3300000>; 141 vin-supply = <&dc_in>; 142 regulator-always-on; 143 }; 144 145 usb_pwr: regulator-usb_pwr { 146 compatible = "regulator-fixed"; 147 regulator-name = "USB_PWR"; 148 regulator-min-microvolt = <5000000>; 149 regulator-max-microvolt = <5000000>; 150 vin-supply = <&vcc_5v>; 151 152 gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>; 153 enable-active-high; 154 }; 155 156 hdmi-connector { 157 compatible = "hdmi-connector"; 158 type = "a"; 159 160 port { 161 hdmi_connector_in: endpoint { 162 remote-endpoint = <&hdmi_tx_tmds_out>; 163 }; 164 }; 165 }; 166 167 168 sound { 169 compatible = "amlogic,axg-sound-card"; 170 model = "G12B-KHADAS-VIM3"; 171 audio-aux-devs = <&tdmout_a>; 172 audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0", 173 "TDMOUT_A IN 1", "FRDDR_B OUT 0", 174 "TDMOUT_A IN 2", "FRDDR_C OUT 0", 175 "TDM_A Playback", "TDMOUT_A OUT"; 176 177 assigned-clocks = <&clkc CLKID_MPLL2>, 178 <&clkc CLKID_MPLL0>, 179 <&clkc CLKID_MPLL1>; 180 assigned-clock-parents = <0>, <0>, <0>; 181 assigned-clock-rates = <294912000>, 182 <270950400>, 183 <393216000>; 184 status = "okay"; 185 186 dai-link-0 { 187 sound-dai = <&frddr_a>; 188 }; 189 190 dai-link-1 { 191 sound-dai = <&frddr_b>; 192 }; 193 194 dai-link-2 { 195 sound-dai = <&frddr_c>; 196 }; 197 198 /* 8ch hdmi interface */ 199 dai-link-3 { 200 sound-dai = <&tdmif_a>; 201 dai-format = "i2s"; 202 dai-tdm-slot-tx-mask-0 = <1 1>; 203 dai-tdm-slot-tx-mask-1 = <1 1>; 204 dai-tdm-slot-tx-mask-2 = <1 1>; 205 dai-tdm-slot-tx-mask-3 = <1 1>; 206 mclk-fs = <256>; 207 208 codec { 209 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>; 210 }; 211 }; 212 213 /* hdmi glue */ 214 dai-link-4 { 215 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>; 216 217 codec { 218 sound-dai = <&hdmi_tx>; 219 }; 220 }; 221 }; 222 223 wifi32k: wifi32k { 224 compatible = "pwm-clock"; 225 #clock-cells = <0>; 226 clock-frequency = <32768>; 227 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ 228 }; 229}; 230 231&arb { 232 status = "okay"; 233}; 234 235&clkc_audio { 236 status = "okay"; 237}; 238 239&cec_AO { 240 pinctrl-0 = <&cec_ao_a_h_pins>; 241 pinctrl-names = "default"; 242 status = "disabled"; 243 hdmi-phandle = <&hdmi_tx>; 244}; 245 246&cecb_AO { 247 pinctrl-0 = <&cec_ao_b_h_pins>; 248 pinctrl-names = "default"; 249 status = "okay"; 250 hdmi-phandle = <&hdmi_tx>; 251}; 252 253&cpu_thermal { 254 trips { 255 cpu_active: cpu-active { 256 temperature = <80000>; /* millicelsius */ 257 hysteresis = <2000>; /* millicelsius */ 258 type = "active"; 259 }; 260 }; 261 262 cooling-maps { 263 map { 264 trip = <&cpu_active>; 265 cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 266 }; 267 }; 268}; 269 270&ext_mdio { 271 external_phy: ethernet-phy@0 { 272 /* Realtek RTL8211F (0x001cc916) */ 273 reg = <0>; 274 max-speed = <1000>; 275 276 interrupt-parent = <&gpio_intc>; 277 /* MAC_INTR on GPIOZ_14 */ 278 interrupts = <26 IRQ_TYPE_LEVEL_LOW>; 279 }; 280}; 281 282ðmac { 283 pinctrl-0 = <ð_pins>, <ð_rgmii_pins>; 284 pinctrl-names = "default"; 285 status = "okay"; 286 phy-mode = "rgmii"; 287 phy-handle = <&external_phy>; 288 amlogic,tx-delay-ns = <2>; 289}; 290 291&frddr_a { 292 status = "okay"; 293}; 294 295&frddr_b { 296 status = "okay"; 297}; 298 299&frddr_c { 300 status = "okay"; 301}; 302 303&hdmi_tx { 304 status = "okay"; 305 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>; 306 pinctrl-names = "default"; 307 hdmi-supply = <&vcc_5v>; 308}; 309 310&hdmi_tx_tmds_port { 311 hdmi_tx_tmds_out: endpoint { 312 remote-endpoint = <&hdmi_connector_in>; 313 }; 314}; 315 316&i2c_AO { 317 status = "okay"; 318 pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>; 319 pinctrl-names = "default"; 320 321 khadas_mcu: system-controller@18 { 322 compatible = "khadas,mcu"; 323 reg = <0x18>; 324 #cooling-cells = <2>; 325 }; 326 327 gpio_expander: gpio-controller@20 { 328 compatible = "ti,tca6408"; 329 reg = <0x20>; 330 vcc-supply = <&vcc_3v3>; 331 gpio-controller; 332 #gpio-cells = <2>; 333 }; 334 335 rtc: rtc@51 { 336 compatible = "haoyu,hym8563"; 337 reg = <0x51>; 338 #clock-cells = <0>; 339 }; 340}; 341 342&ir { 343 status = "okay"; 344 pinctrl-0 = <&remote_input_ao_pins>; 345 pinctrl-names = "default"; 346 linux,rc-map-name = "rc-khadas"; 347}; 348 349&pcie { 350 reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>; 351}; 352 353&pwm_ef { 354 status = "okay"; 355 pinctrl-0 = <&pwm_e_pins>; 356 pinctrl-names = "default"; 357}; 358 359&saradc { 360 status = "okay"; 361 vref-supply = <&vddao_1v8>; 362}; 363 364/* SDIO */ 365&sd_emmc_a { 366 status = "okay"; 367 pinctrl-0 = <&sdio_pins>; 368 pinctrl-1 = <&sdio_clk_gate_pins>; 369 pinctrl-names = "default", "clk-gate"; 370 #address-cells = <1>; 371 #size-cells = <0>; 372 373 bus-width = <4>; 374 cap-sd-highspeed; 375 max-frequency = <100000000>; 376 377 non-removable; 378 disable-wp; 379 380 /* WiFi firmware requires power to be kept while in suspend */ 381 keep-power-in-suspend; 382 383 mmc-pwrseq = <&sdio_pwrseq>; 384 385 vmmc-supply = <&vsys_3v3>; 386 vqmmc-supply = <&vddao_1v8>; 387 388 brcmf: wifi@1 { 389 reg = <1>; 390 compatible = "brcm,bcm4329-fmac"; 391 }; 392}; 393 394/* SD card */ 395&sd_emmc_b { 396 status = "okay"; 397 pinctrl-0 = <&sdcard_c_pins>; 398 pinctrl-1 = <&sdcard_clk_gate_c_pins>; 399 pinctrl-names = "default", "clk-gate"; 400 401 bus-width = <4>; 402 cap-sd-highspeed; 403 max-frequency = <50000000>; 404 disable-wp; 405 406 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>; 407 vmmc-supply = <&vsys_3v3>; 408 vqmmc-supply = <&vsys_3v3>; 409}; 410 411/* eMMC */ 412&sd_emmc_c { 413 status = "okay"; 414 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>; 415 pinctrl-1 = <&emmc_clk_gate_pins>; 416 pinctrl-names = "default", "clk-gate"; 417 418 bus-width = <8>; 419 cap-mmc-highspeed; 420 mmc-ddr-1_8v; 421 mmc-hs200-1_8v; 422 max-frequency = <200000000>; 423 disable-wp; 424 425 mmc-pwrseq = <&emmc_pwrseq>; 426 vmmc-supply = <&vcc_3v3>; 427 vqmmc-supply = <&emmc_1v8>; 428}; 429 430/* 431 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS 432 * and eMMC Data 4 to 7 pins. 433 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0, 434 * and change bus-width to 4 then spifc can be enabled. 435 */ 436&spifc { 437 status = "disabled"; 438 pinctrl-0 = <&nor_pins>; 439 pinctrl-names = "default"; 440 441 w25q128: spi-flash@0 { 442 #address-cells = <1>; 443 #size-cells = <1>; 444 compatible = "winbond,w25q128fw", "jedec,spi-nor"; 445 reg = <0>; 446 spi-max-frequency = <104000000>; 447 }; 448}; 449 450 451&tdmif_a { 452 status = "okay"; 453}; 454 455&tdmout_a { 456 status = "okay"; 457}; 458 459&tohdmitx { 460 status = "okay"; 461}; 462 463&uart_A { 464 status = "okay"; 465 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; 466 pinctrl-names = "default"; 467 uart-has-rtscts; 468 469 bluetooth { 470 compatible = "brcm,bcm43438-bt"; 471 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; 472 max-speed = <2000000>; 473 clocks = <&wifi32k>; 474 clock-names = "lpo"; 475 }; 476}; 477 478&uart_AO { 479 status = "okay"; 480 pinctrl-0 = <&uart_ao_a_pins>; 481 pinctrl-names = "default"; 482}; 483 484&usb2_phy0 { 485 phy-supply = <&dc_in>; 486}; 487 488&usb2_phy1 { 489 phy-supply = <&usb_pwr>; 490}; 491 492&usb3_pcie_phy { 493 phy-supply = <&usb_pwr>; 494}; 495 496&usb { 497 status = "okay"; 498 dr_mode = "peripheral"; 499}; 500