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) 2019 Christian Hewitt <christianshewitt@gmail.com>
6 * Copyright (c) 2022 Radxa Limited
7 * Author: Yuntian Zhang <yt@radxa.com>
8 */
9
10/dts-v1/;
11
12#include "meson-g12b-a311d.dtsi"
13#include <dt-bindings/input/input.h>
14#include <dt-bindings/leds/common.h>
15#include <dt-bindings/gpio/meson-g12a-gpio.h>
16#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
17
18/ {
19	compatible = "radxa,zero2", "amlogic,a311d", "amlogic,g12b";
20	model = "Radxa Zero2";
21
22	aliases {
23		serial0 = &uart_AO;
24		serial2 = &uart_A;
25	};
26
27	chosen {
28		stdout-path = "serial0:115200n8";
29	};
30
31	memory@0 {
32		device_type = "memory";
33		reg = <0x0 0x0 0x0 0x80000000>;
34	};
35
36	gpio-keys-polled {
37		compatible = "gpio-keys-polled";
38		poll-interval = <100>;
39		power-button {
40			label = "power";
41			linux,code = <KEY_POWER>;
42			gpios = <&gpio_ao GPIOAO_3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
43		};
44	};
45
46	leds {
47		compatible = "gpio-leds";
48
49		led-green {
50			color = <LED_COLOR_ID_GREEN>;
51			function = LED_FUNCTION_STATUS;
52			gpios = <&gpio GPIOA_12 GPIO_ACTIVE_HIGH>;
53			linux,default-trigger = "heartbeat";
54		};
55	};
56
57	hdmi-connector {
58		compatible = "hdmi-connector";
59		type = "a";
60
61		port {
62			hdmi_connector_in: endpoint {
63				remote-endpoint = <&hdmi_tx_tmds_out>;
64			};
65		};
66	};
67
68	emmc_pwrseq: emmc-pwrseq {
69		compatible = "mmc-pwrseq-emmc";
70		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
71	};
72
73	sdio_pwrseq: sdio-pwrseq {
74		compatible = "mmc-pwrseq-simple";
75		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
76		clocks = <&wifi32k>;
77		clock-names = "ext_clock";
78	};
79
80	ao_5v: regulator-ao-5v {
81		compatible = "regulator-fixed";
82		regulator-name = "AO_5V";
83		regulator-min-microvolt = <5000000>;
84		regulator-max-microvolt = <5000000>;
85		regulator-always-on;
86	};
87
88	vcc_1v8: regulator-vcc-1v8 {
89		compatible = "regulator-fixed";
90		regulator-name = "VCC_1V8";
91		regulator-min-microvolt = <1800000>;
92		regulator-max-microvolt = <1800000>;
93		vin-supply = <&vcc_3v3>;
94		regulator-always-on;
95	};
96
97	vcc_3v3: regulator-vcc-3v3 {
98		compatible = "regulator-fixed";
99		regulator-name = "VCC_3V3";
100		regulator-min-microvolt = <3300000>;
101		regulator-max-microvolt = <3300000>;
102		vin-supply = <&vddao_3v3>;
103		regulator-always-on;
104		/* FIXME: actually controlled by VDDCPU_B_EN */
105	};
106
107	vddao_1v8: regulator-vddao-1v8 {
108		compatible = "regulator-fixed";
109		regulator-name = "VDDIO_AO1V8";
110		regulator-min-microvolt = <1800000>;
111		regulator-max-microvolt = <1800000>;
112		vin-supply = <&vddao_3v3>;
113		regulator-always-on;
114	};
115
116	vddao_3v3: regulator-vddao-3v3 {
117		compatible = "regulator-fixed";
118		regulator-name = "VDDAO_3V3";
119		regulator-min-microvolt = <3300000>;
120		regulator-max-microvolt = <3300000>;
121		vin-supply = <&ao_5v>;
122		regulator-always-on;
123	};
124
125	vddcpu_a: regulator-vddcpu-a {
126		/*
127		 * MP8756GD Regulator.
128		 */
129		compatible = "pwm-regulator";
130
131		regulator-name = "VDDCPU_A";
132		regulator-min-microvolt = <730000>;
133		regulator-max-microvolt = <1022000>;
134
135		pwm-supply = <&ao_5v>;
136
137		pwms = <&pwm_ab 0 1250 0>;
138		pwm-dutycycle-range = <100 0>;
139
140		regulator-boot-on;
141		regulator-always-on;
142	};
143
144	vddcpu_b: regulator-vddcpu-b {
145		/*
146		 * Silergy SY8120B1ABC Regulator.
147		 */
148		compatible = "pwm-regulator";
149
150		regulator-name = "VDDCPU_B";
151		regulator-min-microvolt = <730000>;
152		regulator-max-microvolt = <1022000>;
153
154		pwm-supply = <&ao_5v>;
155
156		pwms = <&pwm_AO_cd 1 1250 0>;
157		pwm-dutycycle-range = <100 0>;
158
159		regulator-boot-on;
160		regulator-always-on;
161	};
162
163	sound {
164		compatible = "amlogic,axg-sound-card";
165		model = "RADXA-ZERO2";
166		audio-aux-devs = <&tdmout_b>;
167		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
168				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
169				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
170				"TDM_B Playback", "TDMOUT_B OUT";
171
172		assigned-clocks = <&clkc CLKID_MPLL2>,
173				  <&clkc CLKID_MPLL0>,
174				  <&clkc CLKID_MPLL1>;
175		assigned-clock-parents = <0>, <0>, <0>;
176		assigned-clock-rates = <294912000>,
177				       <270950400>,
178				       <393216000>;
179
180		dai-link-0 {
181			sound-dai = <&frddr_a>;
182		};
183
184		dai-link-1 {
185			sound-dai = <&frddr_b>;
186		};
187
188		dai-link-2 {
189			sound-dai = <&frddr_c>;
190		};
191
192		/* 8ch hdmi interface */
193		dai-link-3 {
194			sound-dai = <&tdmif_b>;
195			dai-format = "i2s";
196			dai-tdm-slot-tx-mask-0 = <1 1>;
197			dai-tdm-slot-tx-mask-1 = <1 1>;
198			dai-tdm-slot-tx-mask-2 = <1 1>;
199			dai-tdm-slot-tx-mask-3 = <1 1>;
200			mclk-fs = <256>;
201
202			codec {
203				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
204			};
205		};
206
207		/* hdmi glue */
208		dai-link-4 {
209			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
210
211			codec {
212				sound-dai = <&hdmi_tx>;
213			};
214		};
215	};
216
217	wifi32k: clock-0 {
218		compatible = "pwm-clock";
219		#clock-cells = <0>;
220		clock-frequency = <32768>;
221		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
222	};
223};
224
225&arb {
226	status = "okay";
227};
228
229&cec_AO {
230	pinctrl-0 = <&cec_ao_a_h_pins>;
231	pinctrl-names = "default";
232	status = "disabled";
233	hdmi-phandle = <&hdmi_tx>;
234};
235
236&cecb_AO {
237	pinctrl-0 = <&cec_ao_b_h_pins>;
238	pinctrl-names = "default";
239	status = "okay";
240	hdmi-phandle = <&hdmi_tx>;
241};
242
243&clkc_audio {
244	status = "okay";
245};
246
247&cpu0 {
248	cpu-supply = <&vddcpu_b>;
249	operating-points-v2 = <&cpu_opp_table_0>;
250	clocks = <&clkc CLKID_CPU_CLK>;
251	clock-latency = <50000>;
252};
253
254&cpu1 {
255	cpu-supply = <&vddcpu_b>;
256	operating-points-v2 = <&cpu_opp_table_0>;
257	clocks = <&clkc CLKID_CPU_CLK>;
258	clock-latency = <50000>;
259};
260
261&cpu100 {
262	cpu-supply = <&vddcpu_a>;
263	operating-points-v2 = <&cpub_opp_table_1>;
264	clocks = <&clkc CLKID_CPUB_CLK>;
265	clock-latency = <50000>;
266};
267
268&cpu101 {
269	cpu-supply = <&vddcpu_a>;
270	operating-points-v2 = <&cpub_opp_table_1>;
271	clocks = <&clkc CLKID_CPUB_CLK>;
272	clock-latency = <50000>;
273};
274
275&cpu102 {
276	cpu-supply = <&vddcpu_a>;
277	operating-points-v2 = <&cpub_opp_table_1>;
278	clocks = <&clkc CLKID_CPUB_CLK>;
279	clock-latency = <50000>;
280};
281
282&cpu103 {
283	cpu-supply = <&vddcpu_a>;
284	operating-points-v2 = <&cpub_opp_table_1>;
285	clocks = <&clkc CLKID_CPUB_CLK>;
286	clock-latency = <50000>;
287};
288
289&frddr_a {
290	status = "okay";
291};
292
293&frddr_b {
294	status = "okay";
295};
296
297&frddr_c {
298	status = "okay";
299};
300
301&gpio {
302	gpio-line-names =
303		/* GPIOZ */
304		"PIN_27", "PIN_28", "PIN_7", "PIN_11", "PIN_13", "PIN_15", "PIN_18", "PIN_40",
305		"", "", "", "", "", "", "", "",
306		/* GPIOH */
307		"", "", "", "", "PIN_19", "PIN_21", "PIN_24", "PIN_23",
308		"",
309		/* BOOT */
310		"", "", "", "", "", "", "", "",
311		"", "", "", "", "EMMC_PWRSEQ", "", "", "",
312		/* GPIOC */
313		"", "", "", "", "", "", "SD_CD", "PIN_36",
314		/* GPIOA */
315		"PIN_32", "PIN_12", "PIN_35", "", "", "PIN_38", "", "",
316		"", "", "", "", "LED_GREEN", "PIN_31", "PIN_3", "PIN_5",
317		/* GPIOX */
318		"", "", "", "", "", "", "SDIO_PWRSEQ", "",
319		"", "", "", "", "", "", "", "",
320		"", "BT_SHUTDOWN", "", "";
321};
322
323&gpio_ao {
324	gpio-line-names =
325		/* GPIOAO */
326		"PIN_8", "PIN_10", "", "BTN_POWER", "", "", "", "PIN_29",
327		"PIN_33", "PIN_37", "FAN", "",
328		/* GPIOE */
329		"", "", "";
330};
331
332&hdmi_tx {
333	status = "okay";
334	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
335	pinctrl-names = "default";
336	hdmi-supply = <&ao_5v>;
337};
338
339&hdmi_tx_tmds_port {
340	hdmi_tx_tmds_out: endpoint {
341		remote-endpoint = <&hdmi_connector_in>;
342	};
343};
344
345&ir {
346	status = "disabled";
347	pinctrl-0 = <&remote_input_ao_pins>;
348	pinctrl-names = "default";
349};
350
351&pwm_ab {
352	pinctrl-0 = <&pwm_a_e_pins>;
353	pinctrl-names = "default";
354	clocks = <&xtal>;
355	clock-names = "clkin0";
356	status = "okay";
357};
358
359&pwm_ef {
360	pinctrl-0 = <&pwm_e_pins>;
361	pinctrl-names = "default";
362	clocks = <&xtal>;
363	clock-names = "clkin2";
364	status = "okay";
365};
366
367&pwm_AO_ab {
368	pinctrl-0 = <&pwm_ao_a_pins>;
369	pinctrl-names = "default";
370	clocks = <&xtal>;
371	clock-names = "clkin3";
372	status = "okay";
373};
374
375&pwm_AO_cd {
376	pinctrl-0 = <&pwm_ao_d_e_pins>;
377	pinctrl-names = "default";
378	clocks = <&xtal>;
379	clock-names = "clkin4";
380	status = "okay";
381};
382
383&saradc {
384	status = "okay";
385	vref-supply = <&vddao_1v8>;
386};
387
388/* SDIO */
389&sd_emmc_a {
390	status = "okay";
391	pinctrl-0 = <&sdio_pins>;
392	pinctrl-1 = <&sdio_clk_gate_pins>;
393	pinctrl-names = "default", "clk-gate";
394	#address-cells = <1>;
395	#size-cells = <0>;
396
397	bus-width = <4>;
398	cap-sd-highspeed;
399	max-frequency = <100000000>;
400
401	non-removable;
402	disable-wp;
403
404	/* WiFi firmware requires power to be kept while in suspend */
405	keep-power-in-suspend;
406
407	mmc-pwrseq = <&sdio_pwrseq>;
408
409	vmmc-supply = <&vddao_3v3>;
410	vqmmc-supply = <&vddao_1v8>;
411
412	brcmf: wifi@1 {
413		reg = <1>;
414		compatible = "brcm,bcm4329-fmac";
415	};
416};
417
418/* SD card */
419&sd_emmc_b {
420	status = "okay";
421	pinctrl-0 = <&sdcard_c_pins>;
422	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
423	pinctrl-names = "default", "clk-gate";
424
425	bus-width = <4>;
426	cap-sd-highspeed;
427	max-frequency = <50000000>;
428	disable-wp;
429
430	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
431	vmmc-supply = <&vddao_3v3>;
432	vqmmc-supply = <&vddao_3v3>;
433};
434
435/* eMMC */
436&sd_emmc_c {
437	status = "okay";
438	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
439	pinctrl-1 = <&emmc_clk_gate_pins>;
440	pinctrl-names = "default", "clk-gate";
441
442	bus-width = <8>;
443	cap-mmc-highspeed;
444	mmc-ddr-1_8v;
445	mmc-hs200-1_8v;
446	max-frequency = <200000000>;
447	disable-wp;
448
449	mmc-pwrseq = <&emmc_pwrseq>;
450	vmmc-supply = <&vcc_3v3>;
451	vqmmc-supply = <&vcc_1v8>;
452};
453
454&tdmif_b {
455	status = "okay";
456};
457
458&tdmout_b {
459	status = "okay";
460};
461
462&tohdmitx {
463	status = "okay";
464};
465
466&uart_A {
467	status = "okay";
468	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
469	pinctrl-names = "default";
470	uart-has-rtscts;
471
472	bluetooth {
473		compatible = "brcm,bcm43438-bt";
474		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
475		max-speed = <2000000>;
476		clocks = <&wifi32k>;
477		clock-names = "lpo";
478	};
479};
480
481&uart_AO {
482	status = "okay";
483	pinctrl-0 = <&uart_ao_a_pins>;
484	pinctrl-names = "default";
485};
486
487&usb {
488	status = "okay";
489};
490