blob: 3cf4ecb6d52e3c1af37feff8377e64131df90102 [file] [log] [blame]
Andreas Färber5851dcb2019-10-09 16:03:54 +02001// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
6 */
7
8#include <dt-bindings/input/input.h>
Neil Armstrong425d9d52021-09-17 09:37:00 +02009#include <dt-bindings/leds/common.h>
Andreas Färber5851dcb2019-10-09 16:03:54 +020010#include <dt-bindings/gpio/meson-g12a-gpio.h>
Neil Armstrong7d7da1f2020-10-02 09:47:37 +020011#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
Andreas Färber5851dcb2019-10-09 16:03:54 +020012
13/ {
Andreas Färber5851dcb2019-10-09 16:03:54 +020014 aliases {
15 serial0 = &uart_AO;
16 ethernet0 = &ethmac;
Neil Armstrong425d9d52021-09-17 09:37:00 +020017 rtc0 = &rtc;
18 rtc1 = &vrtc;
Andreas Färber5851dcb2019-10-09 16:03:54 +020019 };
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
Christian Hewittde649e62020-04-24 02:58:30 +000046 led-white {
Neil Armstrong425d9d52021-09-17 09:37:00 +020047 color = <LED_COLOR_ID_WHITE>;
48 function = LED_FUNCTION_STATUS;
Neil Armstrong7d7da1f2020-10-02 09:47:37 +020049 gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
Andreas Färber5851dcb2019-10-09 16:03:54 +020050 linux,default-trigger = "heartbeat";
51 };
52
Christian Hewittde649e62020-04-24 02:58:30 +000053 led-red {
Neil Armstrong425d9d52021-09-17 09:37:00 +020054 color = <LED_COLOR_ID_RED>;
55 function = LED_FUNCTION_STATUS;
Neil Armstrong7d7da1f2020-10-02 09:47:37 +020056 gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
Andreas Färber5851dcb2019-10-09 16:03:54 +020057 };
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
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200170
171 sound {
172 compatible = "amlogic,axg-sound-card";
Neil Armstrong425d9d52021-09-17 09:37:00 +0200173 model = "KHADAS-VIM3";
174 audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200175 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",
Neil Armstrong425d9d52021-09-17 09:37:00 +0200178 "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";
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200184
185 assigned-clocks = <&clkc CLKID_MPLL2>,
186 <&clkc CLKID_MPLL0>,
187 <&clkc CLKID_MPLL1>;
188 assigned-clock-parents = <0>, <0>, <0>;
189 assigned-clock-rates = <294912000>,
190 <270950400>,
191 <393216000>;
192 status = "okay";
193
194 dai-link-0 {
195 sound-dai = <&frddr_a>;
196 };
197
198 dai-link-1 {
199 sound-dai = <&frddr_b>;
200 };
201
202 dai-link-2 {
203 sound-dai = <&frddr_c>;
204 };
205
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200206 dai-link-3 {
Neil Armstrong425d9d52021-09-17 09:37:00 +0200207 sound-dai = <&toddr_a>;
208 };
209
210 dai-link-4 {
211 sound-dai = <&toddr_b>;
212 };
213
214 dai-link-5 {
215 sound-dai = <&toddr_c>;
216 };
217
218 /* 8ch hdmi interface */
219 dai-link-6 {
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200220 sound-dai = <&tdmif_a>;
221 dai-format = "i2s";
222 dai-tdm-slot-tx-mask-0 = <1 1>;
223 dai-tdm-slot-tx-mask-1 = <1 1>;
224 dai-tdm-slot-tx-mask-2 = <1 1>;
225 dai-tdm-slot-tx-mask-3 = <1 1>;
226 mclk-fs = <256>;
227
228 codec {
229 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
230 };
231 };
232
233 /* hdmi glue */
Neil Armstrong425d9d52021-09-17 09:37:00 +0200234 dai-link-7 {
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200235 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
236
237 codec {
238 sound-dai = <&hdmi_tx>;
239 };
240 };
241 };
242
Andreas Färber5851dcb2019-10-09 16:03:54 +0200243 wifi32k: wifi32k {
244 compatible = "pwm-clock";
245 #clock-cells = <0>;
246 clock-frequency = <32768>;
247 pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
248 };
249};
250
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200251&arb {
252 status = "okay";
253};
254
255&clkc_audio {
256 status = "okay";
257};
258
Andreas Färber5851dcb2019-10-09 16:03:54 +0200259&cec_AO {
260 pinctrl-0 = <&cec_ao_a_h_pins>;
261 pinctrl-names = "default";
262 status = "disabled";
263 hdmi-phandle = <&hdmi_tx>;
264};
265
266&cecb_AO {
267 pinctrl-0 = <&cec_ao_b_h_pins>;
268 pinctrl-names = "default";
269 status = "okay";
270 hdmi-phandle = <&hdmi_tx>;
271};
272
Neil Armstrongfc85ec52020-09-21 09:34:12 +0200273&cpu_thermal {
274 trips {
275 cpu_active: cpu-active {
276 temperature = <80000>; /* millicelsius */
277 hysteresis = <2000>; /* millicelsius */
278 type = "active";
279 };
280 };
281
282 cooling-maps {
283 map {
284 trip = <&cpu_active>;
285 cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
286 };
287 };
288};
289
Andreas Färber5851dcb2019-10-09 16:03:54 +0200290&ext_mdio {
291 external_phy: ethernet-phy@0 {
292 /* Realtek RTL8211F (0x001cc916) */
293 reg = <0>;
294 max-speed = <1000>;
295
296 interrupt-parent = <&gpio_intc>;
297 /* MAC_INTR on GPIOZ_14 */
298 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
299 };
300};
301
302&ethmac {
Neil Armstrong425d9d52021-09-17 09:37:00 +0200303 pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
304 pinctrl-names = "default";
305 status = "okay";
306 phy-mode = "rgmii";
307 phy-handle = <&external_phy>;
308 amlogic,tx-delay-ns = <2>;
Andreas Färber5851dcb2019-10-09 16:03:54 +0200309};
310
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200311&frddr_a {
312 status = "okay";
313};
314
315&frddr_b {
316 status = "okay";
317};
318
319&frddr_c {
320 status = "okay";
321};
322
Andreas Färber5851dcb2019-10-09 16:03:54 +0200323&hdmi_tx {
324 status = "okay";
325 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
326 pinctrl-names = "default";
327 hdmi-supply = <&vcc_5v>;
328};
329
330&hdmi_tx_tmds_port {
331 hdmi_tx_tmds_out: endpoint {
332 remote-endpoint = <&hdmi_connector_in>;
333 };
334};
335
336&i2c_AO {
337 status = "okay";
338 pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
339 pinctrl-names = "default";
340
Neil Armstrongfc85ec52020-09-21 09:34:12 +0200341 khadas_mcu: system-controller@18 {
342 compatible = "khadas,mcu";
343 reg = <0x18>;
344 #cooling-cells = <2>;
345 };
346
Andreas Färber5851dcb2019-10-09 16:03:54 +0200347 gpio_expander: gpio-controller@20 {
348 compatible = "ti,tca6408";
349 reg = <0x20>;
350 vcc-supply = <&vcc_3v3>;
351 gpio-controller;
352 #gpio-cells = <2>;
353 };
354
Neil Armstrong425d9d52021-09-17 09:37:00 +0200355 rtc: rtc@51 {
Andreas Färber5851dcb2019-10-09 16:03:54 +0200356 compatible = "haoyu,hym8563";
357 reg = <0x51>;
358 #clock-cells = <0>;
359 };
360};
361
362&ir {
363 status = "okay";
364 pinctrl-0 = <&remote_input_ao_pins>;
365 pinctrl-names = "default";
366 linux,rc-map-name = "rc-khadas";
367};
368
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100369&pcie {
370 reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
371};
372
Andreas Färber5851dcb2019-10-09 16:03:54 +0200373&pwm_ef {
Neil Armstrong425d9d52021-09-17 09:37:00 +0200374 status = "okay";
375 pinctrl-0 = <&pwm_e_pins>;
376 pinctrl-names = "default";
Andreas Färber5851dcb2019-10-09 16:03:54 +0200377};
378
379&saradc {
380 status = "okay";
381 vref-supply = <&vddao_1v8>;
382};
383
384/* SDIO */
385&sd_emmc_a {
386 status = "okay";
387 pinctrl-0 = <&sdio_pins>;
388 pinctrl-1 = <&sdio_clk_gate_pins>;
389 pinctrl-names = "default", "clk-gate";
390 #address-cells = <1>;
391 #size-cells = <0>;
392
393 bus-width = <4>;
394 cap-sd-highspeed;
Andreas Färber5851dcb2019-10-09 16:03:54 +0200395 max-frequency = <100000000>;
396
397 non-removable;
398 disable-wp;
399
Jerome Brunetd34d5ef2020-03-05 12:12:38 +0100400 /* WiFi firmware requires power to be kept while in suspend */
401 keep-power-in-suspend;
402
Andreas Färber5851dcb2019-10-09 16:03:54 +0200403 mmc-pwrseq = <&sdio_pwrseq>;
404
405 vmmc-supply = <&vsys_3v3>;
406 vqmmc-supply = <&vddao_1v8>;
407
408 brcmf: wifi@1 {
409 reg = <1>;
410 compatible = "brcm,bcm4329-fmac";
411 };
412};
413
414/* SD card */
415&sd_emmc_b {
416 status = "okay";
417 pinctrl-0 = <&sdcard_c_pins>;
418 pinctrl-1 = <&sdcard_clk_gate_c_pins>;
419 pinctrl-names = "default", "clk-gate";
420
421 bus-width = <4>;
422 cap-sd-highspeed;
423 max-frequency = <50000000>;
424 disable-wp;
425
426 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
427 vmmc-supply = <&vsys_3v3>;
428 vqmmc-supply = <&vsys_3v3>;
429};
430
431/* eMMC */
432&sd_emmc_c {
433 status = "okay";
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200434 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
Andreas Färber5851dcb2019-10-09 16:03:54 +0200435 pinctrl-1 = <&emmc_clk_gate_pins>;
436 pinctrl-names = "default", "clk-gate";
437
438 bus-width = <8>;
439 cap-mmc-highspeed;
440 mmc-ddr-1_8v;
441 mmc-hs200-1_8v;
442 max-frequency = <200000000>;
443 disable-wp;
444
445 mmc-pwrseq = <&emmc_pwrseq>;
446 vmmc-supply = <&vcc_3v3>;
447 vqmmc-supply = <&emmc_1v8>;
448};
449
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200450/*
451 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
452 * and eMMC Data 4 to 7 pins.
453 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
454 * and change bus-width to 4 then spifc can be enabled.
455 */
456&spifc {
457 status = "disabled";
458 pinctrl-0 = <&nor_pins>;
459 pinctrl-names = "default";
460
Neil Armstrongfc85ec52020-09-21 09:34:12 +0200461 w25q128: spi-flash@0 {
Neil Armstrong2d18c8c2020-04-20 15:44:41 +0200462 #address-cells = <1>;
463 #size-cells = <1>;
464 compatible = "winbond,w25q128fw", "jedec,spi-nor";
465 reg = <0>;
466 spi-max-frequency = <104000000>;
467 };
468};
469
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200470&tdmif_a {
471 status = "okay";
472};
473
Neil Armstrong425d9d52021-09-17 09:37:00 +0200474&tdmin_a {
475 status = "okay";
476};
477
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200478&tdmout_a {
479 status = "okay";
480};
481
Neil Armstrong425d9d52021-09-17 09:37:00 +0200482&toddr_a {
483 status = "okay";
484};
485
486&toddr_b {
487 status = "okay";
488};
489
490&toddr_c {
491 status = "okay";
492};
493
Neil Armstrong7d7da1f2020-10-02 09:47:37 +0200494&tohdmitx {
495 status = "okay";
496};
497
Andreas Färber5851dcb2019-10-09 16:03:54 +0200498&uart_A {
499 status = "okay";
500 pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
501 pinctrl-names = "default";
502 uart-has-rtscts;
503
504 bluetooth {
505 compatible = "brcm,bcm43438-bt";
506 shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
507 max-speed = <2000000>;
508 clocks = <&wifi32k>;
509 clock-names = "lpo";
510 };
511};
512
513&uart_AO {
514 status = "okay";
515 pinctrl-0 = <&uart_ao_a_pins>;
516 pinctrl-names = "default";
517};
518
519&usb2_phy0 {
520 phy-supply = <&dc_in>;
521};
522
523&usb2_phy1 {
524 phy-supply = <&usb_pwr>;
525};
526
527&usb3_pcie_phy {
528 phy-supply = <&usb_pwr>;
529};
530
531&usb {
532 status = "okay";
533 dr_mode = "peripheral";
534};