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		reset-assert-us = <10000>;
290		reset-deassert-us = <30000>;
291		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
292
293		interrupt-parent = <&gpio_intc>;
294		/* MAC_INTR on GPIOZ_14 */
295		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
296	};
297};
298
299&ethmac {
300	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
301	pinctrl-names = "default";
302	status = "okay";
303	phy-mode = "rgmii";
304	phy-handle = <&external_phy>;
305	amlogic,tx-delay-ns = <2>;
306};
307
308&pwm_ef {
309	status = "okay";
310	pinctrl-0 = <&pwm_e_pins>;
311	pinctrl-names = "default";
312	clocks = <&xtal>;
313	clock-names = "clkin0";
314};
315
316&uart_A {
317	status = "okay";
318	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
319	pinctrl-names = "default";
320	uart-has-rtscts;
321
322	bluetooth {
323		compatible = "brcm,bcm43438-bt";
324		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
325		max-speed = <2000000>;
326		clocks = <&wifi32k>;
327		clock-names = "lpo";
328	};
329};
330
331&uart_AO {
332	status = "okay";
333	pinctrl-0 = <&uart_ao_a_pins>;
334	pinctrl-names = "default";
335};
336
337&usb {
338	status = "okay";
339	dr_mode = "host";
340};
341
342/* SDIO */
343&sd_emmc_a {
344	status = "okay";
345	pinctrl-0 = <&sdio_pins>;
346	pinctrl-1 = <&sdio_clk_gate_pins>;
347	pinctrl-names = "default", "clk-gate";
348	#address-cells = <1>;
349	#size-cells = <0>;
350
351	bus-width = <4>;
352	cap-sd-highspeed;
353	sd-uhs-sdr50;
354	max-frequency = <100000000>;
355
356	non-removable;
357	disable-wp;
358
359	mmc-pwrseq = <&sdio_pwrseq>;
360
361	vmmc-supply = <&vddao_3v3>;
362	vqmmc-supply = <&vddao_1v8>;
363
364	brcmf: wifi@1 {
365		reg = <1>;
366		compatible = "brcm,bcm4329-fmac";
367	};
368};
369
370/* SD card */
371&sd_emmc_b {
372	status = "okay";
373	pinctrl-0 = <&sdcard_c_pins>;
374	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
375	pinctrl-names = "default", "clk-gate";
376
377	bus-width = <4>;
378	cap-sd-highspeed;
379	max-frequency = <100000000>;
380	disable-wp;
381
382	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
383	vmmc-supply = <&vddao_3v3>;
384	vqmmc-supply = <&vddao_3v3>;
385};
386
387/* eMMC */
388&sd_emmc_c {
389	status = "okay";
390	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
391	pinctrl-1 = <&emmc_clk_gate_pins>;
392	pinctrl-names = "default", "clk-gate";
393
394	bus-width = <8>;
395	cap-mmc-highspeed;
396	max-frequency = <100000000>;
397	non-removable;
398	disable-wp;
399
400	mmc-pwrseq = <&emmc_pwrseq>;
401	vmmc-supply = <&vcc_3v3>;
402	vqmmc-supply = <&flash_1v8>;
403};
404
405&spdifout {
406	pinctrl-0 = <&spdif_out_h_pins>;
407	pinctrl-names = "default";
408	status = "okay";
409};
410
411&spdifout_b {
412	status = "okay";
413};
414
415&tdmif_b {
416	status = "okay";
417};
418
419&tdmout_b {
420	status = "okay";
421};
422
423&tohdmitx {
424	status = "okay";
425};
426