Debian Codegraph @

arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts

raw
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3 * Copyright (c) 2017 Martin Blumenstingl <[email protected]>.
4 * Copyright (c) 2017 BayLibre, SAS
5 * Author: Neil Armstrong <[email protected]>
6 */
7
8 /dts-v1/;
9
10 #include "meson-gxm.dtsi"
11 #include <dt-bindings/input/input.h>
12 #include <dt-bindings/sound/meson-aiu.h>
13
14 / {
15 compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
16 model = "Khadas VIM2";
17
18 aliases {
19 serial0 = &uart_AO;
20 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 =
56 <0 0>,
57 <1 1>,
58 <2 2>,
59 <3 3>;
60 #cooling-cells = <2>;
61 };
62
63 gpio-keys-polled {
64 compatible = "gpio-keys-polled";
65 poll-interval = <100>;
66
67 power-button {
68 label = "power";
69 linux,code = <KEY_POWER>;
70 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
71 };
72 };
73
74 hdmi-connector {
75 compatible = "hdmi-connector";
76 type = "a";
77
78 port {
79 hdmi_connector_in: endpoint {
80 remote-endpoint = <&hdmi_tx_tmds_out>;
81 };
82 };
83 };
84
85 led-controller {
86 compatible = "pwm-leds";
87
88 led-1 {
89 label = "vim:red:power";
90 pwms = <&pwm_AO_ab 1 7812500 0>;
91 max-brightness = <255>;
92 linux,default-trigger = "default-on";
93 };
94 };
95
96 sdio_pwrseq: sdio-pwrseq {
97 compatible = "mmc-pwrseq-simple";
98 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
99 clocks = <&wifi32k>;
100 clock-names = "ext_clock";
101 };
102
103 hdmi_5v: regulator-hdmi-5v {
104 compatible = "regulator-fixed";
105
106 regulator-name = "HDMI_5V";
107 regulator-min-microvolt = <5000000>;
108 regulator-max-microvolt = <5000000>;
109
110 gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
111 enable-active-high;
112 regulator-always-on;
113 };
114
115 vcc_3v3: regulator-vcc-3v3 {
116 compatible = "regulator-fixed";
117 regulator-name = "VCC_3V3";
118 regulator-min-microvolt = <3300000>;
119 regulator-max-microvolt = <3300000>;
120 };
121
122 vddio_ao18: regulator-vddio-ao18 {
123 compatible = "regulator-fixed";
124 regulator-name = "VDDIO_AO18";
125 regulator-min-microvolt = <1800000>;
126 regulator-max-microvolt = <1800000>;
127 };
128
129 vddio_boot: regulator-vddio-boot {
130 compatible = "regulator-fixed";
131 regulator-name = "VDDIO_BOOT";
132 regulator-min-microvolt = <1800000>;
133 regulator-max-microvolt = <1800000>;
134 };
135
136 vddao_3v3: regulator-vddao-3v3 {
137 compatible = "regulator-fixed";
138 regulator-name = "VDDAO_3V3";
139 regulator-min-microvolt = <3300000>;
140 regulator-max-microvolt = <3300000>;
141 };
142
143 wifi32k: wifi32k {
144 compatible = "pwm-clock";
145 #clock-cells = <0>;
146 clock-frequency = <32768>;
147 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
148 };
149
150 sound {
151 compatible = "amlogic,gx-sound-card";
152 model = "KHADAS-VIM2";
153 clocks = <&clkc CLKID_MPLL0>,
154 <&clkc CLKID_MPLL1>,
155 <&clkc CLKID_MPLL2>;
156
157 assigned-clocks = <&clkc CLKID_MPLL0>,
158 <&clkc CLKID_MPLL1>,
159 <&clkc CLKID_MPLL2>;
160 assigned-clock-rates = <294912000>,
161 <270950400>,
162 <393216000>;
163
164 dai-link-0 {
165 sound-dai = <&aiu AIU_CPU CPU_I2S_FIFO>;
166 };
167
168 dai-link-1 {
169 sound-dai = <&aiu AIU_CPU CPU_I2S_ENCODER>;
170 dai-format = "i2s";
171 mclk-fs = <256>;
172
173 codec-0 {
174 sound-dai = <&aiu AIU_HDMI CTRL_I2S>;
175 };
176 };
177
178 dai-link-2 {
179 sound-dai = <&aiu AIU_HDMI CTRL_OUT>;
180
181 codec-0 {
182 sound-dai = <&hdmi_tx>;
183 };
184 };
185 };
186 };
187
188 &aiu {
189 status = "okay";
190 };
191
192 &cec_AO {
193 status = "okay";
194 pinctrl-0 = <&ao_cec_pins>;
195 pinctrl-names = "default";
196 hdmi-phandle = <&hdmi_tx>;
197 };
198
199 &cpu_cooling_maps {
200 map0 {
201 cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
202 };
203
204 map1 {
205 cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
206 <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
207 <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
208 <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
209 <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
210 <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
211 <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
212 <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
213 <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
214 };
215 };
216
217 &ethmac {
218 pinctrl-0 = <&eth_pins>;
219 pinctrl-names = "default";
220
221 /* Select external PHY by default */
222 phy-handle = <&external_phy>;
223
224 amlogic,tx-delay-ns = <2>;
225
226 /* External PHY is in RGMII */
227 phy-mode = "rgmii";
228
229 status = "okay";
230 };
231
232 &external_mdio {
233 external_phy: ethernet-phy@0 {
234 /* Realtek RTL8211F (0x001cc916) */
235 reg = <0>;
236
237 reset-assert-us = <10000>;
238 reset-deassert-us = <80000>;
239 reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
240
241 interrupt-parent = <&gpio_intc>;
242 /* MAC_INTR on GPIOZ_15 */
243 interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
244 };
245 };
246
247 &hdmi_tx {
248 status = "okay";
249 pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
250 pinctrl-names = "default";
251 hdmi-supply = <&hdmi_5v>;
252 };
253
254 &hdmi_tx_tmds_port {
255 hdmi_tx_tmds_out: endpoint {
256 remote-endpoint = <&hdmi_connector_in>;
257 };
258 };
259
260 &i2c_A {
261 status = "okay";
262 pinctrl-0 = <&i2c_a_pins>;
263 pinctrl-names = "default";
264 };
265
266 &i2c_B {
267 status = "okay";
268 pinctrl-0 = <&i2c_b_pins>;
269 pinctrl-names = "default";
270
271 rtc: rtc@51 {
272 status = "okay";
273 compatible = "haoyu,hym8563";
274 reg = <0x51>;
275 #clock-cells = <0>;
276 clock-output-names = "xin32k";
277 };
278 };
279
280 &ir {
281 status = "okay";
282 pinctrl-0 = <&remote_input_ao_pins>;
283 pinctrl-names = "default";
284 linux,rc-map-name = "rc-khadas";
285 };
286
287 &pwm_AO_ab {
288 status = "okay";
289 pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
290 pinctrl-names = "default";
291 };
292
293 &pwm_ef {
294 status = "okay";
295 pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
296 pinctrl-names = "default";
297 };
298
299 &sd_emmc_a {
300 status = "okay";
301 pinctrl-0 = <&sdio_pins>;
302 pinctrl-1 = <&sdio_clk_gate_pins>;
303 pinctrl-names = "default", "clk-gate";
304 #address-cells = <1>;
305 #size-cells = <0>;
306
307 bus-width = <4>;
308 cap-sd-highspeed;
309 max-frequency = <100000000>;
310
311 non-removable;
312 disable-wp;
313
314 /* WiFi firmware requires power to be kept while in suspend */
315 keep-power-in-suspend;
316
317 mmc-pwrseq = <&sdio_pwrseq>;
318
319 vmmc-supply = <&vddao_3v3>;
320 vqmmc-supply = <&vddio_boot>;
321
322 brcmf: wifi@1 {
323 reg = <1>;
324 compatible = "brcm,bcm4329-fmac";
325 };
326 };
327
328 /* SD card */
329 &sd_emmc_b {
330 status = "okay";
331 pinctrl-0 = <&sdcard_pins>;
332 pinctrl-1 = <&sdcard_clk_gate_pins>;
333 pinctrl-names = "default", "clk-gate";
334
335 bus-width = <4>;
336 cap-sd-highspeed;
337 max-frequency = <50000000>;
338 disable-wp;
339
340 cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
341
342 vmmc-supply = <&vddao_3v3>;
343 vqmmc-supply = <&vddio_boot>;
344 };
345
346 /* eMMC */
347 &sd_emmc_c {
348 status = "okay";
349 pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
350 pinctrl-1 = <&emmc_clk_gate_pins>;
351 pinctrl-names = "default", "clk-gate";
352
353 bus-width = <8>;
354 cap-mmc-highspeed;
355 max-frequency = <200000000>;
356 non-removable;
357 disable-wp;
358 mmc-ddr-1_8v;
359 mmc-hs200-1_8v;
360
361 mmc-pwrseq = <&emmc_pwrseq>;
362 vmmc-supply = <&vcc_3v3>;
363 vqmmc-supply = <&vddio_boot>;
364 };
365
366 /*
367 * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
368 * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
369 */
370 &spifc {
371 status = "disabled";
372 pinctrl-0 = <&nor_pins>;
373 pinctrl-names = "default";
374
375 w25q32: flash@0 {
376 #address-cells = <1>;
377 #size-cells = <1>;
378 compatible = "winbond,w25q16", "jedec,spi-nor";
379 reg = <0>;
380 spi-max-frequency = <104000000>;
381 };
382 };
383
384 /* This one is connected to the Bluetooth module */
385 &uart_A {
386 status = "okay";
387 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
388 pinctrl-names = "default";
389 uart-has-rtscts;
390
391 bluetooth {
392 compatible = "brcm,bcm43438-bt";
393 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
394 max-speed = <2000000>;
395 clocks = <&wifi32k>;
396 clock-names = "lpo";
397 };
398 };
399
400 /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
401 &uart_AO {
402 status = "okay";
403 pinctrl-0 = <&uart_ao_a_pins>;
404 pinctrl-names = "default";
405 };
406
407 /* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
408 &uart_AO_B {
409 status = "okay";
410 pinctrl-0 = <&uart_ao_b_pins>;
411 pinctrl-names = "default";
412 };
413
414 &saradc {
415 status = "okay";
416 vref-supply = <&vddio_ao18>;
417 };
418
419 &usb {
420 status = "okay";
421 dr_mode = "peripheral";
422 };