1// SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2/* 3 * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>. 4 * Copyright (c) 2017 BayLibre, SAS 5 * Author: Neil Armstrong <narmstrong@baylibre.com> 6 */ 7 8/dts-v1/; 9 10#include <dt-bindings/input/input.h> 11#include <dt-bindings/thermal/thermal.h> 12 13#include "meson-gxm.dtsi" 14 15/ { 16 compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm"; 17 model = "Khadas VIM2"; 18 19 aliases { 20 serial0 = &uart_AO; 21 serial2 = &uart_AO_B; 22 }; 23 24 chosen { 25 stdout-path = "serial0:115200n8"; 26 }; 27 28 memory@0 { 29 device_type = "memory"; 30 reg = <0x0 0x0 0x0 0x80000000>; 31 }; 32 33 adc-keys { 34 compatible = "adc-keys"; 35 io-channels = <&saradc 0>; 36 io-channel-names = "buttons"; 37 keyup-threshold-microvolt = <1710000>; 38 39 button-function { 40 label = "Function"; 41 linux,code = <KEY_FN>; 42 press-threshold-microvolt = <10000>; 43 }; 44 }; 45 46 emmc_pwrseq: emmc-pwrseq { 47 compatible = "mmc-pwrseq-emmc"; 48 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>; 49 }; 50 51 gpio_fan: gpio-fan { 52 compatible = "gpio-fan"; 53 gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH 54 &gpio GPIODV_15 GPIO_ACTIVE_HIGH>; 55 /* Dummy RPM values since fan is optional */ 56 gpio-fan,speed-map = <0 0 57 1 1 58 2 2 59 3 3>; 60 #cooling-cells = <2>; 61 }; 62 63 gpio-keys-polled { 64 compatible = "gpio-keys-polled"; 65 poll-interval = <100>; 66 67 power-button { 68 label = "power"; 69 linux,code = <KEY_POWER>; 70 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>; 71 }; 72 }; 73 74 hdmi-connector { 75 compatible = "hdmi-connector"; 76 type = "a"; 77 78 port { 79 hdmi_connector_in: endpoint { 80 remote-endpoint = <&hdmi_tx_tmds_out>; 81 }; 82 }; 83 }; 84 85 pwmleds { 86 compatible = "pwm-leds"; 87 88 power { 89 label = "vim:red:power"; 90 pwms = <&pwm_AO_ab 1 7812500 0>; 91 max-brightness = <255>; 92 linux,default-trigger = "default-on"; 93 }; 94 }; 95 96 sdio_pwrseq: sdio-pwrseq { 97 compatible = "mmc-pwrseq-simple"; 98 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>; 99 clocks = <&wifi32k>; 100 clock-names = "ext_clock"; 101 }; 102 103 thermal-zones { 104 cpu-thermal { 105 polling-delay-passive = <250>; /* milliseconds */ 106 polling-delay = <1000>; /* milliseconds */ 107 108 thermal-sensors = <&scpi_sensors 0>; 109 110 trips { 111 cpu_alert0: cpu-alert0 { 112 temperature = <70000>; /* millicelsius */ 113 hysteresis = <2000>; /* millicelsius */ 114 type = "active"; 115 }; 116 117 cpu_alert1: cpu-alert1 { 118 temperature = <80000>; /* millicelsius */ 119 hysteresis = <2000>; /* millicelsius */ 120 type = "passive"; 121 }; 122 }; 123 124 cooling-maps { 125 map0 { 126 trip = <&cpu_alert0>; 127 cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>; 128 }; 129 130 map1 { 131 trip = <&cpu_alert1>; 132 cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>, 133 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 134 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 135 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 136 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 137 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 138 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 139 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, 140 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; 141 }; 142 }; 143 }; 144 }; 145 146 hdmi_5v: regulator-hdmi-5v { 147 compatible = "regulator-fixed"; 148 149 regulator-name = "HDMI_5V"; 150 regulator-min-microvolt = <5000000>; 151 regulator-max-microvolt = <5000000>; 152 153 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>; 154 enable-active-high; 155 regulator-always-on; 156 }; 157 158 vcc_3v3: regulator-vcc_3v3 { 159 compatible = "regulator-fixed"; 160 regulator-name = "VCC_3V3"; 161 regulator-min-microvolt = <3300000>; 162 regulator-max-microvolt = <3300000>; 163 }; 164 165 vddio_ao18: regulator-vddio_ao18 { 166 compatible = "regulator-fixed"; 167 regulator-name = "VDDIO_AO18"; 168 regulator-min-microvolt = <1800000>; 169 regulator-max-microvolt = <1800000>; 170 }; 171 172 vddio_boot: regulator-vddio_boot { 173 compatible = "regulator-fixed"; 174 regulator-name = "VDDIO_BOOT"; 175 regulator-min-microvolt = <1800000>; 176 regulator-max-microvolt = <1800000>; 177 }; 178 179 vddao_3v3: regulator-vddao_3v3 { 180 compatible = "regulator-fixed"; 181 regulator-name = "VDDAO_3V3"; 182 regulator-min-microvolt = <3300000>; 183 regulator-max-microvolt = <3300000>; 184 }; 185 186 wifi32k: wifi32k { 187 compatible = "pwm-clock"; 188 #clock-cells = <0>; 189 clock-frequency = <32768>; 190 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */ 191 }; 192}; 193 194&cec_AO { 195 status = "okay"; 196 pinctrl-0 = <&ao_cec_pins>; 197 pinctrl-names = "default"; 198 hdmi-phandle = <&hdmi_tx>; 199}; 200 201&cpu0 { 202 #cooling-cells = <2>; 203}; 204 205&cpu1 { 206 #cooling-cells = <2>; 207}; 208 209&cpu2 { 210 #cooling-cells = <2>; 211}; 212 213&cpu3 { 214 #cooling-cells = <2>; 215}; 216 217&cpu4 { 218 #cooling-cells = <2>; 219}; 220 221&cpu5 { 222 #cooling-cells = <2>; 223}; 224 225&cpu6 { 226 #cooling-cells = <2>; 227}; 228 229&cpu7 { 230 #cooling-cells = <2>; 231}; 232 233ðmac { 234 pinctrl-0 = <ð_pins>; 235 pinctrl-names = "default"; 236 237 /* Select external PHY by default */ 238 phy-handle = <&external_phy>; 239 240 amlogic,tx-delay-ns = <2>; 241 242 /* External PHY is in RGMII */ 243 phy-mode = "rgmii"; 244 245 status = "okay"; 246}; 247 248&external_mdio { 249 external_phy: ethernet-phy@0 { 250 /* Realtek RTL8211F (0x001cc916) */ 251 reg = <0>; 252 253 reset-assert-us = <10000>; 254 reset-deassert-us = <30000>; 255 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>; 256 257 interrupt-parent = <&gpio_intc>; 258 /* MAC_INTR on GPIOZ_15 */ 259 interrupts = <25 IRQ_TYPE_LEVEL_LOW>; 260 }; 261}; 262 263&hdmi_tx { 264 status = "okay"; 265 pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>; 266 pinctrl-names = "default"; 267 hdmi-supply = <&hdmi_5v>; 268}; 269 270&hdmi_tx_tmds_port { 271 hdmi_tx_tmds_out: endpoint { 272 remote-endpoint = <&hdmi_connector_in>; 273 }; 274}; 275 276&i2c_A { 277 status = "okay"; 278 pinctrl-0 = <&i2c_a_pins>; 279 pinctrl-names = "default"; 280}; 281 282&i2c_B { 283 status = "okay"; 284 pinctrl-0 = <&i2c_b_pins>; 285 pinctrl-names = "default"; 286 287 rtc: rtc@51 { 288 /* has to be enabled manually when a battery is connected: */ 289 status = "disabled"; 290 compatible = "haoyu,hym8563"; 291 reg = <0x51>; 292 #clock-cells = <0>; 293 clock-frequency = <32768>; 294 clock-output-names = "xin32k"; 295 }; 296}; 297 298&ir { 299 status = "okay"; 300 pinctrl-0 = <&remote_input_ao_pins>; 301 pinctrl-names = "default"; 302 linux,rc-map-name = "rc-khadas"; 303}; 304 305&pwm_AO_ab { 306 status = "okay"; 307 pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>; 308 pinctrl-names = "default"; 309 clocks = <&clkc CLKID_FCLK_DIV4>; 310 clock-names = "clkin0"; 311}; 312 313&pwm_ef { 314 status = "okay"; 315 pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>; 316 pinctrl-names = "default"; 317 clocks = <&clkc CLKID_FCLK_DIV4>; 318 clock-names = "clkin0"; 319}; 320 321&sd_emmc_a { 322 status = "okay"; 323 pinctrl-0 = <&sdio_pins>; 324 pinctrl-1 = <&sdio_clk_gate_pins>; 325 pinctrl-names = "default", "clk-gate"; 326 #address-cells = <1>; 327 #size-cells = <0>; 328 329 bus-width = <4>; 330 max-frequency = <50000000>; 331 332 non-removable; 333 disable-wp; 334 335 /* WiFi firmware requires power to be kept while in suspend */ 336 keep-power-in-suspend; 337 338 mmc-pwrseq = <&sdio_pwrseq>; 339 340 vmmc-supply = <&vddao_3v3>; 341 vqmmc-supply = <&vddio_boot>; 342 343 brcmf: wifi@1 { 344 reg = <1>; 345 compatible = "brcm,bcm4329-fmac"; 346 }; 347}; 348 349/* SD card */ 350&sd_emmc_b { 351 status = "okay"; 352 pinctrl-0 = <&sdcard_pins>; 353 pinctrl-1 = <&sdcard_clk_gate_pins>; 354 pinctrl-names = "default", "clk-gate"; 355 356 bus-width = <4>; 357 cap-sd-highspeed; 358 max-frequency = <50000000>; 359 disable-wp; 360 361 cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>; 362 363 vmmc-supply = <&vddao_3v3>; 364 vqmmc-supply = <&vddio_boot>; 365}; 366 367/* eMMC */ 368&sd_emmc_c { 369 status = "okay"; 370 pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>; 371 pinctrl-1 = <&emmc_clk_gate_pins>; 372 pinctrl-names = "default", "clk-gate"; 373 374 bus-width = <8>; 375 cap-mmc-highspeed; 376 max-frequency = <200000000>; 377 non-removable; 378 disable-wp; 379 mmc-ddr-1_8v; 380 mmc-hs200-1_8v; 381 382 mmc-pwrseq = <&emmc_pwrseq>; 383 vmmc-supply = <&vcc_3v3>; 384 vqmmc-supply = <&vddio_boot>; 385}; 386 387/* 388 * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe 389 * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled 390 */ 391&spifc { 392 status = "disabled"; 393 pinctrl-0 = <&nor_pins>; 394 pinctrl-names = "default"; 395 396 w25q32: spi-flash@0 { 397 #address-cells = <1>; 398 #size-cells = <1>; 399 compatible = "winbond,w25q16", "jedec,spi-nor"; 400 reg = <0>; 401 spi-max-frequency = <3000000>; 402 }; 403}; 404 405/* This one is connected to the Bluetooth module */ 406&uart_A { 407 status = "okay"; 408 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>; 409 pinctrl-names = "default"; 410 uart-has-rtscts; 411 412 bluetooth { 413 compatible = "brcm,bcm43438-bt"; 414 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>; 415 max-speed = <2000000>; 416 clocks = <&wifi32k>; 417 clock-names = "lpo"; 418 }; 419}; 420 421/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */ 422&uart_AO { 423 status = "okay"; 424 pinctrl-0 = <&uart_ao_a_pins>; 425 pinctrl-names = "default"; 426}; 427 428/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */ 429&uart_AO_B { 430 status = "okay"; 431 pinctrl-0 = <&uart_ao_b_pins>; 432 pinctrl-names = "default"; 433}; 434 435&saradc { 436 status = "okay"; 437 vref-supply = <&vddio_ao18>; 438}; 439 440&usb0 { 441 status = "okay"; 442}; 443