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