xref: /linux/arch/arm64/boot/dts/amlogic/meson-g12b-bananapi.dtsi (revision a3a02a52bcfcbcc4a637d4b68bf1bc391c9fad02)
1// 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) 2023 Christian Hewitt <christianshewitt@gmail.com>
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		rtc1 = &vrtc;
18	};
19
20	chosen {
21		stdout-path = "serial0:115200n8";
22	};
23
24	memory@0 {
25		device_type = "memory";
26		reg = <0x0 0x0 0x0 0x80000000>; /* 2 GiB or 4 GiB */
27	};
28
29	adc-keys {
30		compatible = "adc-keys";
31		io-channels = <&saradc 2>;
32		io-channel-names = "buttons";
33		keyup-threshold-microvolt = <1710000>;
34
35		button-function {
36			label = "RST";
37			linux,code = <KEY_POWER>;
38			press-threshold-microvolt = <10000>;
39		};
40	};
41
42	emmc_pwrseq: emmc-pwrseq {
43		compatible = "mmc-pwrseq-emmc";
44		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
45	};
46
47	hdmi-connector {
48		compatible = "hdmi-connector";
49		type = "a";
50
51		port {
52			hdmi_connector_in: endpoint {
53				remote-endpoint = <&hdmi_tx_tmds_out>;
54			};
55		};
56	};
57
58	leds {
59		compatible = "gpio-leds";
60
61		led-0 {
62			color = <LED_COLOR_ID_BLUE>;
63			function = LED_FUNCTION_STATUS;
64			gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
65			linux,default-trigger = "heartbeat";
66		};
67
68		led-1 {
69			color = <LED_COLOR_ID_GREEN>;
70			function = LED_FUNCTION_STATUS;
71			gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
72		};
73	};
74
75	sdio_pwrseq: sdio-pwrseq {
76		compatible = "mmc-pwrseq-simple";
77		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
78		clocks = <&wifi32k>;
79		clock-names = "ext_clock";
80	};
81
82	wifi32k: wifi32k {
83		compatible = "pwm-clock";
84		#clock-cells = <0>;
85		clock-frequency = <32768>;
86		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
87	};
88
89	dc_in: regulator-dc-in {
90		compatible = "regulator-fixed";
91		regulator-name = "DC_IN";
92		regulator-min-microvolt = <5000000>;
93		regulator-max-microvolt = <5000000>;
94		regulator-always-on;
95	};
96
97	vcc_5v: regulator-vcc-5v {
98		compatible = "regulator-fixed";
99		regulator-name = "VCC_5V";
100		regulator-min-microvolt = <5000000>;
101		regulator-max-microvolt = <5000000>;
102		vin-supply = <&dc_in>;
103
104		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
105		enable-active-high;
106	};
107
108	vcc_3v3: regulator-vcc-3v3 {
109		compatible = "regulator-fixed";
110		regulator-name = "VCC_3V3";
111		regulator-min-microvolt = <3300000>;
112		regulator-max-microvolt = <3300000>;
113		vin-supply = <&vsys_3v3>;
114		regulator-always-on;
115	};
116
117	vcc_1v8: regulator-vcc-1v8 {
118		compatible = "regulator-fixed";
119		regulator-name = "VCC_1V8";
120		regulator-min-microvolt = <1800000>;
121		regulator-max-microvolt = <1800000>;
122		vin-supply = <&vcc_3v3>;
123		regulator-always-on;
124	};
125
126	vddao_1v8: regulator-vddao-1v8 {
127		compatible = "regulator-fixed";
128		regulator-name = "VDDIO_AO1V8";
129		regulator-min-microvolt = <1800000>;
130		regulator-max-microvolt = <1800000>;
131		vin-supply = <&vsys_3v3>;
132		regulator-always-on;
133	};
134
135	vddcpu_a: regulator-vddcpu-a {
136		compatible = "pwm-regulator";
137		regulator-name = "VDDCPU_A";
138		regulator-min-microvolt = <690000>;
139		regulator-max-microvolt = <1050000>;
140		pwm-supply = <&dc_in>;
141		pwms = <&pwm_ab 0 1250 0>;
142		pwm-dutycycle-range = <100 0>;
143		regulator-boot-on;
144		regulator-always-on;
145	};
146
147	vddcpu_b: regulator-vddcpu-b {
148		compatible = "pwm-regulator";
149		regulator-name = "VDDCPU_B";
150		regulator-min-microvolt = <690000>;
151		regulator-max-microvolt = <1050000>;
152		pwm-supply = <&vsys_3v3>;
153		pwms = <&pwm_AO_cd 1 1250 0>;
154		pwm-dutycycle-range = <100 0>;
155		regulator-boot-on;
156		regulator-always-on;
157	};
158
159	vsys_3v3: regulator-vsys-3v3 {
160		compatible = "regulator-fixed";
161		regulator-name = "VSYS_3V3";
162		regulator-min-microvolt = <3300000>;
163		regulator-max-microvolt = <3300000>;
164		vin-supply = <&dc_in>;
165		regulator-always-on;
166	};
167
168	emmc_1v8: regulator-emmc-1v8 {
169		compatible = "regulator-fixed";
170		regulator-name = "EMMC_AO1V8";
171		regulator-min-microvolt = <1800000>;
172		regulator-max-microvolt = <1800000>;
173		vin-supply = <&vcc_3v3>;
174		regulator-always-on;
175	};
176
177	usb_pwr: regulator-usb-pwr {
178		compatible = "regulator-fixed";
179		regulator-name = "USB_PWR";
180		regulator-min-microvolt = <5000000>;
181		regulator-max-microvolt = <5000000>;
182		vin-supply = <&vcc_5v>;
183
184		gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
185		enable-active-high;
186	};
187
188	sound {
189		compatible = "amlogic,axg-sound-card";
190		model = "BPI-M2S";
191		audio-aux-devs = <&tdmout_b>;
192		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
193				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
194				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
195				"TDM_B Playback", "TDMOUT_B OUT";
196
197		assigned-clocks = <&clkc CLKID_MPLL2>,
198				  <&clkc CLKID_MPLL0>,
199				  <&clkc CLKID_MPLL1>;
200		assigned-clock-parents = <0>, <0>, <0>;
201		assigned-clock-rates = <294912000>,
202				       <270950400>,
203				       <393216000>;
204
205		dai-link-0 {
206			sound-dai = <&frddr_a>;
207		};
208
209		dai-link-1 {
210			sound-dai = <&frddr_b>;
211		};
212
213		dai-link-2 {
214			sound-dai = <&frddr_c>;
215		};
216
217		/* 8ch hdmi interface */
218		dai-link-3 {
219			sound-dai = <&tdmif_b>;
220			dai-format = "i2s";
221			dai-tdm-slot-tx-mask-0 = <1 1>;
222			dai-tdm-slot-tx-mask-1 = <1 1>;
223			dai-tdm-slot-tx-mask-2 = <1 1>;
224			dai-tdm-slot-tx-mask-3 = <1 1>;
225			mclk-fs = <256>;
226
227			codec {
228				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
229			};
230		};
231
232		/* hdmi glue */
233		dai-link-4 {
234			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
235
236			codec {
237				sound-dai = <&hdmi_tx>;
238			};
239		};
240	};
241};
242
243&arb {
244	status = "okay";
245};
246
247&clkc_audio {
248	status = "okay";
249};
250
251&cecb_AO {
252	pinctrl-0 = <&cec_ao_b_h_pins>;
253	pinctrl-names = "default";
254	status = "okay";
255	hdmi-phandle = <&hdmi_tx>;
256};
257
258&cpu0 {
259	cpu-supply = <&vddcpu_b>;
260	operating-points-v2 = <&cpu_opp_table_0>;
261	clocks = <&clkc CLKID_CPU_CLK>;
262	clock-latency = <50000>;
263};
264
265&cpu1 {
266	cpu-supply = <&vddcpu_b>;
267	operating-points-v2 = <&cpu_opp_table_0>;
268	clocks = <&clkc CLKID_CPU_CLK>;
269	clock-latency = <50000>;
270};
271
272&cpu100 {
273	cpu-supply = <&vddcpu_a>;
274	operating-points-v2 = <&cpub_opp_table_1>;
275	clocks = <&clkc CLKID_CPUB_CLK>;
276	clock-latency = <50000>;
277};
278
279&cpu101 {
280	cpu-supply = <&vddcpu_a>;
281	operating-points-v2 = <&cpub_opp_table_1>;
282	clocks = <&clkc CLKID_CPUB_CLK>;
283	clock-latency = <50000>;
284};
285
286&cpu102 {
287	cpu-supply = <&vddcpu_a>;
288	operating-points-v2 = <&cpub_opp_table_1>;
289	clocks = <&clkc CLKID_CPUB_CLK>;
290	clock-latency = <50000>;
291};
292
293&cpu103 {
294	cpu-supply = <&vddcpu_a>;
295	operating-points-v2 = <&cpub_opp_table_1>;
296	clocks = <&clkc CLKID_CPUB_CLK>;
297	clock-latency = <50000>;
298};
299
300&ethmac {
301	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
302	pinctrl-names = "default";
303	status = "okay";
304	phy-mode = "rgmii";
305	phy-handle = <&external_phy>;
306	amlogic,tx-delay-ns = <2>;
307};
308
309&ext_mdio {
310	external_phy: ethernet-phy@0 {
311		/* Realtek RTL8211F (0x001cc916) */
312		reg = <0>;
313		max-speed = <1000>;
314
315		reset-assert-us = <10000>;
316		reset-deassert-us = <80000>;
317		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
318
319		interrupt-parent = <&gpio_intc>;
320		/* MAC_INTR on GPIOZ_14 */
321		interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>;
322	};
323};
324
325&frddr_a {
326	status = "okay";
327};
328
329&frddr_b {
330	status = "okay";
331};
332
333&frddr_c {
334	status = "okay";
335};
336
337&hdmi_tx {
338	status = "okay";
339	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
340	pinctrl-names = "default";
341	hdmi-supply = <&vcc_5v>;
342};
343
344&hdmi_tx_tmds_port {
345	hdmi_tx_tmds_out: endpoint {
346		remote-endpoint = <&hdmi_connector_in>;
347	};
348};
349
350/* Main i2c bus */
351&i2c2 {
352	status = "okay";
353	pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>;
354	pinctrl-names = "default";
355};
356
357&pcie {
358	status = "okay";
359	reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
360};
361
362&pwm_ab {
363	status = "okay";
364	pinctrl-0 = <&pwm_a_e_pins>;
365	pinctrl-names = "default";
366	clocks = <&xtal>;
367	clock-names = "clkin0";
368};
369
370&pwm_ef {
371	status = "okay";
372	pinctrl-0 = <&pwm_e_pins>;
373	pinctrl-names = "default";
374};
375
376&pwm_AO_cd {
377	pinctrl-0 = <&pwm_ao_d_e_pins>;
378	pinctrl-names = "default";
379	clocks = <&xtal>;
380	clock-names = "clkin1";
381	status = "okay";
382};
383
384&saradc {
385	status = "okay";
386	vref-supply = <&vddao_1v8>;
387};
388
389/* SDIO */
390&sd_emmc_a {
391	/* enable if WiFi/BT board connected */
392	status = "disabled";
393	pinctrl-0 = <&sdio_pins>;
394	pinctrl-1 = <&sdio_clk_gate_pins>;
395	pinctrl-names = "default", "clk-gate";
396	#address-cells = <1>;
397	#size-cells = <0>;
398
399	bus-width = <4>;
400	sd-uhs-sdr104;
401	max-frequency = <50000000>;
402
403	non-removable;
404	disable-wp;
405
406	/* WiFi firmware requires power in suspend */
407	keep-power-in-suspend;
408
409	mmc-pwrseq = <&sdio_pwrseq>;
410
411	vmmc-supply = <&vsys_3v3>;
412	vqmmc-supply = <&vddao_1v8>;
413
414	rtl8822cs: wifi@1 {
415		reg = <1>;
416	};
417};
418
419/* SD card */
420&sd_emmc_b {
421	status = "okay";
422	pinctrl-0 = <&sdcard_c_pins>;
423	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
424	pinctrl-names = "default", "clk-gate";
425
426	bus-width = <4>;
427	cap-sd-highspeed;
428	max-frequency = <50000000>;
429	disable-wp;
430
431	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
432	vmmc-supply = <&vsys_3v3>;
433	vqmmc-supply = <&vsys_3v3>;
434};
435
436/* eMMC */
437&sd_emmc_c {
438	status = "okay";
439	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
440	pinctrl-1 = <&emmc_clk_gate_pins>;
441	pinctrl-names = "default", "clk-gate";
442
443	bus-width = <8>;
444	cap-mmc-highspeed;
445	mmc-ddr-1_8v;
446	mmc-hs200-1_8v;
447	max-frequency = <200000000>;
448	disable-wp;
449
450	mmc-pwrseq = <&emmc_pwrseq>;
451	vmmc-supply = <&vcc_3v3>;
452	vqmmc-supply = <&emmc_1v8>;
453};
454
455&tdmif_b {
456	status = "okay";
457};
458
459&tdmout_b {
460	status = "okay";
461};
462
463&tohdmitx {
464	status = "okay";
465};
466
467&uart_A {
468	/* enable if WiFi/BT board connected */
469	status = "disabled";
470	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
471	pinctrl-names = "default";
472	uart-has-rtscts;
473
474	bluetooth {
475		compatible = "realtek,rtl8822cs-bt";
476		enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
477		host-wake-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>;
478		device-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>;
479	};
480};
481
482&uart_AO {
483	status = "okay";
484	pinctrl-0 = <&uart_ao_a_pins>;
485	pinctrl-names = "default";
486};
487
488&usb2_phy0 {
489	phy-supply = <&dc_in>;
490};
491
492&usb2_phy1 {
493	phy-supply = <&usb_pwr>;
494};
495
496&usb3_pcie_phy {
497	phy-supply = <&usb_pwr>;
498};
499
500&usb {
501	status = "okay";
502	dr_mode = "peripheral";
503	phys = <&usb2_phy0>, <&usb2_phy1>;
504	phy-names = "usb2-phy0", "usb2-phy1";
505};
506