xref: /linux/scripts/dtc/include-prefixes/arm64/amlogic/meson-g12b-bananapi.dtsi (revision ec71f661a572a770d7c861cd52a50cbbb0e1a8d1)
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		clocks = <&clkc CLKID_MPLL2>,
198			 <&clkc CLKID_MPLL0>,
199			 <&clkc CLKID_MPLL1>;
200
201		assigned-clocks = <&clkc CLKID_MPLL2>,
202				  <&clkc CLKID_MPLL0>,
203				  <&clkc CLKID_MPLL1>;
204		assigned-clock-parents = <0>, <0>, <0>;
205		assigned-clock-rates = <294912000>,
206				       <270950400>,
207				       <393216000>;
208
209		dai-link-0 {
210			sound-dai = <&frddr_a>;
211		};
212
213		dai-link-1 {
214			sound-dai = <&frddr_b>;
215		};
216
217		dai-link-2 {
218			sound-dai = <&frddr_c>;
219		};
220
221		/* 8ch hdmi interface */
222		dai-link-3 {
223			sound-dai = <&tdmif_b>;
224			dai-format = "i2s";
225			dai-tdm-slot-tx-mask-0 = <1 1>;
226			dai-tdm-slot-tx-mask-1 = <1 1>;
227			dai-tdm-slot-tx-mask-2 = <1 1>;
228			dai-tdm-slot-tx-mask-3 = <1 1>;
229			mclk-fs = <256>;
230
231			codec {
232				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
233			};
234		};
235
236		/* hdmi glue */
237		dai-link-4 {
238			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
239
240			codec {
241				sound-dai = <&hdmi_tx>;
242			};
243		};
244	};
245};
246
247&arb {
248	status = "okay";
249};
250
251&clkc_audio {
252	status = "okay";
253};
254
255&cecb_AO {
256	pinctrl-0 = <&cec_ao_b_h_pins>;
257	pinctrl-names = "default";
258	status = "okay";
259	hdmi-phandle = <&hdmi_tx>;
260};
261
262&cpu0 {
263	cpu-supply = <&vddcpu_b>;
264	operating-points-v2 = <&cpu_opp_table_0>;
265	clocks = <&clkc CLKID_CPU_CLK>;
266};
267
268&cpu1 {
269	cpu-supply = <&vddcpu_b>;
270	operating-points-v2 = <&cpu_opp_table_0>;
271	clocks = <&clkc CLKID_CPU_CLK>;
272};
273
274&cpu100 {
275	cpu-supply = <&vddcpu_a>;
276	operating-points-v2 = <&cpub_opp_table_1>;
277	clocks = <&clkc CLKID_CPUB_CLK>;
278};
279
280&cpu101 {
281	cpu-supply = <&vddcpu_a>;
282	operating-points-v2 = <&cpub_opp_table_1>;
283	clocks = <&clkc CLKID_CPUB_CLK>;
284};
285
286&cpu102 {
287	cpu-supply = <&vddcpu_a>;
288	operating-points-v2 = <&cpub_opp_table_1>;
289	clocks = <&clkc CLKID_CPUB_CLK>;
290};
291
292&cpu103 {
293	cpu-supply = <&vddcpu_a>;
294	operating-points-v2 = <&cpub_opp_table_1>;
295	clocks = <&clkc CLKID_CPUB_CLK>;
296};
297
298&ethmac {
299	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
300	pinctrl-names = "default";
301	status = "okay";
302	phy-mode = "rgmii";
303	phy-handle = <&external_phy>;
304	amlogic,tx-delay-ns = <2>;
305};
306
307&ext_mdio {
308	external_phy: ethernet-phy@0 {
309		/* Realtek RTL8211F (0x001cc916) */
310		reg = <0>;
311		max-speed = <1000>;
312
313		reset-assert-us = <10000>;
314		reset-deassert-us = <80000>;
315		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
316
317		interrupt-parent = <&gpio_intc>;
318		/* MAC_INTR on GPIOZ_14 */
319		interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>;
320	};
321};
322
323&frddr_a {
324	status = "okay";
325};
326
327&frddr_b {
328	status = "okay";
329};
330
331&frddr_c {
332	status = "okay";
333};
334
335&hdmi_tx {
336	status = "okay";
337	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
338	pinctrl-names = "default";
339	hdmi-supply = <&vcc_5v>;
340};
341
342&hdmi_tx_tmds_port {
343	hdmi_tx_tmds_out: endpoint {
344		remote-endpoint = <&hdmi_connector_in>;
345	};
346};
347
348/* Main i2c bus */
349&i2c2 {
350	status = "okay";
351	pinctrl-0 = <&i2c2_sda_x_pins>, <&i2c2_sck_x_pins>;
352	pinctrl-names = "default";
353};
354
355&pcie {
356	status = "okay";
357	reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
358};
359
360&pwm_ab {
361	status = "okay";
362	pinctrl-0 = <&pwm_a_e_pins>;
363	pinctrl-names = "default";
364};
365
366&pwm_ef {
367	status = "okay";
368	pinctrl-0 = <&pwm_e_pins>;
369	pinctrl-names = "default";
370};
371
372&pwm_AO_cd {
373	pinctrl-0 = <&pwm_ao_d_e_pins>;
374	pinctrl-names = "default";
375	status = "okay";
376};
377
378&saradc {
379	status = "okay";
380	vref-supply = <&vddao_1v8>;
381};
382
383/* SDIO */
384&sd_emmc_a {
385	/* enable if WiFi/BT board connected */
386	status = "disabled";
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	sd-uhs-sdr104;
395	max-frequency = <50000000>;
396
397	non-removable;
398	disable-wp;
399
400	/* WiFi firmware requires power in suspend */
401	keep-power-in-suspend;
402
403	mmc-pwrseq = <&sdio_pwrseq>;
404
405	vmmc-supply = <&vsys_3v3>;
406	vqmmc-supply = <&vddao_1v8>;
407
408	rtl8822cs: wifi@1 {
409		reg = <1>;
410	};
411};
412
413/* SD card */
414&sd_emmc_b {
415	status = "okay";
416	pinctrl-0 = <&sdcard_c_pins>;
417	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
418	pinctrl-names = "default", "clk-gate";
419
420	bus-width = <4>;
421	cap-sd-highspeed;
422	max-frequency = <50000000>;
423	disable-wp;
424
425	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
426	vmmc-supply = <&vsys_3v3>;
427	vqmmc-supply = <&vsys_3v3>;
428};
429
430/* eMMC */
431&sd_emmc_c {
432	status = "okay";
433	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
434	pinctrl-1 = <&emmc_clk_gate_pins>;
435	pinctrl-names = "default", "clk-gate";
436
437	bus-width = <8>;
438	cap-mmc-highspeed;
439	mmc-ddr-1_8v;
440	mmc-hs200-1_8v;
441	max-frequency = <200000000>;
442	disable-wp;
443
444	mmc-pwrseq = <&emmc_pwrseq>;
445	vmmc-supply = <&vcc_3v3>;
446	vqmmc-supply = <&emmc_1v8>;
447};
448
449&tdmif_b {
450	status = "okay";
451};
452
453&tdmout_b {
454	status = "okay";
455};
456
457&tohdmitx {
458	status = "okay";
459};
460
461&uart_A {
462	/* enable if WiFi/BT board connected */
463	status = "disabled";
464	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
465	pinctrl-names = "default";
466	uart-has-rtscts;
467
468	bluetooth {
469		compatible = "realtek,rtl8822cs-bt";
470		enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
471		host-wake-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_HIGH>;
472		device-wake-gpios = <&gpio GPIOX_18 GPIO_ACTIVE_HIGH>;
473	};
474};
475
476&uart_AO {
477	status = "okay";
478	pinctrl-0 = <&uart_ao_a_pins>;
479	pinctrl-names = "default";
480};
481
482&usb2_phy0 {
483	phy-supply = <&dc_in>;
484};
485
486&usb2_phy1 {
487	phy-supply = <&usb_pwr>;
488};
489
490&usb3_pcie_phy {
491	phy-supply = <&usb_pwr>;
492};
493
494&usb {
495	status = "okay";
496	dr_mode = "peripheral";
497	phys = <&usb2_phy0>, <&usb2_phy1>;
498	phy-names = "usb2-phy0", "usb2-phy1";
499};
500