xref: /freebsd/sys/contrib/device-tree/src/arm64/amlogic/meson-sm1-bananapi-m5.dts (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1// 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_ao 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
176		pwm-supply = <&dc_in>;
177
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		"", "",
441		/* GPIOC */
442		"SD_D0_B", /* GPIOC_0 */
443		"SD_D1_B", /* GPIOC_1 */
444		"SD_D2_B", /* GPIOC_2 */
445		"SD_D3_B", /* GPIOC_3 */
446		"SD_CLK_B", /* GPIOC_4 */
447		"SD_CMD_B", /* GPIOC_5 */
448		"CARD_EN_DET", /* GPIOC_6 */
449		"",
450		/* GPIOA */
451		"", "", "", "", "", "", "", "",
452		"", "", "", "", "", "",
453		"CON1-P27", /* GPIOA_14 */
454		"CON1-P28", /* GPIOA_15 */
455		/* GPIOX */
456		"CON1-P16", /* GPIOX_0 */
457		"CON1-P18", /* GPIOX_1 */
458		"CON1-P22", /* GPIOX_2 */
459		"CON1-P11", /* GPIOX_3 */
460		"CON1-P13", /* GPIOX_4 */
461		"CON1-P07", /* GPIOX_5 */
462		"CON1-P33", /* GPIOX_6 */
463		"CON1-P15", /* GPIOX_7 */
464		"CON1-P19", /* GPIOX_8 */
465		"CON1-P21", /* GPIOX_9 */
466		"CON1-P24", /* GPIOX_10 */
467		"CON1-P23", /* GPIOX_11 */
468		"CON1-P08", /* GPIOX_12 */
469		"CON1-P10", /* GPIOX_13 */
470		"CON1-P29", /* GPIOX_14 */
471		"CON1-P31", /* GPIOX_15 */
472		"CON1-P26", /* GPIOX_16 */
473		"CON1-P03", /* GPIOX_17 */
474		"CON1-P05", /* GPIOX_18 */
475		"CON1-P32"; /* GPIOX_19 */
476
477	/*
478	 * WARNING: The USB Hub on the BPI-M5 needs a reset signal
479	 * to be turned high in order to be detected by the USB Controller
480	 * This signal should be handled by a USB specific power sequence
481	 * in order to reset the Hub when USB bus is powered down.
482	 */
483	usb-hub {
484		gpio-hog;
485		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
486		output-high;
487		line-name = "usb-hub-reset";
488	};
489};
490
491&gpio_ao {
492	gpio-line-names =
493		/* GPIOAO */
494		"DEBUG TX", /* GPIOAO_0 */
495		"DEBUG RX", /* GPIOAO_1 */
496		"SYS_LED2", /* GPIOAO_2 */
497		"UPDATE_KEY", /* GPIOAO_3 */
498		"CON1-P40", /* GPIOAO_4 */
499		"IR_IN", /* GPIOAO_5 */
500		"TF_3V3N_1V8_EN", /* GPIOAO_6 */
501		"CON1-P35", /* GPIOAO_7 */
502		"CON1-P12", /* GPIOAO_8 */
503		"CON1-P37", /* GPIOAO_9 */
504		"CON1-P38", /* GPIOAO_10 */
505		"SYS_LED", /* GPIOAO_11 */
506		/* GPIOE */
507		"VDDEE_PWM", /* GPIOE_0 */
508		"VDDCPU_PWM", /* GPIOE_1 */
509		"TF_PWR_EN"; /* GPIOE_2 */
510};
511
512&hdmi_tx {
513	status = "okay";
514	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
515	pinctrl-names = "default";
516	hdmi-supply = <&dc_in>;
517};
518
519&hdmi_tx_tmds_port {
520	hdmi_tx_tmds_out: endpoint {
521		remote-endpoint = <&hdmi_connector_in>;
522	};
523};
524
525&ir {
526	status = "okay";
527	pinctrl-0 = <&remote_input_ao_pins>;
528	pinctrl-names = "default";
529};
530
531&pwm_AO_cd {
532	pinctrl-0 = <&pwm_ao_d_e_pins>;
533	pinctrl-names = "default";
534	clocks = <&xtal>;
535	clock-names = "clkin1";
536	status = "okay";
537};
538
539&saradc {
540	status = "okay";
541	vref-supply = <&vddao_1v8>;
542};
543
544/* SD card */
545&sd_emmc_b {
546	status = "okay";
547	pinctrl-0 = <&sdcard_c_pins>;
548	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
549	pinctrl-names = "default", "clk-gate";
550
551	bus-width = <4>;
552	cap-sd-highspeed;
553	max-frequency = <50000000>;
554	disable-wp;
555
556	/* TOFIX: SD card is barely usable in SDR modes */
557
558	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
559	vmmc-supply = <&tflash_vdd>;
560	vqmmc-supply = <&vddio_c>;
561};
562
563/* eMMC */
564&sd_emmc_c {
565	status = "okay";
566	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
567	pinctrl-1 = <&emmc_clk_gate_pins>;
568	pinctrl-names = "default", "clk-gate";
569
570	bus-width = <8>;
571	cap-mmc-highspeed;
572	mmc-ddr-1_8v;
573	mmc-hs200-1_8v;
574	max-frequency = <200000000>;
575	disable-wp;
576
577	mmc-pwrseq = <&emmc_pwrseq>;
578	vmmc-supply = <&vddao_3v3>;
579	vqmmc-supply = <&emmc_1v8>;
580};
581
582&tdmif_b {
583	status = "okay";
584};
585
586&tdmif_c {
587	status = "okay";
588};
589
590&tdmin_a {
591	status = "okay";
592};
593
594&tdmin_b {
595	status = "okay";
596};
597
598&tdmin_c {
599	status = "okay";
600};
601
602&tdmout_b {
603	status = "okay";
604};
605
606&tdmout_c {
607	status = "okay";
608};
609
610&toacodec {
611	status = "okay";
612};
613
614&tohdmitx {
615	status = "okay";
616};
617
618&toddr_a {
619	status = "okay";
620};
621
622&toddr_b {
623	status = "okay";
624};
625
626&toddr_c {
627	status = "okay";
628};
629
630&uart_AO {
631	status = "okay";
632	pinctrl-0 = <&uart_ao_a_pins>;
633	pinctrl-names = "default";
634};
635
636&usb {
637	status = "okay";
638};
639
640&usb2_phy0 {
641	phy-supply = <&dc_in>;
642};
643
644&usb2_phy1 {
645	/* Enable the hub which is connected to this port */
646	phy-supply = <&vl_pwr_en>;
647};
648