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