Debian Codegraph @

arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi

raw
1 // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2 /*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <[email protected]>
5 * Copyright (c) 2019 Christian Hewitt <[email protected]>
6 */
7
8 #include <dt-bindings/input/input.h>
9 #include <dt-bindings/leds/common.h>
10 #include <dt-bindings/gpio/meson-g12a-gpio.h>
11 #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13 / {
14 aliases {
15 serial0 = &uart_AO;
16 ethernet0 = &ethmac;
17 rtc0 = &rtc;
18 rtc1 = &vrtc;
19 };
20
21 chosen {
22 stdout-path = "serial0:115200n8";
23 };
24
25 memory@0 {
26 device_type = "memory";
27 reg = <0x0 0x0 0x0 0x80000000>;
28 };
29
30 adc-keys {
31 compatible = "adc-keys";
32 io-channels = <&saradc 2>;
33 io-channel-names = "buttons";
34 keyup-threshold-microvolt = <1710000>;
35
36 button-function {
37 label = "Function";
38 linux,code = <KEY_FN>;
39 press-threshold-microvolt = <10000>;
40 };
41 };
42
43 leds {
44 compatible = "gpio-leds";
45
46 led-white {
47 color = <LED_COLOR_ID_WHITE>;
48 function = LED_FUNCTION_STATUS;
49 gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
50 linux,default-trigger = "heartbeat";
51 };
52
53 led-red {
54 color = <LED_COLOR_ID_RED>;
55 function = LED_FUNCTION_STATUS;
56 gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
57 };
58 };
59
60 emmc_pwrseq: emmc-pwrseq {
61 compatible = "mmc-pwrseq-emmc";
62 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
63 };
64
65 gpio-keys-polled {
66 compatible = "gpio-keys-polled";
67 poll-interval = <100>;
68
69 power-button {
70 label = "power";
71 linux,code = <KEY_POWER>;
72 gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
73 };
74 };
75
76 sdio_pwrseq: sdio-pwrseq {
77 compatible = "mmc-pwrseq-simple";
78 reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
79 clocks = <&wifi32k>;
80 clock-names = "ext_clock";
81 };
82
83 dc_in: regulator-dc-in {
84 compatible = "regulator-fixed";
85 regulator-name = "DC_IN";
86 regulator-min-microvolt = <5000000>;
87 regulator-max-microvolt = <5000000>;
88 regulator-always-on;
89 };
90
91 vcc_5v: regulator-vcc-5v {
92 compatible = "regulator-fixed";
93 regulator-name = "VCC_5V";
94 regulator-min-microvolt = <5000000>;
95 regulator-max-microvolt = <5000000>;
96 vin-supply = <&dc_in>;
97
98 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
99 enable-active-high;
100 };
101
102 vcc_1v8: regulator-vcc-1v8 {
103 compatible = "regulator-fixed";
104 regulator-name = "VCC_1V8";
105 regulator-min-microvolt = <1800000>;
106 regulator-max-microvolt = <1800000>;
107 vin-supply = <&vcc_3v3>;
108 regulator-always-on;
109 };
110
111 vcc_3v3: regulator-vcc-3v3 {
112 compatible = "regulator-fixed";
113 regulator-name = "VCC_3V3";
114 regulator-min-microvolt = <3300000>;
115 regulator-max-microvolt = <3300000>;
116 vin-supply = <&vsys_3v3>;
117 regulator-always-on;
118 /* FIXME: actually controlled by VDDCPU_B_EN */
119 };
120
121 vddao_1v8: regulator-vddao-1v8 {
122 compatible = "regulator-fixed";
123 regulator-name = "VDDIO_AO1V8";
124 regulator-min-microvolt = <1800000>;
125 regulator-max-microvolt = <1800000>;
126 vin-supply = <&vsys_3v3>;
127 regulator-always-on;
128 };
129
130 emmc_1v8: regulator-emmc-1v8 {
131 compatible = "regulator-fixed";
132 regulator-name = "EMMC_AO1V8";
133 regulator-min-microvolt = <1800000>;
134 regulator-max-microvolt = <1800000>;
135 vin-supply = <&vcc_3v3>;
136 regulator-always-on;
137 };
138
139 vsys_3v3: regulator-vsys-3v3 {
140 compatible = "regulator-fixed";
141 regulator-name = "VSYS_3V3";
142 regulator-min-microvolt = <3300000>;
143 regulator-max-microvolt = <3300000>;
144 vin-supply = <&dc_in>;
145 regulator-always-on;
146 };
147
148 usb_pwr: regulator-usb-pwr {
149 compatible = "regulator-fixed";
150 regulator-name = "USB_PWR";
151 regulator-min-microvolt = <5000000>;
152 regulator-max-microvolt = <5000000>;
153 vin-supply = <&vcc_5v>;
154
155 gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
156 enable-active-high;
157 };
158
159 hdmi-connector {
160 compatible = "hdmi-connector";
161 type = "a";
162
163 port {
164 hdmi_connector_in: endpoint {
165 remote-endpoint = <&hdmi_tx_tmds_out>;
166 };
167 };
168 };
169
170
171 sound {
172 compatible = "amlogic,axg-sound-card";
173 model = "KHADAS-VIM3";
174 audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
175 audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
176 "TDMOUT_A IN 1", "FRDDR_B OUT 0",
177 "TDMOUT_A IN 2", "FRDDR_C OUT 0",
178 "TDM_A Playback", "TDMOUT_A OUT",
179 "TDMIN_A IN 0", "TDM_A Capture",
180 "TDMIN_A IN 3", "TDM_A Loopback",
181 "TODDR_A IN 0", "TDMIN_A OUT",
182 "TODDR_B IN 0", "TDMIN_A OUT",
183 "TODDR_C IN 0", "TDMIN_A OUT";
184
185 clocks = <&clkc CLKID_MPLL2>,
186 <&clkc CLKID_MPLL0>,
187 <&clkc CLKID_MPLL1>;
188
189 assigned-clocks = <&clkc CLKID_MPLL2>,
190 <&clkc CLKID_MPLL0>,
191 <&clkc CLKID_MPLL1>;
192 assigned-clock-rates = <294912000>,
193 <270950400>,
194 <393216000>;
195
196 dai-link-0 {
197 sound-dai = <&frddr_a>;
198 };
199
200 dai-link-1 {
201 sound-dai = <&frddr_b>;
202 };
203
204 dai-link-2 {
205 sound-dai = <&frddr_c>;
206 };
207
208 dai-link-3 {
209 sound-dai = <&toddr_a>;
210 };
211
212 dai-link-4 {
213 sound-dai = <&toddr_b>;
214 };
215
216 dai-link-5 {
217 sound-dai = <&toddr_c>;
218 };
219
220 /* 8ch hdmi interface */
221 dai-link-6 {
222 sound-dai = <&tdmif_a>;
223 dai-format = "i2s";
224 dai-tdm-slot-tx-mask-0 = <1 1>;
225 dai-tdm-slot-tx-mask-1 = <1 1>;
226 dai-tdm-slot-tx-mask-2 = <1 1>;
227 dai-tdm-slot-tx-mask-3 = <1 1>;
228 mclk-fs = <256>;
229
230 codec {
231 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
232 };
233 };
234
235 /* hdmi glue */
236 dai-link-7 {
237 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
238
239 codec {
240 sound-dai = <&hdmi_tx>;
241 };
242 };
243 };
244
245 wifi32k: wifi32k {
246 compatible = "pwm-clock";
247 #clock-cells = <0>;
248 clock-frequency = <32768>;
249 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
250 };
251 };
252
253 &arb {
254 status = "okay";
255 };
256
257 &clkc_audio {
258 status = "okay";
259 };
260
261 &cec_AO {
262 pinctrl-0 = <&cec_ao_a_h_pins>;
263 pinctrl-names = "default";
264 status = "disabled";
265 hdmi-phandle = <&hdmi_tx>;
266 };
267
268 &cecb_AO {
269 pinctrl-0 = <&cec_ao_b_h_pins>;
270 pinctrl-names = "default";
271 status = "okay";
272 hdmi-phandle = <&hdmi_tx>;
273 };
274
275 &cpu_thermal {
276 trips {
277 cpu_active: cpu-active {
278 temperature = <80000>; /* millicelsius */
279 hysteresis = <2000>; /* millicelsius */
280 type = "active";
281 };
282 };
283
284 cooling-maps {
285 map {
286 trip = <&cpu_active>;
287 cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
288 };
289 };
290 };
291
292 &ext_mdio {
293 external_phy: ethernet-phy@0 {
294 /* Realtek RTL8211F (0x001cc916) */
295 reg = <0>;
296 max-speed = <1000>;
297
298 interrupt-parent = <&gpio_intc>;
299 /* MAC_INTR on GPIOZ_14 */
300 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
301 };
302 };
303
304 &ethmac {
305 pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
306 pinctrl-names = "default";
307 status = "okay";
308 phy-mode = "rgmii";
309 phy-handle = <&external_phy>;
310 amlogic,tx-delay-ns = <2>;
311 };
312
313 &frddr_a {
314 status = "okay";
315 };
316
317 &frddr_b {
318 status = "okay";
319 };
320
321 &frddr_c {
322 status = "okay";
323 };
324
325 &hdmi_tx {
326 status = "okay";
327 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
328 pinctrl-names = "default";
329 hdmi-supply = <&vcc_5v>;
330 };
331
332 &hdmi_tx_tmds_port {
333 hdmi_tx_tmds_out: endpoint {
334 remote-endpoint = <&hdmi_connector_in>;
335 };
336 };
337
338 &i2c_AO {
339 status = "okay";
340 pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
341 pinctrl-names = "default";
342
343 khadas_mcu: system-controller@18 {
344 compatible = "khadas,mcu";
345 reg = <0x18>;
346 #cooling-cells = <2>;
347 };
348
349 gpio_expander: gpio-controller@20 {
350 compatible = "ti,tca6408";
351 reg = <0x20>;
352 vcc-supply = <&vcc_3v3>;
353 gpio-controller;
354 #gpio-cells = <2>;
355 };
356
357 rtc: rtc@51 {
358 compatible = "haoyu,hym8563";
359 reg = <0x51>;
360 #clock-cells = <0>;
361 };
362 };
363
364 &ir {
365 status = "okay";
366 pinctrl-0 = <&remote_input_ao_pins>;
367 pinctrl-names = "default";
368 linux,rc-map-name = "rc-khadas";
369 };
370
371 &pcie {
372 reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
373 };
374
375 &pwm_ef {
376 status = "okay";
377 pinctrl-0 = <&pwm_e_pins>;
378 pinctrl-names = "default";
379 };
380
381 &saradc {
382 status = "okay";
383 vref-supply = <&vddao_1v8>;
384 };
385
386 /* SDIO */
387 &sd_emmc_a {
388 status = "okay";
389 pinctrl-0 = <&sdio_pins>;
390 pinctrl-1 = <&sdio_clk_gate_pins>;
391 pinctrl-names = "default", "clk-gate";
392 #address-cells = <1>;
393 #size-cells = <0>;
394
395 bus-width = <4>;
396 cap-sd-highspeed;
397 max-frequency = <100000000>;
398
399 non-removable;
400 disable-wp;
401
402 /* WiFi firmware requires power to be kept while in suspend */
403 keep-power-in-suspend;
404
405 mmc-pwrseq = <&sdio_pwrseq>;
406
407 vmmc-supply = <&vsys_3v3>;
408 vqmmc-supply = <&vddao_1v8>;
409
410 brcmf: wifi@1 {
411 reg = <1>;
412 compatible = "brcm,bcm4329-fmac";
413 };
414 };
415
416 /* SD card */
417 &sd_emmc_b {
418 status = "okay";
419 pinctrl-0 = <&sdcard_c_pins>;
420 pinctrl-1 = <&sdcard_clk_gate_c_pins>;
421 pinctrl-names = "default", "clk-gate";
422
423 bus-width = <4>;
424 cap-sd-highspeed;
425 max-frequency = <50000000>;
426 disable-wp;
427
428 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
429 vmmc-supply = <&vsys_3v3>;
430 vqmmc-supply = <&vsys_3v3>;
431 };
432
433 /* eMMC */
434 &sd_emmc_c {
435 status = "okay";
436 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
437 pinctrl-1 = <&emmc_clk_gate_pins>;
438 pinctrl-names = "default", "clk-gate";
439
440 bus-width = <8>;
441 cap-mmc-highspeed;
442 mmc-ddr-1_8v;
443 mmc-hs200-1_8v;
444 max-frequency = <200000000>;
445 disable-wp;
446
447 mmc-pwrseq = <&emmc_pwrseq>;
448 vmmc-supply = <&vcc_3v3>;
449 vqmmc-supply = <&emmc_1v8>;
450 };
451
452 /*
453 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
454 * and eMMC Data 4 to 7 pins.
455 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
456 * and change bus-width to 4 then spifc can be enabled.
457 */
458 &spifc {
459 status = "disabled";
460 pinctrl-0 = <&nor_pins>;
461 pinctrl-names = "default";
462
463 w25q128: flash@0 {
464 #address-cells = <1>;
465 #size-cells = <1>;
466 compatible = "winbond,w25q128fw", "jedec,spi-nor";
467 reg = <0>;
468 spi-max-frequency = <104000000>;
469 };
470 };
471
472 &tdmif_a {
473 status = "okay";
474 };
475
476 &tdmin_a {
477 status = "okay";
478 };
479
480 &tdmout_a {
481 status = "okay";
482 };
483
484 &toddr_a {
485 status = "okay";
486 };
487
488 &toddr_b {
489 status = "okay";
490 };
491
492 &toddr_c {
493 status = "okay";
494 };
495
496 &tohdmitx {
497 status = "okay";
498 };
499
500 &uart_A {
501 status = "okay";
502 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
503 pinctrl-names = "default";
504 uart-has-rtscts;
505
506 bluetooth {
507 compatible = "brcm,bcm43438-bt";
508 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
509 max-speed = <2000000>;
510 clocks = <&wifi32k>;
511 clock-names = "lpo";
512 };
513 };
514
515 &uart_AO {
516 status = "okay";
517 pinctrl-0 = <&uart_ao_a_pins>;
518 pinctrl-names = "default";
519 };
520
521 &usb2_phy0 {
522 phy-supply = <&dc_in>;
523 };
524
525 &usb2_phy1 {
526 phy-supply = <&usb_pwr>;
527 };
528
529 &usb3_pcie_phy {
530 phy-supply = <&usb_pwr>;
531 };
532
533 &usb {
534 status = "okay";
535 dr_mode = "peripheral";
536 };