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