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/gpio.h>
10#include <dt-bindings/gpio/meson-g12a-gpio.h>
11#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13/ {
14	compatible = "amediatech,x96-max", "amlogic,u200", "amlogic,g12a";
15	model = "Shenzhen Amediatech Technology Co., Ltd X96 Max";
16
17	aliases {
18		serial0 = &uart_AO;
19		ethernet0 = &ethmac;
20	};
21
22	spdif_dit: audio-codec-1 {
23		#sound-dai-cells = <0>;
24		compatible = "linux,spdif-dit";
25		status = "okay";
26		sound-name-prefix = "DIT";
27	};
28
29	chosen {
30		stdout-path = "serial0:115200n8";
31	};
32	memory@0 {
33		device_type = "memory";
34		reg = <0x0 0x0 0x0 0x40000000>;
35	};
36
37	cvbs-connector {
38		compatible = "composite-video-connector";
39
40		port {
41			cvbs_connector_in: endpoint {
42				remote-endpoint = <&cvbs_vdac_out>;
43			};
44		};
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	emmc_pwrseq: emmc-pwrseq {
59		compatible = "mmc-pwrseq-emmc";
60		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
61	};
62
63	sdio_pwrseq: sdio-pwrseq {
64		compatible = "mmc-pwrseq-simple";
65		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
66		clocks = <&wifi32k>;
67		clock-names = "ext_clock";
68	};
69
70	flash_1v8: regulator-flash_1v8 {
71		compatible = "regulator-fixed";
72		regulator-name = "FLASH_1V8";
73		regulator-min-microvolt = <1800000>;
74		regulator-max-microvolt = <1800000>;
75		vin-supply = <&vcc_3v3>;
76		regulator-always-on;
77	};
78
79	dc_in: regulator-dc_in {
80		compatible = "regulator-fixed";
81		regulator-name = "DC_IN";
82		regulator-min-microvolt = <5000000>;
83		regulator-max-microvolt = <5000000>;
84		regulator-always-on;
85	};
86
87	vcc_1v8: regulator-vcc_1v8 {
88		compatible = "regulator-fixed";
89		regulator-name = "VCC_1V8";
90		regulator-min-microvolt = <1800000>;
91		regulator-max-microvolt = <1800000>;
92		vin-supply = <&vcc_3v3>;
93		regulator-always-on;
94	};
95
96	vcc_3v3: regulator-vcc_3v3 {
97		compatible = "regulator-fixed";
98		regulator-name = "VCC_3V3";
99		regulator-min-microvolt = <3300000>;
100		regulator-max-microvolt = <3300000>;
101		vin-supply = <&vddao_3v3>;
102		regulator-always-on;
103		/* FIXME: actually controlled by VDDCPU_B_EN */
104	};
105
106	vcc_5v: regulator-vcc_5v {
107		compatible = "regulator-fixed";
108		regulator-name = "VCC_5V";
109		regulator-min-microvolt = <5000000>;
110		regulator-max-microvolt = <5000000>;
111		vin-supply = <&dc_in>;
112
113		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
114		enable-active-low;
115	};
116
117	vddao_1v8: regulator-vddao_1v8 {
118		compatible = "regulator-fixed";
119		regulator-name = "VDDAO_1V8";
120		regulator-min-microvolt = <1800000>;
121		regulator-max-microvolt = <1800000>;
122		vin-supply = <&vddao_3v3>;
123		regulator-always-on;
124	};
125
126	vddao_3v3: regulator-vddao_3v3 {
127		compatible = "regulator-fixed";
128		regulator-name = "VDDAO_3V3";
129		regulator-min-microvolt = <3300000>;
130		regulator-max-microvolt = <3300000>;
131		vin-supply = <&dc_in>;
132		regulator-always-on;
133	};
134
135	sound {
136		compatible = "amlogic,axg-sound-card";
137		model = "G12A-X96-MAX";
138		audio-aux-devs = <&tdmout_b>;
139		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
140				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
141				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
142				"TDM_B Playback", "TDMOUT_B OUT",
143				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
144				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
145				"SPDIFOUT IN 2", "FRDDR_C OUT 3";
146
147		assigned-clocks = <&clkc CLKID_MPLL2>,
148				  <&clkc CLKID_MPLL0>,
149				  <&clkc CLKID_MPLL1>;
150		assigned-clock-parents = <0>, <0>, <0>;
151		assigned-clock-rates = <294912000>,
152				       <270950400>,
153				       <393216000>;
154		status = "okay";
155
156		dai-link-0 {
157			sound-dai = <&frddr_a>;
158		};
159
160		dai-link-1 {
161			sound-dai = <&frddr_b>;
162		};
163
164		dai-link-2 {
165			sound-dai = <&frddr_c>;
166		};
167
168		/* 8ch hdmi interface */
169		dai-link-3 {
170			sound-dai = <&tdmif_b>;
171			dai-format = "i2s";
172			dai-tdm-slot-tx-mask-0 = <1 1>;
173			dai-tdm-slot-tx-mask-1 = <1 1>;
174			dai-tdm-slot-tx-mask-2 = <1 1>;
175			dai-tdm-slot-tx-mask-3 = <1 1>;
176			mclk-fs = <256>;
177
178			codec {
179				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
180			};
181		};
182
183		/* spdif hdmi or toslink interface */
184		dai-link-4 {
185			sound-dai = <&spdifout>;
186
187			codec-0 {
188				sound-dai = <&spdif_dit>;
189			};
190
191			codec-1 {
192				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_A>;
193			};
194		};
195
196		/* spdif hdmi interface */
197		dai-link-5 {
198			sound-dai = <&spdifout_b>;
199
200			codec {
201				sound-dai = <&tohdmitx TOHDMITX_SPDIF_IN_B>;
202			};
203		};
204
205		/* hdmi glue */
206		dai-link-6 {
207			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
208
209			codec {
210				sound-dai = <&hdmi_tx>;
211			};
212		};
213	};
214
215	wifi32k: wifi32k {
216		compatible = "pwm-clock";
217		#clock-cells = <0>;
218		clock-frequency = <32768>;
219		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
220	};
221};
222
223&arb {
224	status = "okay";
225};
226
227&cec_AO {
228	pinctrl-0 = <&cec_ao_a_h_pins>;
229	pinctrl-names = "default";
230	status = "disabled";
231	hdmi-phandle = <&hdmi_tx>;
232};
233
234&cecb_AO {
235	pinctrl-0 = <&cec_ao_b_h_pins>;
236	pinctrl-names = "default";
237	status = "okay";
238	hdmi-phandle = <&hdmi_tx>;
239};
240
241&clkc_audio {
242	status = "okay";
243};
244
245&cvbs_vdac_port {
246	cvbs_vdac_out: endpoint {
247		remote-endpoint = <&cvbs_connector_in>;
248	};
249};
250
251&frddr_a {
252	status = "okay";
253};
254
255&frddr_b {
256	status = "okay";
257};
258
259&frddr_c {
260	status = "okay";
261};
262
263&hdmi_tx {
264	status = "okay";
265	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
266	pinctrl-names = "default";
267	hdmi-supply = <&vcc_5v>;
268};
269
270&hdmi_tx_tmds_port {
271	hdmi_tx_tmds_out: endpoint {
272		remote-endpoint = <&hdmi_connector_in>;
273	};
274};
275
276&ir {
277	status = "okay";
278	pinctrl-0 = <&remote_input_ao_pins>;
279	pinctrl-names = "default";
280};
281
282&ext_mdio {
283	external_phy: ethernet-phy@0 {
284		/* Realtek RTL8211F (0x001cc916) */
285		reg = <0>;
286		max-speed = <1000>;
287		eee-broken-1000t;
288	};
289};
290
291&ethmac {
292	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
293	pinctrl-names = "default";
294	status = "okay";
295	phy-mode = "rgmii";
296	phy-handle = <&external_phy>;
297	amlogic,tx-delay-ns = <2>;
298	snps,reset-gpio = <&gpio GPIOZ_14 0>;
299	snps,reset-delays-us = <0 10000 1000000>;
300	snps,reset-active-low;
301};
302
303&pwm_ef {
304	status = "okay";
305	pinctrl-0 = <&pwm_e_pins>;
306	pinctrl-names = "default";
307	clocks = <&xtal>;
308	clock-names = "clkin0";
309};
310
311&uart_A {
312	status = "okay";
313	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
314	pinctrl-names = "default";
315	uart-has-rtscts;
316
317	bluetooth {
318		compatible = "brcm,bcm43438-bt";
319		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
320		max-speed = <2000000>;
321		clocks = <&wifi32k>;
322		clock-names = "lpo";
323	};
324};
325
326&uart_AO {
327	status = "okay";
328	pinctrl-0 = <&uart_ao_a_pins>;
329	pinctrl-names = "default";
330};
331
332&usb {
333	status = "okay";
334	dr_mode = "host";
335};
336
337/* SDIO */
338&sd_emmc_a {
339	status = "okay";
340	pinctrl-0 = <&sdio_pins>;
341	pinctrl-1 = <&sdio_clk_gate_pins>;
342	pinctrl-names = "default", "clk-gate";
343	#address-cells = <1>;
344	#size-cells = <0>;
345
346	bus-width = <4>;
347	cap-sd-highspeed;
348	sd-uhs-sdr50;
349	max-frequency = <100000000>;
350
351	non-removable;
352	disable-wp;
353
354	mmc-pwrseq = <&sdio_pwrseq>;
355
356	vmmc-supply = <&vddao_3v3>;
357	vqmmc-supply = <&vddao_1v8>;
358
359	brcmf: wifi@1 {
360		reg = <1>;
361		compatible = "brcm,bcm4329-fmac";
362	};
363};
364
365/* SD card */
366&sd_emmc_b {
367	status = "okay";
368	pinctrl-0 = <&sdcard_c_pins>;
369	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
370	pinctrl-names = "default", "clk-gate";
371
372	bus-width = <4>;
373	cap-sd-highspeed;
374	max-frequency = <100000000>;
375	disable-wp;
376
377	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
378	vmmc-supply = <&vddao_3v3>;
379	vqmmc-supply = <&vddao_3v3>;
380};
381
382/* eMMC */
383&sd_emmc_c {
384	status = "okay";
385	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
386	pinctrl-1 = <&emmc_clk_gate_pins>;
387	pinctrl-names = "default", "clk-gate";
388
389	bus-width = <8>;
390	cap-mmc-highspeed;
391	max-frequency = <100000000>;
392	non-removable;
393	disable-wp;
394
395	mmc-pwrseq = <&emmc_pwrseq>;
396	vmmc-supply = <&vcc_3v3>;
397	vqmmc-supply = <&flash_1v8>;
398};
399
400&spdifout {
401	pinctrl-0 = <&spdif_out_h_pins>;
402	pinctrl-names = "default";
403	status = "okay";
404};
405
406&spdifout_b {
407	status = "okay";
408};
409
410&tdmif_b {
411	status = "okay";
412};
413
414&tdmout_b {
415	status = "okay";
416};
417
418&tohdmitx {
419	status = "okay";
420};
421