0001 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
0002 /*
0003 * Copyright (c) 2019 BayLibre, SAS
0004 * Author: Neil Armstrong <narmstrong@baylibre.com>
0005 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
0006 */
0007
0008 #include <dt-bindings/input/input.h>
0009 #include <dt-bindings/leds/common.h>
0010 #include <dt-bindings/gpio/meson-g12a-gpio.h>
0011 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
0012
0013 / {
0014 aliases {
0015 serial0 = &uart_AO;
0016 ethernet0 = ðmac;
0017 rtc0 = &rtc;
0018 rtc1 = &vrtc;
0019 };
0020
0021 chosen {
0022 stdout-path = "serial0:115200n8";
0023 };
0024
0025 memory@0 {
0026 device_type = "memory";
0027 reg = <0x0 0x0 0x0 0x80000000>;
0028 };
0029
0030 adc-keys {
0031 compatible = "adc-keys";
0032 io-channels = <&saradc 2>;
0033 io-channel-names = "buttons";
0034 keyup-threshold-microvolt = <1710000>;
0035
0036 button-function {
0037 label = "Function";
0038 linux,code = <KEY_FN>;
0039 press-threshold-microvolt = <10000>;
0040 };
0041 };
0042
0043 leds {
0044 compatible = "gpio-leds";
0045
0046 led-white {
0047 color = <LED_COLOR_ID_WHITE>;
0048 function = LED_FUNCTION_STATUS;
0049 gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
0050 linux,default-trigger = "heartbeat";
0051 };
0052
0053 led-red {
0054 color = <LED_COLOR_ID_RED>;
0055 function = LED_FUNCTION_STATUS;
0056 gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
0057 };
0058 };
0059
0060 emmc_pwrseq: emmc-pwrseq {
0061 compatible = "mmc-pwrseq-emmc";
0062 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
0063 };
0064
0065 gpio-keys-polled {
0066 compatible = "gpio-keys-polled";
0067 poll-interval = <100>;
0068
0069 power-button {
0070 label = "power";
0071 linux,code = <KEY_POWER>;
0072 gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
0073 };
0074 };
0075
0076 sdio_pwrseq: sdio-pwrseq {
0077 compatible = "mmc-pwrseq-simple";
0078 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
0079 clocks = <&wifi32k>;
0080 clock-names = "ext_clock";
0081 };
0082
0083 dc_in: regulator-dc_in {
0084 compatible = "regulator-fixed";
0085 regulator-name = "DC_IN";
0086 regulator-min-microvolt = <5000000>;
0087 regulator-max-microvolt = <5000000>;
0088 regulator-always-on;
0089 };
0090
0091 vcc_5v: regulator-vcc_5v {
0092 compatible = "regulator-fixed";
0093 regulator-name = "VCC_5V";
0094 regulator-min-microvolt = <5000000>;
0095 regulator-max-microvolt = <5000000>;
0096 vin-supply = <&dc_in>;
0097
0098 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
0099 enable-active-high;
0100 };
0101
0102 vcc_1v8: regulator-vcc_1v8 {
0103 compatible = "regulator-fixed";
0104 regulator-name = "VCC_1V8";
0105 regulator-min-microvolt = <1800000>;
0106 regulator-max-microvolt = <1800000>;
0107 vin-supply = <&vcc_3v3>;
0108 regulator-always-on;
0109 };
0110
0111 vcc_3v3: regulator-vcc_3v3 {
0112 compatible = "regulator-fixed";
0113 regulator-name = "VCC_3V3";
0114 regulator-min-microvolt = <3300000>;
0115 regulator-max-microvolt = <3300000>;
0116 vin-supply = <&vsys_3v3>;
0117 regulator-always-on;
0118 /* FIXME: actually controlled by VDDCPU_B_EN */
0119 };
0120
0121 vddao_1v8: regulator-vddao_1v8 {
0122 compatible = "regulator-fixed";
0123 regulator-name = "VDDIO_AO1V8";
0124 regulator-min-microvolt = <1800000>;
0125 regulator-max-microvolt = <1800000>;
0126 vin-supply = <&vsys_3v3>;
0127 regulator-always-on;
0128 };
0129
0130 emmc_1v8: regulator-emmc_1v8 {
0131 compatible = "regulator-fixed";
0132 regulator-name = "EMMC_AO1V8";
0133 regulator-min-microvolt = <1800000>;
0134 regulator-max-microvolt = <1800000>;
0135 vin-supply = <&vcc_3v3>;
0136 regulator-always-on;
0137 };
0138
0139 vsys_3v3: regulator-vsys_3v3 {
0140 compatible = "regulator-fixed";
0141 regulator-name = "VSYS_3V3";
0142 regulator-min-microvolt = <3300000>;
0143 regulator-max-microvolt = <3300000>;
0144 vin-supply = <&dc_in>;
0145 regulator-always-on;
0146 };
0147
0148 usb_pwr: regulator-usb_pwr {
0149 compatible = "regulator-fixed";
0150 regulator-name = "USB_PWR";
0151 regulator-min-microvolt = <5000000>;
0152 regulator-max-microvolt = <5000000>;
0153 vin-supply = <&vcc_5v>;
0154
0155 gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
0156 enable-active-high;
0157 };
0158
0159 hdmi-connector {
0160 compatible = "hdmi-connector";
0161 type = "a";
0162
0163 port {
0164 hdmi_connector_in: endpoint {
0165 remote-endpoint = <&hdmi_tx_tmds_out>;
0166 };
0167 };
0168 };
0169
0170
0171 sound {
0172 compatible = "amlogic,axg-sound-card";
0173 model = "KHADAS-VIM3";
0174 audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
0175 audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
0176 "TDMOUT_A IN 1", "FRDDR_B OUT 0",
0177 "TDMOUT_A IN 2", "FRDDR_C OUT 0",
0178 "TDM_A Playback", "TDMOUT_A OUT",
0179 "TDMIN_A IN 0", "TDM_A Capture",
0180 "TDMIN_A IN 3", "TDM_A Loopback",
0181 "TODDR_A IN 0", "TDMIN_A OUT",
0182 "TODDR_B IN 0", "TDMIN_A OUT",
0183 "TODDR_C IN 0", "TDMIN_A OUT";
0184
0185 assigned-clocks = <&clkc CLKID_MPLL2>,
0186 <&clkc CLKID_MPLL0>,
0187 <&clkc CLKID_MPLL1>;
0188 assigned-clock-parents = <0>, <0>, <0>;
0189 assigned-clock-rates = <294912000>,
0190 <270950400>,
0191 <393216000>;
0192 status = "okay";
0193
0194 dai-link-0 {
0195 sound-dai = <&frddr_a>;
0196 };
0197
0198 dai-link-1 {
0199 sound-dai = <&frddr_b>;
0200 };
0201
0202 dai-link-2 {
0203 sound-dai = <&frddr_c>;
0204 };
0205
0206 dai-link-3 {
0207 sound-dai = <&toddr_a>;
0208 };
0209
0210 dai-link-4 {
0211 sound-dai = <&toddr_b>;
0212 };
0213
0214 dai-link-5 {
0215 sound-dai = <&toddr_c>;
0216 };
0217
0218 /* 8ch hdmi interface */
0219 dai-link-6 {
0220 sound-dai = <&tdmif_a>;
0221 dai-format = "i2s";
0222 dai-tdm-slot-tx-mask-0 = <1 1>;
0223 dai-tdm-slot-tx-mask-1 = <1 1>;
0224 dai-tdm-slot-tx-mask-2 = <1 1>;
0225 dai-tdm-slot-tx-mask-3 = <1 1>;
0226 mclk-fs = <256>;
0227
0228 codec {
0229 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
0230 };
0231 };
0232
0233 /* hdmi glue */
0234 dai-link-7 {
0235 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
0236
0237 codec {
0238 sound-dai = <&hdmi_tx>;
0239 };
0240 };
0241 };
0242
0243 wifi32k: wifi32k {
0244 compatible = "pwm-clock";
0245 #clock-cells = <0>;
0246 clock-frequency = <32768>;
0247 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
0248 };
0249 };
0250
0251 &arb {
0252 status = "okay";
0253 };
0254
0255 &clkc_audio {
0256 status = "okay";
0257 };
0258
0259 &cec_AO {
0260 pinctrl-0 = <&cec_ao_a_h_pins>;
0261 pinctrl-names = "default";
0262 status = "disabled";
0263 hdmi-phandle = <&hdmi_tx>;
0264 };
0265
0266 &cecb_AO {
0267 pinctrl-0 = <&cec_ao_b_h_pins>;
0268 pinctrl-names = "default";
0269 status = "okay";
0270 hdmi-phandle = <&hdmi_tx>;
0271 };
0272
0273 &cpu_thermal {
0274 trips {
0275 cpu_active: cpu-active {
0276 temperature = <80000>; /* millicelsius */
0277 hysteresis = <2000>; /* millicelsius */
0278 type = "active";
0279 };
0280 };
0281
0282 cooling-maps {
0283 map {
0284 trip = <&cpu_active>;
0285 cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
0286 };
0287 };
0288 };
0289
0290 &ext_mdio {
0291 external_phy: ethernet-phy@0 {
0292 /* Realtek RTL8211F (0x001cc916) */
0293 reg = <0>;
0294 max-speed = <1000>;
0295
0296 interrupt-parent = <&gpio_intc>;
0297 /* MAC_INTR on GPIOZ_14 */
0298 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
0299 };
0300 };
0301
0302 ðmac {
0303 pinctrl-0 = <ð_pins>, <ð_rgmii_pins>;
0304 pinctrl-names = "default";
0305 status = "okay";
0306 phy-mode = "rgmii";
0307 phy-handle = <&external_phy>;
0308 amlogic,tx-delay-ns = <2>;
0309 };
0310
0311 &frddr_a {
0312 status = "okay";
0313 };
0314
0315 &frddr_b {
0316 status = "okay";
0317 };
0318
0319 &frddr_c {
0320 status = "okay";
0321 };
0322
0323 &hdmi_tx {
0324 status = "okay";
0325 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
0326 pinctrl-names = "default";
0327 hdmi-supply = <&vcc_5v>;
0328 };
0329
0330 &hdmi_tx_tmds_port {
0331 hdmi_tx_tmds_out: endpoint {
0332 remote-endpoint = <&hdmi_connector_in>;
0333 };
0334 };
0335
0336 &i2c_AO {
0337 status = "okay";
0338 pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
0339 pinctrl-names = "default";
0340
0341 khadas_mcu: system-controller@18 {
0342 compatible = "khadas,mcu";
0343 reg = <0x18>;
0344 #cooling-cells = <2>;
0345 };
0346
0347 gpio_expander: gpio-controller@20 {
0348 compatible = "ti,tca6408";
0349 reg = <0x20>;
0350 vcc-supply = <&vcc_3v3>;
0351 gpio-controller;
0352 #gpio-cells = <2>;
0353 };
0354
0355 rtc: rtc@51 {
0356 compatible = "haoyu,hym8563";
0357 reg = <0x51>;
0358 #clock-cells = <0>;
0359 };
0360 };
0361
0362 &ir {
0363 status = "okay";
0364 pinctrl-0 = <&remote_input_ao_pins>;
0365 pinctrl-names = "default";
0366 linux,rc-map-name = "rc-khadas";
0367 };
0368
0369 &pcie {
0370 reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
0371 };
0372
0373 &pwm_ef {
0374 status = "okay";
0375 pinctrl-0 = <&pwm_e_pins>;
0376 pinctrl-names = "default";
0377 };
0378
0379 &saradc {
0380 status = "okay";
0381 vref-supply = <&vddao_1v8>;
0382 };
0383
0384 /* SDIO */
0385 &sd_emmc_a {
0386 status = "okay";
0387 pinctrl-0 = <&sdio_pins>;
0388 pinctrl-1 = <&sdio_clk_gate_pins>;
0389 pinctrl-names = "default", "clk-gate";
0390 #address-cells = <1>;
0391 #size-cells = <0>;
0392
0393 bus-width = <4>;
0394 cap-sd-highspeed;
0395 max-frequency = <100000000>;
0396
0397 non-removable;
0398 disable-wp;
0399
0400 /* WiFi firmware requires power to be kept while in suspend */
0401 keep-power-in-suspend;
0402
0403 mmc-pwrseq = <&sdio_pwrseq>;
0404
0405 vmmc-supply = <&vsys_3v3>;
0406 vqmmc-supply = <&vddao_1v8>;
0407
0408 brcmf: wifi@1 {
0409 reg = <1>;
0410 compatible = "brcm,bcm4329-fmac";
0411 };
0412 };
0413
0414 /* SD card */
0415 &sd_emmc_b {
0416 status = "okay";
0417 pinctrl-0 = <&sdcard_c_pins>;
0418 pinctrl-1 = <&sdcard_clk_gate_c_pins>;
0419 pinctrl-names = "default", "clk-gate";
0420
0421 bus-width = <4>;
0422 cap-sd-highspeed;
0423 max-frequency = <50000000>;
0424 disable-wp;
0425
0426 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
0427 vmmc-supply = <&vsys_3v3>;
0428 vqmmc-supply = <&vsys_3v3>;
0429 };
0430
0431 /* eMMC */
0432 &sd_emmc_c {
0433 status = "okay";
0434 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
0435 pinctrl-1 = <&emmc_clk_gate_pins>;
0436 pinctrl-names = "default", "clk-gate";
0437
0438 bus-width = <8>;
0439 cap-mmc-highspeed;
0440 mmc-ddr-1_8v;
0441 mmc-hs200-1_8v;
0442 max-frequency = <200000000>;
0443 disable-wp;
0444
0445 mmc-pwrseq = <&emmc_pwrseq>;
0446 vmmc-supply = <&vcc_3v3>;
0447 vqmmc-supply = <&emmc_1v8>;
0448 };
0449
0450 /*
0451 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
0452 * and eMMC Data 4 to 7 pins.
0453 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
0454 * and change bus-width to 4 then spifc can be enabled.
0455 */
0456 &spifc {
0457 status = "disabled";
0458 pinctrl-0 = <&nor_pins>;
0459 pinctrl-names = "default";
0460
0461 w25q128: flash@0 {
0462 #address-cells = <1>;
0463 #size-cells = <1>;
0464 compatible = "winbond,w25q128fw", "jedec,spi-nor";
0465 reg = <0>;
0466 spi-max-frequency = <104000000>;
0467 };
0468 };
0469
0470 &tdmif_a {
0471 status = "okay";
0472 };
0473
0474 &tdmin_a {
0475 status = "okay";
0476 };
0477
0478 &tdmout_a {
0479 status = "okay";
0480 };
0481
0482 &toddr_a {
0483 status = "okay";
0484 };
0485
0486 &toddr_b {
0487 status = "okay";
0488 };
0489
0490 &toddr_c {
0491 status = "okay";
0492 };
0493
0494 &tohdmitx {
0495 status = "okay";
0496 };
0497
0498 &uart_A {
0499 status = "okay";
0500 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
0501 pinctrl-names = "default";
0502 uart-has-rtscts;
0503
0504 bluetooth {
0505 compatible = "brcm,bcm43438-bt";
0506 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
0507 max-speed = <2000000>;
0508 clocks = <&wifi32k>;
0509 clock-names = "lpo";
0510 };
0511 };
0512
0513 &uart_AO {
0514 status = "okay";
0515 pinctrl-0 = <&uart_ao_a_pins>;
0516 pinctrl-names = "default";
0517 };
0518
0519 &usb2_phy0 {
0520 phy-supply = <&dc_in>;
0521 };
0522
0523 &usb2_phy1 {
0524 phy-supply = <&usb_pwr>;
0525 };
0526
0527 &usb3_pcie_phy {
0528 phy-supply = <&usb_pwr>;
0529 };
0530
0531 &usb {
0532 status = "okay";
0533 dr_mode = "peripheral";
0534 };