blob: 18a4b7a6c5df5b835ea7b62c322c3fe76a58a065 [file] [log] [blame]
Loic Devulder0bc93bc2018-10-03 12:02:06 +02001// 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
Loic Devulder0bc93bc2018-10-03 12:02:06 +020010#include "meson-gxm.dtsi"
Neil Armstrong425d9d52021-09-17 09:37:00 +020011#include <dt-bindings/input/input.h>
12#include <dt-bindings/sound/meson-aiu.h>
Loic Devulder0bc93bc2018-10-03 12:02:06 +020013
14/ {
15 compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
16 model = "Khadas VIM2";
17
18 aliases {
19 serial0 = &uart_AO;
Loic Devulder0bc93bc2018-10-03 12:02:06 +020020 serial2 = &uart_AO_B;
21 };
22
23 chosen {
24 stdout-path = "serial0:115200n8";
25 };
26
27 memory@0 {
28 device_type = "memory";
29 reg = <0x0 0x0 0x0 0x80000000>;
30 };
31
32 adc-keys {
33 compatible = "adc-keys";
34 io-channels = <&saradc 0>;
35 io-channel-names = "buttons";
36 keyup-threshold-microvolt = <1710000>;
37
38 button-function {
39 label = "Function";
40 linux,code = <KEY_FN>;
41 press-threshold-microvolt = <10000>;
42 };
43 };
44
45 emmc_pwrseq: emmc-pwrseq {
46 compatible = "mmc-pwrseq-emmc";
47 reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
48 };
49
50 gpio_fan: gpio-fan {
51 compatible = "gpio-fan";
52 gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
53 &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
54 /* Dummy RPM values since fan is optional */
55 gpio-fan,speed-map = <0 0
56 1 1
57 2 2
58 3 3>;
59 #cooling-cells = <2>;
60 };
61
62 gpio-keys-polled {
63 compatible = "gpio-keys-polled";
Loic Devulder0bc93bc2018-10-03 12:02:06 +020064 poll-interval = <100>;
65
Jerome Brunetd34d5ef2020-03-05 12:12:38 +010066 power-button {
Loic Devulder0bc93bc2018-10-03 12:02:06 +020067 label = "power";
68 linux,code = <KEY_POWER>;
69 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
70 };
71 };
72
73 hdmi-connector {
74 compatible = "hdmi-connector";
75 type = "a";
76
77 port {
78 hdmi_connector_in: endpoint {
79 remote-endpoint = <&hdmi_tx_tmds_out>;
80 };
81 };
82 };
83
Neil Armstrong425d9d52021-09-17 09:37:00 +020084 led-controller {
Loic Devulder0bc93bc2018-10-03 12:02:06 +020085 compatible = "pwm-leds";
86
Neil Armstrong425d9d52021-09-17 09:37:00 +020087 led-1 {
Loic Devulder0bc93bc2018-10-03 12:02:06 +020088 label = "vim:red:power";
89 pwms = <&pwm_AO_ab 1 7812500 0>;
90 max-brightness = <255>;
91 linux,default-trigger = "default-on";
92 };
93 };
94
95 sdio_pwrseq: sdio-pwrseq {
96 compatible = "mmc-pwrseq-simple";
97 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
98 clocks = <&wifi32k>;
99 clock-names = "ext_clock";
100 };
101
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200102 hdmi_5v: regulator-hdmi-5v {
103 compatible = "regulator-fixed";
104
105 regulator-name = "HDMI_5V";
106 regulator-min-microvolt = <5000000>;
107 regulator-max-microvolt = <5000000>;
108
109 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
110 enable-active-high;
111 regulator-always-on;
112 };
113
114 vcc_3v3: regulator-vcc_3v3 {
115 compatible = "regulator-fixed";
116 regulator-name = "VCC_3V3";
117 regulator-min-microvolt = <3300000>;
118 regulator-max-microvolt = <3300000>;
119 };
120
121 vddio_ao18: regulator-vddio_ao18 {
122 compatible = "regulator-fixed";
123 regulator-name = "VDDIO_AO18";
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 };
127
128 vddio_boot: regulator-vddio_boot {
129 compatible = "regulator-fixed";
130 regulator-name = "VDDIO_BOOT";
131 regulator-min-microvolt = <1800000>;
132 regulator-max-microvolt = <1800000>;
133 };
134
135 vddao_3v3: regulator-vddao_3v3 {
136 compatible = "regulator-fixed";
137 regulator-name = "VDDAO_3V3";
138 regulator-min-microvolt = <3300000>;
139 regulator-max-microvolt = <3300000>;
140 };
141
142 wifi32k: wifi32k {
143 compatible = "pwm-clock";
144 #clock-cells = <0>;
145 clock-frequency = <32768>;
146 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
147 };
Neil Armstrong425d9d52021-09-17 09:37:00 +0200148
149 sound {
150 compatible = "amlogic,gx-sound-card";
151 model = "KHADAS-VIM2";
152 assigned-clocks = <&clkc CLKID_MPLL0>,
153 <&clkc CLKID_MPLL1>,
154 <&clkc CLKID_MPLL2>;
155 assigned-clock-parents = <0>, <0>, <0>;
156 assigned-clock-rates = <294912000>,
157 <270950400>,
158 <393216000>;
159 status = "okay";
160
161 dai-link-0 {
162 sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
163 };
164
165 dai-link-1 {
166 sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
167 dai-format = "i2s";
168 mclk-fs = <256>;
169
170 codec-0 {
171 sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
172 };
173 };
174
175 dai-link-2 {
176 sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
177
178 codec-0 {
179 sound-dai = <&hdmi_tx>;
180 };
181 };
182 };
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200183};
184
Neil Armstrong425d9d52021-09-17 09:37:00 +0200185&aiu {
186 status = "okay";
187};
188
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200189&cec_AO {
190 status = "okay";
191 pinctrl-0 = <&ao_cec_pins>;
192 pinctrl-names = "default";
193 hdmi-phandle = <&hdmi_tx>;
194};
195
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200196&cpu_cooling_maps {
197 map0 {
198 cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
199 };
Loic Devulderc0379032018-11-27 17:41:18 +0100200
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200201 map1 {
202 cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
203 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
204 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
205 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
206 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
207 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
208 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
209 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
210 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
211 };
Loic Devulderc0379032018-11-27 17:41:18 +0100212};
213
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200214&ethmac {
215 pinctrl-0 = <&eth_pins>;
216 pinctrl-names = "default";
217
218 /* Select external PHY by default */
219 phy-handle = <&external_phy>;
220
221 amlogic,tx-delay-ns = <2>;
222
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200223 /* External PHY is in RGMII */
224 phy-mode = "rgmii";
225
226 status = "okay";
227};
228
229&external_mdio {
230 external_phy: ethernet-phy@0 {
231 /* Realtek RTL8211F (0x001cc916) */
232 reg = <0>;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100233
234 reset-assert-us = <10000>;
Neil Armstrong425d9d52021-09-17 09:37:00 +0200235 reset-deassert-us = <80000>;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100236 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
237
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200238 interrupt-parent = <&gpio_intc>;
239 /* MAC_INTR on GPIOZ_15 */
240 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
241 };
242};
243
244&hdmi_tx {
245 status = "okay";
246 pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
247 pinctrl-names = "default";
Neil Armstrong7ae6f6e2018-11-06 09:30:14 +0100248 hdmi-supply = <&hdmi_5v>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200249};
250
251&hdmi_tx_tmds_port {
252 hdmi_tx_tmds_out: endpoint {
253 remote-endpoint = <&hdmi_connector_in>;
254 };
255};
256
257&i2c_A {
258 status = "okay";
259 pinctrl-0 = <&i2c_a_pins>;
260 pinctrl-names = "default";
261};
262
263&i2c_B {
264 status = "okay";
265 pinctrl-0 = <&i2c_b_pins>;
266 pinctrl-names = "default";
267
268 rtc: rtc@51 {
Neil Armstrong425d9d52021-09-17 09:37:00 +0200269 status = "okay";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200270 compatible = "haoyu,hym8563";
271 reg = <0x51>;
272 #clock-cells = <0>;
273 clock-frequency = <32768>;
274 clock-output-names = "xin32k";
275 };
276};
277
278&ir {
279 status = "okay";
280 pinctrl-0 = <&remote_input_ao_pins>;
281 pinctrl-names = "default";
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100282 linux,rc-map-name = "rc-khadas";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200283};
284
285&pwm_AO_ab {
286 status = "okay";
287 pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
288 pinctrl-names = "default";
289 clocks = <&clkc CLKID_FCLK_DIV4>;
290 clock-names = "clkin0";
291};
292
293&pwm_ef {
294 status = "okay";
295 pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
296 pinctrl-names = "default";
297 clocks = <&clkc CLKID_FCLK_DIV4>;
298 clock-names = "clkin0";
299};
300
301&sd_emmc_a {
302 status = "okay";
303 pinctrl-0 = <&sdio_pins>;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100304 pinctrl-1 = <&sdio_clk_gate_pins>;
305 pinctrl-names = "default", "clk-gate";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200306 #address-cells = <1>;
307 #size-cells = <0>;
308
309 bus-width = <4>;
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200310 max-frequency = <60000000>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200311
312 non-removable;
313 disable-wp;
314
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100315 /* WiFi firmware requires power to be kept while in suspend */
316 keep-power-in-suspend;
317
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200318 mmc-pwrseq = <&sdio_pwrseq>;
319
320 vmmc-supply = <&vddao_3v3>;
321 vqmmc-supply = <&vddio_boot>;
322
323 brcmf: wifi@1 {
324 reg = <1>;
325 compatible = "brcm,bcm4329-fmac";
326 };
327};
328
329/* SD card */
330&sd_emmc_b {
331 status = "okay";
332 pinctrl-0 = <&sdcard_pins>;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100333 pinctrl-1 = <&sdcard_clk_gate_pins>;
334 pinctrl-names = "default", "clk-gate";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200335
336 bus-width = <4>;
337 cap-sd-highspeed;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100338 max-frequency = <50000000>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200339 disable-wp;
340
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100341 cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200342
343 vmmc-supply = <&vddao_3v3>;
344 vqmmc-supply = <&vddio_boot>;
345};
346
347/* eMMC */
348&sd_emmc_c {
349 status = "okay";
350 pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100351 pinctrl-1 = <&emmc_clk_gate_pins>;
352 pinctrl-names = "default", "clk-gate";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200353
354 bus-width = <8>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200355 cap-mmc-highspeed;
356 max-frequency = <200000000>;
357 non-removable;
358 disable-wp;
359 mmc-ddr-1_8v;
360 mmc-hs200-1_8v;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200361
362 mmc-pwrseq = <&emmc_pwrseq>;
363 vmmc-supply = <&vcc_3v3>;
364 vqmmc-supply = <&vddio_boot>;
365};
366
367/*
368 * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
369 * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
370 */
371&spifc {
372 status = "disabled";
373 pinctrl-0 = <&nor_pins>;
374 pinctrl-names = "default";
375
376 w25q32: spi-flash@0 {
377 #address-cells = <1>;
378 #size-cells = <1>;
379 compatible = "winbond,w25q16", "jedec,spi-nor";
380 reg = <0>;
Neil Armstrong425d9d52021-09-17 09:37:00 +0200381 spi-max-frequency = <104000000>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200382 };
383};
384
385/* This one is connected to the Bluetooth module */
386&uart_A {
387 status = "okay";
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100388 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200389 pinctrl-names = "default";
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100390 uart-has-rtscts;
391
392 bluetooth {
393 compatible = "brcm,bcm43438-bt";
394 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
395 max-speed = <2000000>;
396 clocks = <&wifi32k>;
397 clock-names = "lpo";
398 };
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200399};
400
401/* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
402&uart_AO {
403 status = "okay";
404 pinctrl-0 = <&uart_ao_a_pins>;
405 pinctrl-names = "default";
406};
407
408/* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
409&uart_AO_B {
410 status = "okay";
411 pinctrl-0 = <&uart_ao_b_pins>;
412 pinctrl-names = "default";
413};
414
415&saradc {
416 status = "okay";
417 vref-supply = <&vddio_ao18>;
418};
419
Neil Armstrong14708b12020-09-10 10:48:12 +0200420&usb {
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200421 status = "okay";
Neil Armstrong14708b12020-09-10 10:48:12 +0200422 dr_mode = "peripheral";
Loic Devulder0bc93bc2018-10-03 12:02:06 +0200423};