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