blob: 212c6aa5a3b86a59154146e19df813feb11e07fa [file] [log] [blame]
Neil Armstrong976e9202021-05-14 16:32:55 +02001// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2021 BayLibre SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 */
6
7/dts-v1/;
8
9#include "meson-sm1.dtsi"
10#include <dt-bindings/leds/common.h>
11#include <dt-bindings/input/linux-event-codes.h>
12#include <dt-bindings/gpio/meson-g12a-gpio.h>
13#include <dt-bindings/sound/meson-g12a-toacodec.h>
14#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
15
16/ {
17 compatible = "bananapi,bpi-m5", "amlogic,sm1";
18 model = "Banana Pi BPI-M5";
19
20 adc_keys {
21 compatible = "adc-keys";
22 io-channels = <&saradc 2>;
23 io-channel-names = "buttons";
24 keyup-threshold-microvolt = <1800000>;
25
26 key {
27 label = "SW3";
28 linux,code = <BTN_3>;
29 press-threshold-microvolt = <1700000>;
30 };
31 };
32
33 aliases {
34 serial0 = &uart_AO;
35 ethernet0 = &ethmac;
36 };
37
38 chosen {
39 stdout-path = "serial0:115200n8";
40 };
41
42 /* TOFIX: handle CVBS_DET on SARADC channel 0 */
43 cvbs-connector {
44 compatible = "composite-video-connector";
45
46 port {
47 cvbs_connector_in: endpoint {
48 remote-endpoint = <&cvbs_vdac_out>;
49 };
50 };
51 };
52
53 emmc_pwrseq: emmc-pwrseq {
54 compatible = "mmc-pwrseq-emmc";
55 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
56 };
57
58 gpio-keys {
59 compatible = "gpio-keys";
60
61 key {
62 label = "SW1";
63 linux,code = <BTN_1>;
64 gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_LOW>;
65 interrupt-parent = <&gpio_intc>;
66 interrupts = <3 IRQ_TYPE_EDGE_BOTH>;
67 };
68 };
69
70 hdmi-connector {
71 compatible = "hdmi-connector";
72 type = "a";
73
74 port {
75 hdmi_connector_in: endpoint {
76 remote-endpoint = <&hdmi_tx_tmds_out>;
77 };
78 };
79 };
80
81 leds {
82 compatible = "gpio-leds";
83
84 green {
85 color = <LED_COLOR_ID_GREEN>;
86 function = LED_FUNCTION_STATUS;
87 gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
88 };
89
90 blue {
91 color = <LED_COLOR_ID_BLUE>;
92 function = LED_FUNCTION_STATUS;
93 gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_LOW>;
94 linux,default-trigger = "heartbeat";
95 };
96 };
97
98 memory@0 {
99 device_type = "memory";
100 reg = <0x0 0x0 0x0 0x40000000>;
101 };
102
103 emmc_1v8: regulator-emmc_1v8 {
104 compatible = "regulator-fixed";
105 regulator-name = "EMMC_1V8";
106 regulator-min-microvolt = <1800000>;
107 regulator-max-microvolt = <1800000>;
108 vin-supply = <&vddao_3v3>;
109 regulator-always-on;
110 };
111
112 dc_in: regulator-dc_in {
113 compatible = "regulator-fixed";
114 regulator-name = "DC_IN";
115 regulator-min-microvolt = <5000000>;
116 regulator-max-microvolt = <5000000>;
117 regulator-always-on;
118 };
119
120 vddio_c: regulator-vddio_c {
121 compatible = "regulator-gpio";
122 regulator-name = "VDDIO_C";
123 regulator-min-microvolt = <1800000>;
124 regulator-max-microvolt = <3300000>;
125
126 enable-gpio = <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>;
127 enable-active-high;
128 regulator-always-on;
129
130 gpios = <&gpio_ao GPIOAO_6 GPIO_OPEN_DRAIN>;
131 gpios-states = <1>;
132
133 states = <1800000 0>,
134 <3300000 1>;
135 };
136
137 tflash_vdd: regulator-tflash_vdd {
138 compatible = "regulator-fixed";
139 regulator-name = "TFLASH_VDD";
140 regulator-min-microvolt = <3300000>;
141 regulator-max-microvolt = <3300000>;
142 vin-supply = <&dc_in>;
143 gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
144 enable-active-high;
145 regulator-always-on;
146 };
147
148 vddao_1v8: regulator-vddao_1v8 {
149 compatible = "regulator-fixed";
150 regulator-name = "VDDAO_1V8";
151 regulator-min-microvolt = <1800000>;
152 regulator-max-microvolt = <1800000>;
153 vin-supply = <&vddao_3v3>;
154 regulator-always-on;
155 };
156
157 vddao_3v3: regulator-vddao_3v3 {
158 compatible = "regulator-fixed";
159 regulator-name = "VDDAO_3V3";
160 regulator-min-microvolt = <3300000>;
161 regulator-max-microvolt = <3300000>;
162 vin-supply = <&dc_in>;
163 regulator-always-on;
164 };
165
166 vddcpu: regulator-vddcpu {
167 /*
168 * SY8120B1ABC DC/DC Regulator.
169 */
170 compatible = "pwm-regulator";
171
172 regulator-name = "VDDCPU";
173 regulator-min-microvolt = <690000>;
174 regulator-max-microvolt = <1050000>;
175
Anand Moon0b26fa82021-09-19 20:29:11 +0000176 pwm-supply = <&dc_in>;
Neil Armstrong976e9202021-05-14 16:32:55 +0200177
178 pwms = <&pwm_AO_cd 1 1250 0>;
179 pwm-dutycycle-range = <100 0>;
180
181 regulator-boot-on;
182 regulator-always-on;
183 };
184
185 /* USB Hub Power Enable */
186 vl_pwr_en: regulator-vl_pwr_en {
187 compatible = "regulator-fixed";
188 regulator-name = "VL_PWR_EN";
189 regulator-min-microvolt = <5000000>;
190 regulator-max-microvolt = <5000000>;
191 vin-supply = <&dc_in>;
192
193 gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
194 enable-active-high;
195 };
196
197 sound {
198 compatible = "amlogic,axg-sound-card";
199 model = "BPI-M5";
200 audio-widgets = "Line", "Lineout";
201 audio-aux-devs = <&tdmout_b>, <&tdmout_c>,
202 <&tdmin_a>, <&tdmin_b>, <&tdmin_c>;
203 audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
204 "TDMOUT_B IN 1", "FRDDR_B OUT 1",
205 "TDMOUT_B IN 2", "FRDDR_C OUT 1",
206 "TDM_B Playback", "TDMOUT_B OUT",
207 "TDMOUT_C IN 0", "FRDDR_A OUT 2",
208 "TDMOUT_C IN 1", "FRDDR_B OUT 2",
209 "TDMOUT_C IN 2", "FRDDR_C OUT 2",
210 "TDM_C Playback", "TDMOUT_C OUT",
211 "TDMIN_A IN 4", "TDM_B Loopback",
212 "TDMIN_B IN 4", "TDM_B Loopback",
213 "TDMIN_C IN 4", "TDM_B Loopback",
214 "TDMIN_A IN 5", "TDM_C Loopback",
215 "TDMIN_B IN 5", "TDM_C Loopback",
216 "TDMIN_C IN 5", "TDM_C Loopback",
217 "TODDR_A IN 0", "TDMIN_A OUT",
218 "TODDR_B IN 0", "TDMIN_A OUT",
219 "TODDR_C IN 0", "TDMIN_A OUT",
220 "TODDR_A IN 1", "TDMIN_B OUT",
221 "TODDR_B IN 1", "TDMIN_B OUT",
222 "TODDR_C IN 1", "TDMIN_B OUT",
223 "TODDR_A IN 2", "TDMIN_C OUT",
224 "TODDR_B IN 2", "TDMIN_C OUT",
225 "TODDR_C IN 2", "TDMIN_C OUT",
226 "Lineout", "ACODEC LOLP",
227 "Lineout", "ACODEC LORP";
228
229 assigned-clocks = <&clkc CLKID_MPLL2>,
230 <&clkc CLKID_MPLL0>,
231 <&clkc CLKID_MPLL1>;
232 assigned-clock-parents = <0>, <0>, <0>;
233 assigned-clock-rates = <294912000>,
234 <270950400>,
235 <393216000>;
236 status = "okay";
237
238 dai-link-0 {
239 sound-dai = <&frddr_a>;
240 };
241
242 dai-link-1 {
243 sound-dai = <&frddr_b>;
244 };
245
246 dai-link-2 {
247 sound-dai = <&frddr_c>;
248 };
249
250 dai-link-3 {
251 sound-dai = <&toddr_a>;
252 };
253
254 dai-link-4 {
255 sound-dai = <&toddr_b>;
256 };
257
258 dai-link-5 {
259 sound-dai = <&toddr_c>;
260 };
261
262 /* 8ch hdmi interface */
263 dai-link-6 {
264 sound-dai = <&tdmif_b>;
265 dai-format = "i2s";
266 dai-tdm-slot-tx-mask-0 = <1 1>;
267 dai-tdm-slot-tx-mask-1 = <1 1>;
268 dai-tdm-slot-tx-mask-2 = <1 1>;
269 dai-tdm-slot-tx-mask-3 = <1 1>;
270 mclk-fs = <256>;
271
272 codec-0 {
273 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
274 };
275
276 codec-1 {
277 sound-dai = <&toacodec TOACODEC_IN_B>;
278 };
279 };
280
281 /* i2s jack output interface */
282 dai-link-7 {
283 sound-dai = <&tdmif_c>;
284 dai-format = "i2s";
285 dai-tdm-slot-tx-mask-0 = <1 1>;
286 mclk-fs = <256>;
287
288 codec-0 {
289 sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
290 };
291
292 codec-1 {
293 sound-dai = <&toacodec TOACODEC_IN_C>;
294 };
295 };
296
297 /* hdmi glue */
298 dai-link-8 {
299 sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
300
301 codec {
302 sound-dai = <&hdmi_tx>;
303 };
304 };
305
306 /* acodec glue */
307 dai-link-9 {
308 sound-dai = <&toacodec TOACODEC_OUT>;
309
310 codec {
311 sound-dai = <&acodec>;
312 };
313 };
314 };
315};
316
317&acodec {
318 AVDD-supply = <&vddao_1v8>;
319 status = "okay";
320};
321
322&arb {
323 status = "okay";
324};
325
326&clkc_audio {
327 status = "okay";
328};
329
330&cpu0 {
331 cpu-supply = <&vddcpu>;
332 operating-points-v2 = <&cpu_opp_table>;
333 clocks = <&clkc CLKID_CPU_CLK>;
334 clock-latency = <50000>;
335};
336
337&cpu1 {
338 cpu-supply = <&vddcpu>;
339 operating-points-v2 = <&cpu_opp_table>;
340 clocks = <&clkc CLKID_CPU1_CLK>;
341 clock-latency = <50000>;
342};
343
344&cpu2 {
345 cpu-supply = <&vddcpu>;
346 operating-points-v2 = <&cpu_opp_table>;
347 clocks = <&clkc CLKID_CPU2_CLK>;
348 clock-latency = <50000>;
349};
350
351&cpu3 {
352 cpu-supply = <&vddcpu>;
353 operating-points-v2 = <&cpu_opp_table>;
354 clocks = <&clkc CLKID_CPU3_CLK>;
355 clock-latency = <50000>;
356};
357
358&cvbs_vdac_port {
359 cvbs_vdac_out: endpoint {
360 remote-endpoint = <&cvbs_connector_in>;
361 };
362};
363
364&ext_mdio {
365 external_phy: ethernet-phy@0 {
366 /* Realtek RTL8211F (0x001cc916) */
367 reg = <0>;
368 max-speed = <1000>;
369
370 interrupt-parent = <&gpio_intc>;
371 /* MAC_INTR on GPIOZ_14 */
372 interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
373 };
374};
375
376&ethmac {
377 pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
378 pinctrl-names = "default";
379 status = "okay";
380 phy-mode = "rgmii-txid";
381 phy-handle = <&external_phy>;
382};
383
384&frddr_a {
385 status = "okay";
386};
387
388&frddr_b {
389 status = "okay";
390};
391
392&frddr_c {
393 status = "okay";
394};
395
396&gpio {
397 gpio-line-names =
398 /* GPIOZ */
399 "ETH_MDIO", /* GPIOZ_0 */
400 "ETH_MDC", /* GPIOZ_1 */
401 "ETH_RXCLK", /* GPIOZ_2 */
402 "ETH_RX_DV", /* GPIOZ_3 */
403 "ETH_RXD0", /* GPIOZ_4 */
404 "ETH_RXD1", /* GPIOZ_5 */
405 "ETH_RXD2", /* GPIOZ_6 */
406 "ETH_RXD3", /* GPIOZ_7 */
407 "ETH_TXCLK", /* GPIOZ_8 */
408 "ETH_TXEN", /* GPIOZ_9 */
409 "ETH_TXD0", /* GPIOZ_10 */
410 "ETH_TXD1", /* GPIOZ_11 */
411 "ETH_TXD2", /* GPIOZ_12 */
412 "ETH_TXD3", /* GPIOZ_13 */
413 "ETH_INTR", /* GPIOZ_14 */
414 "ETH_NRST", /* GPIOZ_15 */
415 /* GPIOH */
416 "HDMI_SDA", /* GPIOH_0 */
417 "HDMI_SCL", /* GPIOH_1 */
418 "HDMI_HPD", /* GPIOH_2 */
419 "HDMI_CEC", /* GPIOH_3 */
420 "VL-RST_N", /* GPIOH_4 */
421 "CON1-P36", /* GPIOH_5 */
422 "VL-PWREN", /* GPIOH_6 */
423 "WiFi_3V3_1V8", /* GPIOH_7 */
424 "TFLASH_VDD_EN", /* GPIOH_8 */
425 /* BOOT */
426 "eMMC_D0", /* BOOT_0 */
427 "eMMC_D1", /* BOOT_1 */
428 "eMMC_D2", /* BOOT_2 */
429 "eMMC_D3", /* BOOT_3 */
430 "eMMC_D4", /* BOOT_4 */
431 "eMMC_D5", /* BOOT_5 */
432 "eMMC_D6", /* BOOT_6 */
433 "eMMC_D7", /* BOOT_7 */
434 "eMMC_CLK", /* BOOT_8 */
435 "",
436 "eMMC_CMD", /* BOOT_10 */
437 "",
438 "eMMC_RST#", /* BOOT_12 */
439 "eMMC_DS", /* BOOT_13 */
440 /* GPIOC */
441 "SD_D0_B", /* GPIOC_0 */
442 "SD_D1_B", /* GPIOC_1 */
443 "SD_D2_B", /* GPIOC_2 */
444 "SD_D3_B", /* GPIOC_3 */
445 "SD_CLK_B", /* GPIOC_4 */
446 "SD_CMD_B", /* GPIOC_5 */
447 "CARD_EN_DET", /* GPIOC_6 */
448 "",
449 /* GPIOA */
450 "", "", "", "", "", "", "", "",
451 "", "", "", "", "", "",
452 "CON1-P27", /* GPIOA_14 */
453 "CON1-P28", /* GPIOA_15 */
454 /* GPIOX */
455 "CON1-P16", /* GPIOX_0 */
456 "CON1-P18", /* GPIOX_1 */
457 "CON1-P22", /* GPIOX_2 */
458 "CON1-P11", /* GPIOX_3 */
459 "CON1-P13", /* GPIOX_4 */
460 "CON1-P07", /* GPIOX_5 */
461 "CON1-P33", /* GPIOX_6 */
462 "CON1-P15", /* GPIOX_7 */
463 "CON1-P19", /* GPIOX_8 */
464 "CON1-P21", /* GPIOX_9 */
465 "CON1-P24", /* GPIOX_10 */
466 "CON1-P23", /* GPIOX_11 */
467 "CON1-P08", /* GPIOX_12 */
468 "CON1-P10", /* GPIOX_13 */
469 "CON1-P29", /* GPIOX_14 */
470 "CON1-P31", /* GPIOX_15 */
471 "CON1-P26", /* GPIOX_16 */
472 "CON1-P03", /* GPIOX_17 */
473 "CON1-P05", /* GPIOX_18 */
474 "CON1-P32"; /* GPIOX_19 */
475
476 /*
477 * WARNING: The USB Hub on the BPI-M5 needs a reset signal
478 * to be turned high in order to be detected by the USB Controller
479 * This signal should be handled by a USB specific power sequence
480 * in order to reset the Hub when USB bus is powered down.
481 */
482 usb-hub {
483 gpio-hog;
484 gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
485 output-high;
486 line-name = "usb-hub-reset";
487 };
488};
489
490&gpio_ao {
491 gpio-line-names =
492 /* GPIOAO */
493 "DEBUG TX", /* GPIOAO_0 */
494 "DEBUG RX", /* GPIOAO_1 */
495 "SYS_LED2", /* GPIOAO_2 */
496 "UPDATE_KEY", /* GPIOAO_3 */
497 "CON1-P40", /* GPIOAO_4 */
498 "IR_IN", /* GPIOAO_5 */
499 "TF_3V3N_1V8_EN", /* GPIOAO_6 */
500 "CON1-P35", /* GPIOAO_7 */
501 "CON1-P12", /* GPIOAO_8 */
502 "CON1-P37", /* GPIOAO_9 */
503 "CON1-P38", /* GPIOAO_10 */
504 "SYS_LED", /* GPIOAO_11 */
505 /* GPIOE */
506 "VDDEE_PWM", /* GPIOE_0 */
507 "VDDCPU_PWM", /* GPIOE_1 */
508 "TF_PWR_EN"; /* GPIOE_2 */
509};
510
511&hdmi_tx {
512 status = "okay";
513 pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
514 pinctrl-names = "default";
515 hdmi-supply = <&dc_in>;
516};
517
518&hdmi_tx_tmds_port {
519 hdmi_tx_tmds_out: endpoint {
520 remote-endpoint = <&hdmi_connector_in>;
521 };
522};
523
524&ir {
525 status = "okay";
526 pinctrl-0 = <&remote_input_ao_pins>;
527 pinctrl-names = "default";
528};
529
530&pwm_AO_cd {
531 pinctrl-0 = <&pwm_ao_d_e_pins>;
532 pinctrl-names = "default";
533 clocks = <&xtal>;
534 clock-names = "clkin1";
535 status = "okay";
536};
537
538&saradc {
539 status = "okay";
540 vref-supply = <&vddao_1v8>;
541};
542
543/* SD card */
544&sd_emmc_b {
545 status = "okay";
546 pinctrl-0 = <&sdcard_c_pins>;
547 pinctrl-1 = <&sdcard_clk_gate_c_pins>;
548 pinctrl-names = "default", "clk-gate";
549
550 bus-width = <4>;
551 cap-sd-highspeed;
552 max-frequency = <50000000>;
553 disable-wp;
554
555 /* TOFIX: SD card is barely usable in SDR modes */
556
557 cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
558 vmmc-supply = <&tflash_vdd>;
559 vqmmc-supply = <&vddio_c>;
560};
561
562/* eMMC */
563&sd_emmc_c {
564 status = "okay";
565 pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
566 pinctrl-1 = <&emmc_clk_gate_pins>;
567 pinctrl-names = "default", "clk-gate";
568
569 bus-width = <8>;
570 cap-mmc-highspeed;
571 mmc-ddr-1_8v;
572 mmc-hs200-1_8v;
573 max-frequency = <200000000>;
574 disable-wp;
575
576 mmc-pwrseq = <&emmc_pwrseq>;
577 vmmc-supply = <&vddao_3v3>;
578 vqmmc-supply = <&emmc_1v8>;
579};
580
581&tdmif_b {
582 status = "okay";
583};
584
585&tdmif_c {
586 status = "okay";
587};
588
589&tdmin_a {
590 status = "okay";
591};
592
593&tdmin_b {
594 status = "okay";
595};
596
597&tdmin_c {
598 status = "okay";
599};
600
601&tdmout_b {
602 status = "okay";
603};
604
605&tdmout_c {
606 status = "okay";
607};
608
609&toacodec {
610 status = "okay";
611};
612
613&tohdmitx {
614 status = "okay";
615};
616
617&toddr_a {
618 status = "okay";
619};
620
621&toddr_b {
622 status = "okay";
623};
624
625&toddr_c {
626 status = "okay";
627};
628
629&uart_AO {
630 status = "okay";
631 pinctrl-0 = <&uart_ao_a_pins>;
632 pinctrl-names = "default";
633};
634
635&usb {
636 status = "okay";
637};
638
639&usb2_phy0 {
640 phy-supply = <&dc_in>;
641};
642
643&usb2_phy1 {
644 /* Enable the hub which is connected to this port */
645 phy-supply = <&vl_pwr_en>;
646};