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