1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2018 BayLibre SAS. All rights reserved.
4 */
5
6/dts-v1/;
7
8#include "meson-g12a.dtsi"
9#include <dt-bindings/gpio/meson-g12a-gpio.h>
10#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
11
12/ {
13	compatible = "radxa,zero", "amlogic,g12a";
14	model = "Radxa Zero";
15
16	aliases {
17		serial0 = &uart_AO;
18	};
19
20	chosen {
21		stdout-path = "serial0:115200n8";
22	};
23
24	memory@0 {
25		device_type = "memory";
26		reg = <0x0 0x0 0x0 0x40000000>;
27	};
28
29	cvbs-connector {
30		status = "disabled";
31		compatible = "composite-video-connector";
32
33		port {
34			cvbs_connector_in: endpoint {
35				remote-endpoint = <&cvbs_vdac_out>;
36			};
37		};
38	};
39
40	hdmi-connector {
41		compatible = "hdmi-connector";
42		type = "a";
43
44		port {
45			hdmi_connector_in: endpoint {
46				remote-endpoint = <&hdmi_tx_tmds_out>;
47			};
48		};
49	};
50
51	emmc_pwrseq: emmc-pwrseq {
52		compatible = "mmc-pwrseq-emmc";
53		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
54	};
55
56	sdio_pwrseq: sdio-pwrseq {
57		compatible = "mmc-pwrseq-simple";
58		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
59		clocks = <&wifi32k>;
60		clock-names = "ext_clock";
61	};
62
63	ao_5v: regulator-ao_5v {
64		compatible = "regulator-fixed";
65		regulator-name = "AO_5V";
66		regulator-min-microvolt = <5000000>;
67		regulator-max-microvolt = <5000000>;
68		regulator-always-on;
69	};
70
71	vcc_1v8: regulator-vcc_1v8 {
72		compatible = "regulator-fixed";
73		regulator-name = "VCC_1V8";
74		regulator-min-microvolt = <1800000>;
75		regulator-max-microvolt = <1800000>;
76		vin-supply = <&vcc_3v3>;
77		regulator-always-on;
78	};
79
80	vcc_3v3: regulator-vcc_3v3 {
81		compatible = "regulator-fixed";
82		regulator-name = "VCC_3V3";
83		regulator-min-microvolt = <3300000>;
84		regulator-max-microvolt = <3300000>;
85		vin-supply = <&vddao_3v3>;
86		regulator-always-on;
87	};
88
89	hdmi_pw: regulator-hdmi_pw {
90		compatible = "regulator-fixed";
91		regulator-name = "HDMI_PW";
92		regulator-min-microvolt = <5000000>;
93		regulator-max-microvolt = <5000000>;
94		vin-supply = <&ao_5v>;
95		regulator-always-on;
96	};
97
98	vddao_1v8: regulator-vddao_1v8 {
99		compatible = "regulator-fixed";
100		regulator-name = "VDDAO_1V8";
101		regulator-min-microvolt = <1800000>;
102		regulator-max-microvolt = <1800000>;
103		vin-supply = <&vddao_3v3>;
104		regulator-always-on;
105	};
106
107	vddao_3v3: regulator-vddao_3v3 {
108		compatible = "regulator-fixed";
109		regulator-name = "VDDAO_3V3";
110		regulator-min-microvolt = <3300000>;
111		regulator-max-microvolt = <3300000>;
112		vin-supply = <&ao_5v>;
113		regulator-always-on;
114	};
115
116	vddcpu: regulator-vddcpu {
117		compatible = "pwm-regulator";
118
119		regulator-name = "VDDCPU";
120		regulator-min-microvolt = <721000>;
121		regulator-max-microvolt = <1022000>;
122
123		vin-supply = <&ao_5v>;
124
125		pwms = <&pwm_AO_cd 1 1250 0>;
126		pwm-dutycycle-range = <100 0>;
127
128		regulator-boot-on;
129		regulator-always-on;
130	};
131
132	sound {
133		compatible = "amlogic,axg-sound-card";
134		model = "RADXA-ZERO";
135		audio-aux-devs = <&tdmout_b>;
136		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
137				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
138				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
139				"TDM_B Playback", "TDMOUT_B OUT";
140
141		assigned-clocks = <&clkc CLKID_MPLL2>,
142				  <&clkc CLKID_MPLL0>,
143				  <&clkc CLKID_MPLL1>;
144		assigned-clock-parents = <0>, <0>, <0>;
145		assigned-clock-rates = <294912000>,
146				       <270950400>,
147				       <393216000>;
148		status = "okay";
149
150		dai-link-0 {
151			sound-dai = <&frddr_a>;
152		};
153
154		dai-link-1 {
155			sound-dai = <&frddr_b>;
156		};
157
158		dai-link-2 {
159			sound-dai = <&frddr_c>;
160		};
161
162		/* 8ch hdmi interface */
163		dai-link-3 {
164			sound-dai = <&tdmif_b>;
165			dai-format = "i2s";
166			dai-tdm-slot-tx-mask-0 = <1 1>;
167			dai-tdm-slot-tx-mask-1 = <1 1>;
168			dai-tdm-slot-tx-mask-2 = <1 1>;
169			dai-tdm-slot-tx-mask-3 = <1 1>;
170			mclk-fs = <256>;
171
172			codec {
173				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
174			};
175		};
176
177		dai-link-4 {
178			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
179
180			codec {
181				sound-dai = <&hdmi_tx>;
182			};
183		};
184	};
185
186	wifi32k: wifi32k {
187		compatible = "pwm-clock";
188		#clock-cells = <0>;
189		clock-frequency = <32768>;
190		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
191	};
192};
193
194&arb {
195	status = "okay";
196};
197
198&cec_AO {
199	pinctrl-0 = <&cec_ao_a_h_pins>;
200	pinctrl-names = "default";
201	status = "disabled";
202	hdmi-phandle = <&hdmi_tx>;
203};
204
205&cecb_AO {
206	pinctrl-0 = <&cec_ao_b_h_pins>;
207	pinctrl-names = "default";
208	status = "okay";
209	hdmi-phandle = <&hdmi_tx>;
210};
211
212&clkc_audio {
213	status = "okay";
214};
215
216&cpu0 {
217	cpu-supply = <&vddcpu>;
218	operating-points-v2 = <&cpu_opp_table>;
219	clocks = <&clkc CLKID_CPU_CLK>;
220	clock-latency = <50000>;
221};
222
223&cpu1 {
224	cpu-supply = <&vddcpu>;
225	operating-points-v2 = <&cpu_opp_table>;
226	clocks = <&clkc CLKID_CPU_CLK>;
227	clock-latency = <50000>;
228};
229
230&cpu2 {
231	cpu-supply = <&vddcpu>;
232	operating-points-v2 = <&cpu_opp_table>;
233	clocks = <&clkc CLKID_CPU_CLK>;
234	clock-latency = <50000>;
235};
236
237&cpu3 {
238	cpu-supply = <&vddcpu>;
239	operating-points-v2 = <&cpu_opp_table>;
240	clocks = <&clkc CLKID_CPU_CLK>;
241	clock-latency = <50000>;
242};
243
244&cvbs_vdac_port {
245	cvbs_vdac_out: endpoint {
246		remote-endpoint = <&cvbs_connector_in>;
247	};
248};
249
250&frddr_a {
251	status = "okay";
252};
253
254&frddr_b {
255	status = "okay";
256};
257
258&frddr_c {
259	status = "okay";
260};
261
262&hdmi_tx {
263	status = "okay";
264	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
265	pinctrl-names = "default";
266	hdmi-supply = <&hdmi_pw>;
267};
268
269&hdmi_tx_tmds_port {
270	hdmi_tx_tmds_out: endpoint {
271		remote-endpoint = <&hdmi_connector_in>;
272	};
273};
274
275&ir {
276	status = "disabled";
277	pinctrl-0 = <&remote_input_ao_pins>;
278	pinctrl-names = "default";
279};
280
281&pwm_AO_cd {
282	pinctrl-0 = <&pwm_ao_d_e_pins>;
283	pinctrl-names = "default";
284	clocks = <&xtal>;
285	clock-names = "clkin1";
286	status = "okay";
287};
288
289&pwm_ef {
290	status = "okay";
291	pinctrl-0 = <&pwm_e_pins>;
292	pinctrl-names = "default";
293	clocks = <&xtal>;
294	clock-names = "clkin0";
295};
296
297&saradc {
298	status = "okay";
299	vref-supply = <&vddao_1v8>;
300};
301
302/* SDIO */
303&sd_emmc_a {
304	status = "okay";
305	pinctrl-0 = <&sdio_pins>;
306	pinctrl-1 = <&sdio_clk_gate_pins>;
307	pinctrl-names = "default", "clk-gate";
308	#address-cells = <1>;
309	#size-cells = <0>;
310
311	bus-width = <4>;
312	cap-sd-highspeed;
313	sd-uhs-sdr50;
314	max-frequency = <100000000>;
315
316	non-removable;
317	disable-wp;
318
319	/* WiFi firmware requires power to be kept while in suspend */
320	keep-power-in-suspend;
321
322	mmc-pwrseq = <&sdio_pwrseq>;
323
324	vmmc-supply = <&vddao_3v3>;
325	vqmmc-supply = <&vddao_1v8>;
326
327	brcmf: wifi@1 {
328		reg = <1>;
329		compatible = "brcm,bcm4329-fmac";
330	};
331};
332
333/* SD card */
334&sd_emmc_b {
335	status = "okay";
336	pinctrl-0 = <&sdcard_c_pins>;
337	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
338	pinctrl-names = "default", "clk-gate";
339
340	bus-width = <4>;
341	cap-sd-highspeed;
342	max-frequency = <100000000>;
343	disable-wp;
344
345	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
346	vmmc-supply = <&vddao_3v3>;
347	vqmmc-supply = <&vddao_3v3>;
348};
349
350/* eMMC */
351&sd_emmc_c {
352	status = "okay";
353	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
354	pinctrl-1 = <&emmc_clk_gate_pins>;
355	pinctrl-names = "default", "clk-gate";
356
357	bus-width = <8>;
358	cap-mmc-highspeed;
359	mmc-ddr-1_8v;
360	mmc-hs200-1_8v;
361	max-frequency = <200000000>;
362	disable-wp;
363
364	mmc-pwrseq = <&emmc_pwrseq>;
365	vmmc-supply = <&vcc_3v3>;
366	vqmmc-supply = <&vcc_1v8>;
367};
368
369&tdmif_b {
370	status = "okay";
371};
372
373&tdmout_b {
374	status = "okay";
375};
376
377&tohdmitx {
378	status = "okay";
379};
380
381&uart_A {
382	status = "okay";
383	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
384	pinctrl-names = "default";
385	uart-has-rtscts;
386
387	bluetooth {
388		compatible = "brcm,bcm43438-bt";
389		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
390		max-speed = <2000000>;
391		clocks = <&wifi32k>;
392		clock-names = "lpo";
393	};
394};
395
396&uart_AO {
397	status = "okay";
398	pinctrl-0 = <&uart_ao_a_pins>;
399	pinctrl-names = "default";
400};
401
402&usb {
403	status = "okay";
404	dr_mode = "host";
405};
406