Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
0002 /*
0003  * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
0004  * Copyright (c) 2017 BayLibre, SAS
0005  * Author: Neil Armstrong <narmstrong@baylibre.com>
0006  */
0007 
0008 /dts-v1/;
0009 
0010 #include "meson-gxm.dtsi"
0011 #include <dt-bindings/input/input.h>
0012 #include <dt-bindings/sound/meson-aiu.h>
0013 
0014 / {
0015         compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
0016         model = "Khadas VIM2";
0017 
0018         aliases {
0019                 serial0 = &uart_AO;
0020                 serial2 = &uart_AO_B;
0021         };
0022 
0023         chosen {
0024                 stdout-path = "serial0:115200n8";
0025         };
0026 
0027         memory@0 {
0028                 device_type = "memory";
0029                 reg = <0x0 0x0 0x0 0x80000000>;
0030         };
0031 
0032         adc-keys {
0033                 compatible = "adc-keys";
0034                 io-channels = <&saradc 0>;
0035                 io-channel-names = "buttons";
0036                 keyup-threshold-microvolt = <1710000>;
0037 
0038                 button-function {
0039                         label = "Function";
0040                         linux,code = <KEY_FN>;
0041                         press-threshold-microvolt = <10000>;
0042                 };
0043         };
0044 
0045         emmc_pwrseq: emmc-pwrseq {
0046                 compatible = "mmc-pwrseq-emmc";
0047                 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
0048         };
0049 
0050         gpio_fan: gpio-fan {
0051                 compatible = "gpio-fan";
0052                 gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
0053                          &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
0054                 /* Dummy RPM values since fan is optional */
0055                 gpio-fan,speed-map = <0 0
0056                                       1 1
0057                                       2 2
0058                                       3 3>;
0059                 #cooling-cells = <2>;
0060         };
0061 
0062         gpio-keys-polled {
0063                 compatible = "gpio-keys-polled";
0064                 poll-interval = <100>;
0065 
0066                 power-button {
0067                         label = "power";
0068                         linux,code = <KEY_POWER>;
0069                         gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
0070                 };
0071         };
0072 
0073         hdmi-connector {
0074                 compatible = "hdmi-connector";
0075                 type = "a";
0076 
0077                 port {
0078                         hdmi_connector_in: endpoint {
0079                                 remote-endpoint = <&hdmi_tx_tmds_out>;
0080                         };
0081                 };
0082         };
0083 
0084         led-controller {
0085                 compatible = "pwm-leds";
0086 
0087                 led-1 {
0088                         label = "vim:red:power";
0089                         pwms = <&pwm_AO_ab 1 7812500 0>;
0090                         max-brightness = <255>;
0091                         linux,default-trigger = "default-on";
0092                 };
0093         };
0094 
0095         sdio_pwrseq: sdio-pwrseq {
0096                 compatible = "mmc-pwrseq-simple";
0097                 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
0098                 clocks = <&wifi32k>;
0099                 clock-names = "ext_clock";
0100         };
0101 
0102         hdmi_5v: regulator-hdmi-5v {
0103                 compatible = "regulator-fixed";
0104 
0105                 regulator-name = "HDMI_5V";
0106                 regulator-min-microvolt = <5000000>;
0107                 regulator-max-microvolt = <5000000>;
0108 
0109                 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
0110                 enable-active-high;
0111                 regulator-always-on;
0112         };
0113 
0114         vcc_3v3: regulator-vcc_3v3 {
0115                 compatible = "regulator-fixed";
0116                 regulator-name = "VCC_3V3";
0117                 regulator-min-microvolt = <3300000>;
0118                 regulator-max-microvolt = <3300000>;
0119         };
0120 
0121         vddio_ao18: regulator-vddio_ao18 {
0122                 compatible = "regulator-fixed";
0123                 regulator-name = "VDDIO_AO18";
0124                 regulator-min-microvolt = <1800000>;
0125                 regulator-max-microvolt = <1800000>;
0126         };
0127 
0128         vddio_boot: regulator-vddio_boot {
0129                 compatible = "regulator-fixed";
0130                 regulator-name = "VDDIO_BOOT";
0131                 regulator-min-microvolt = <1800000>;
0132                 regulator-max-microvolt = <1800000>;
0133         };
0134 
0135         vddao_3v3: regulator-vddao_3v3 {
0136                 compatible = "regulator-fixed";
0137                 regulator-name = "VDDAO_3V3";
0138                 regulator-min-microvolt = <3300000>;
0139                 regulator-max-microvolt = <3300000>;
0140         };
0141 
0142         wifi32k: wifi32k {
0143                 compatible = "pwm-clock";
0144                 #clock-cells = <0>;
0145                 clock-frequency = <32768>;
0146                 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
0147         };
0148 
0149         sound {
0150                 compatible = "amlogic,gx-sound-card";
0151                 model = "KHADAS-VIM2";
0152                 assigned-clocks = <&clkc CLKID_MPLL0>,
0153                                   <&clkc CLKID_MPLL1>,
0154                                   <&clkc CLKID_MPLL2>;
0155                 assigned-clock-parents = <0>, <0>, <0>;
0156                 assigned-clock-rates = <294912000>,
0157                                        <270950400>,
0158                                        <393216000>;
0159                 status = "okay";
0160 
0161                 dai-link-0 {
0162                         sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
0163                 };
0164 
0165                 dai-link-1 {
0166                         sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
0167                         dai-format = "i2s";
0168                         mclk-fs = <256>;
0169 
0170                         codec-0 {
0171                                 sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
0172                         };
0173                 };
0174 
0175                 dai-link-2 {
0176                         sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
0177 
0178                         codec-0 {
0179                                 sound-dai = <&hdmi_tx>;
0180                         };
0181                 };
0182         };
0183 };
0184 
0185 &aiu {
0186         status = "okay";
0187 };
0188 
0189 &cec_AO {
0190         status = "okay";
0191         pinctrl-0 = <&ao_cec_pins>;
0192         pinctrl-names = "default";
0193         hdmi-phandle = <&hdmi_tx>;
0194 };
0195 
0196 &cpu_cooling_maps {
0197         map0 {
0198                 cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
0199         };
0200 
0201         map1 {
0202                 cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
0203                                  <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0204                                  <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0205                                  <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0206                                  <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0207                                  <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0208                                  <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0209                                  <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
0210                                  <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
0211         };
0212 };
0213 
0214 &ethmac {
0215         pinctrl-0 = <&eth_pins>;
0216         pinctrl-names = "default";
0217 
0218         /* Select external PHY by default */
0219         phy-handle = <&external_phy>;
0220 
0221         amlogic,tx-delay-ns = <2>;
0222 
0223         /* External PHY is in RGMII */
0224         phy-mode = "rgmii";
0225 
0226         status = "okay";
0227 };
0228 
0229 &external_mdio {
0230         external_phy: ethernet-phy@0 {
0231                 /* Realtek RTL8211F (0x001cc916) */
0232                 reg = <0>;
0233 
0234                 reset-assert-us = <10000>;
0235                 reset-deassert-us = <80000>;
0236                 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
0237 
0238                 interrupt-parent = <&gpio_intc>;
0239                 /* MAC_INTR on GPIOZ_15 */
0240                 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
0241         };
0242 };
0243 
0244 &hdmi_tx {
0245         status = "okay";
0246         pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
0247         pinctrl-names = "default";
0248         hdmi-supply = <&hdmi_5v>;
0249 };
0250 
0251 &hdmi_tx_tmds_port {
0252         hdmi_tx_tmds_out: endpoint {
0253                 remote-endpoint = <&hdmi_connector_in>;
0254         };
0255 };
0256 
0257 &i2c_A {
0258         status = "okay";
0259         pinctrl-0 = <&i2c_a_pins>;
0260         pinctrl-names = "default";
0261 };
0262 
0263 &i2c_B {
0264         status = "okay";
0265         pinctrl-0 = <&i2c_b_pins>;
0266         pinctrl-names = "default";
0267 
0268         rtc: rtc@51 {
0269                 status = "okay";
0270                 compatible = "haoyu,hym8563";
0271                 reg = <0x51>;
0272                 #clock-cells = <0>;
0273                 clock-frequency = <32768>;
0274                 clock-output-names = "xin32k";
0275         };
0276 };
0277 
0278 &ir {
0279         status = "okay";
0280         pinctrl-0 = <&remote_input_ao_pins>;
0281         pinctrl-names = "default";
0282         linux,rc-map-name = "rc-khadas";
0283 };
0284 
0285 &pwm_AO_ab {
0286         status = "okay";
0287         pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
0288         pinctrl-names = "default";
0289         clocks = <&clkc CLKID_FCLK_DIV4>;
0290         clock-names = "clkin0";
0291 };
0292 
0293 &pwm_ef {
0294         status = "okay";
0295         pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
0296         pinctrl-names = "default";
0297         clocks = <&clkc CLKID_FCLK_DIV4>;
0298         clock-names = "clkin0";
0299 };
0300 
0301 &sd_emmc_a {
0302         status = "okay";
0303         pinctrl-0 = <&sdio_pins>;
0304         pinctrl-1 = <&sdio_clk_gate_pins>;
0305         pinctrl-names = "default", "clk-gate";
0306         #address-cells = <1>;
0307         #size-cells = <0>;
0308 
0309         bus-width = <4>;
0310         cap-sd-highspeed;
0311         max-frequency = <100000000>;
0312 
0313         non-removable;
0314         disable-wp;
0315 
0316         /* WiFi firmware requires power to be kept while in suspend */
0317         keep-power-in-suspend;
0318 
0319         mmc-pwrseq = <&sdio_pwrseq>;
0320 
0321         vmmc-supply = <&vddao_3v3>;
0322         vqmmc-supply = <&vddio_boot>;
0323 
0324         brcmf: wifi@1 {
0325                 reg = <1>;
0326                 compatible = "brcm,bcm4329-fmac";
0327         };
0328 };
0329 
0330 /* SD card */
0331 &sd_emmc_b {
0332         status = "okay";
0333         pinctrl-0 = <&sdcard_pins>;
0334         pinctrl-1 = <&sdcard_clk_gate_pins>;
0335         pinctrl-names = "default", "clk-gate";
0336 
0337         bus-width = <4>;
0338         cap-sd-highspeed;
0339         max-frequency = <50000000>;
0340         disable-wp;
0341 
0342         cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
0343 
0344         vmmc-supply = <&vddao_3v3>;
0345         vqmmc-supply = <&vddio_boot>;
0346 };
0347 
0348 /* eMMC */
0349 &sd_emmc_c {
0350         status = "okay";
0351         pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
0352         pinctrl-1 = <&emmc_clk_gate_pins>;
0353         pinctrl-names = "default", "clk-gate";
0354 
0355         bus-width = <8>;
0356         cap-mmc-highspeed;
0357         max-frequency = <200000000>;
0358         non-removable;
0359         disable-wp;
0360         mmc-ddr-1_8v;
0361         mmc-hs200-1_8v;
0362 
0363         mmc-pwrseq = <&emmc_pwrseq>;
0364         vmmc-supply = <&vcc_3v3>;
0365         vqmmc-supply = <&vddio_boot>;
0366 };
0367 
0368 /*
0369  * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
0370  * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
0371  */
0372 &spifc {
0373         status = "disabled";
0374         pinctrl-0 = <&nor_pins>;
0375         pinctrl-names = "default";
0376 
0377         w25q32: flash@0 {
0378                 #address-cells = <1>;
0379                 #size-cells = <1>;
0380                 compatible = "winbond,w25q16", "jedec,spi-nor";
0381                 reg = <0>;
0382                 spi-max-frequency = <104000000>;
0383         };
0384 };
0385 
0386 /* This one is connected to the Bluetooth module */
0387 &uart_A {
0388         status = "okay";
0389         pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
0390         pinctrl-names = "default";
0391         uart-has-rtscts;
0392 
0393         bluetooth {
0394                 compatible = "brcm,bcm43438-bt";
0395                 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
0396                 max-speed = <2000000>;
0397                 clocks = <&wifi32k>;
0398                 clock-names = "lpo";
0399         };
0400 };
0401 
0402 /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
0403 &uart_AO {
0404         status = "okay";
0405         pinctrl-0 = <&uart_ao_a_pins>;
0406         pinctrl-names = "default";
0407 };
0408 
0409 /* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
0410 &uart_AO_B {
0411         status = "okay";
0412         pinctrl-0 = <&uart_ao_b_pins>;
0413         pinctrl-names = "default";
0414 };
0415 
0416 &saradc {
0417         status = "okay";
0418         vref-supply = <&vddio_ao18>;
0419 };
0420 
0421 &usb {
0422         status = "okay";
0423         dr_mode = "peripheral";
0424 };