1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2017 Amlogic, Inc. All rights reserved.
4 */
5
6/dts-v1/;
7
8#include "meson-axg.dtsi"
9#include <dt-bindings/input/input.h>
10
11/ {
12	compatible = "amlogic,s400", "amlogic,a113d", "amlogic,meson-axg";
13	model = "Amlogic Meson AXG S400 Development Board";
14
15	adc_keys {
16		compatible = "adc-keys";
17		io-channels = <&saradc 0>;
18		io-channel-names = "buttons";
19		keyup-threshold-microvolt = <1800000>;
20
21		button-next {
22			label = "Next";
23			linux,code = <KEY_NEXT>;
24			press-threshold-microvolt = <1116000>; /* 62% */
25		};
26
27		button-prev {
28			label = "Previous";
29			linux,code = <KEY_PREVIOUS>;
30			press-threshold-microvolt = <900000>; /* 50% */
31		};
32
33		button-wifi {
34			label = "Wifi";
35			linux,code = <KEY_WLAN>;
36			press-threshold-microvolt = <684000>; /* 38% */
37		};
38
39		button-up {
40			label = "Volume Up";
41			linux,code = <KEY_VOLUMEUP>;
42			press-threshold-microvolt = <468000>; /* 26% */
43		};
44
45		button-down {
46			label = "Volume Down";
47			linux,code = <KEY_VOLUMEDOWN>;
48			press-threshold-microvolt = <252000>; /* 14% */
49		};
50
51		button-voice {
52			label = "Voice";
53			linux,code = <KEY_VOICECOMMAND>;
54			press-threshold-microvolt = <0>; /* 0% */
55		};
56	};
57
58	aliases {
59		serial0 = &uart_AO;
60		serial1 = &uart_A;
61	};
62
63	linein: audio-codec-0 {
64		#sound-dai-cells = <0>;
65		compatible = "everest,es7241";
66		VDDA-supply = <&vcc_3v3>;
67		VDDP-supply = <&vcc_3v3>;
68		VDDD-supply = <&vcc_3v3>;
69		status = "okay";
70		sound-name-prefix = "Linein";
71	};
72
73	lineout: audio-codec-1 {
74		#sound-dai-cells = <0>;
75		compatible = "everest,es7154";
76		VDD-supply = <&vcc_3v3>;
77		PVDD-supply = <&vcc_5v>;
78		status = "okay";
79		sound-name-prefix = "Lineout";
80	};
81
82	spdif_dit: audio-codec-2 {
83		#sound-dai-cells = <0>;
84		compatible = "linux,spdif-dit";
85		status = "okay";
86		sound-name-prefix = "DIT";
87	};
88
89	dmics: audio-codec-3 {
90		#sound-dai-cells = <0>;
91		compatible = "dmic-codec";
92		num-channels = <7>;
93		wakeup-delay-ms = <50>;
94		status = "okay";
95		sound-name-prefix = "MIC";
96	};
97
98	spdif_dir: audio-codec-4 {
99		#sound-dai-cells = <0>;
100		compatible = "linux,spdif-dir";
101		status = "okay";
102		sound-name-prefix = "DIR";
103	};
104
105	emmc_pwrseq: emmc-pwrseq {
106		compatible = "mmc-pwrseq-emmc";
107		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
108	};
109
110	chosen {
111		stdout-path = "serial0:115200n8";
112	};
113
114	memory@0 {
115		device_type = "memory";
116		reg = <0x0 0x0 0x0 0x40000000>;
117	};
118
119	main_12v: regulator-main_12v {
120		compatible = "regulator-fixed";
121		regulator-name = "12V";
122		regulator-min-microvolt = <12000000>;
123		regulator-max-microvolt = <12000000>;
124		regulator-always-on;
125	};
126
127	vcc_3v3: regulator-vcc_3v3 {
128		compatible = "regulator-fixed";
129		regulator-name = "VCC_3V3";
130		regulator-min-microvolt = <3300000>;
131		regulator-max-microvolt = <3300000>;
132		vin-supply = <&vddao_3v3>;
133		regulator-always-on;
134	};
135
136	vcc_5v: regulator-vcc_5v {
137		compatible = "regulator-fixed";
138		regulator-name = "VCC5V";
139		regulator-min-microvolt = <5000000>;
140		regulator-max-microvolt = <5000000>;
141		vin-supply = <&main_12v>;
142
143		gpio = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
144		enable-active-high;
145	};
146
147	vddao_3v3: regulator-vddao_3v3 {
148		compatible = "regulator-fixed";
149		regulator-name = "VDDAO_3V3";
150		regulator-min-microvolt = <3300000>;
151		regulator-max-microvolt = <3300000>;
152		vin-supply = <&main_12v>;
153		regulator-always-on;
154	};
155
156	vddio_ao18: regulator-vddio_ao18 {
157		compatible = "regulator-fixed";
158		regulator-name = "VDDIO_AO18";
159		regulator-min-microvolt = <1800000>;
160		regulator-max-microvolt = <1800000>;
161		vin-supply = <&vddao_3v3>;
162		regulator-always-on;
163	};
164
165	vddio_boot: regulator-vddio_boot {
166		compatible = "regulator-fixed";
167		regulator-name = "VDDIO_BOOT";
168		regulator-min-microvolt = <1800000>;
169		regulator-max-microvolt = <1800000>;
170		vin-supply = <&vddao_3v3>;
171		regulator-always-on;
172	};
173
174	usb_pwr: regulator-usb_pwr {
175		compatible = "regulator-fixed";
176		regulator-name = "USB_PWR";
177		regulator-min-microvolt = <5000000>;
178		regulator-max-microvolt = <5000000>;
179		vin-supply = <&vcc_5v>;
180
181		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
182		enable-active-high;
183	};
184
185	sdio_pwrseq: sdio-pwrseq {
186		compatible = "mmc-pwrseq-simple";
187		reset-gpios = <&gpio GPIOX_7 GPIO_ACTIVE_LOW>;
188		clocks = <&wifi32k>;
189		clock-names = "ext_clock";
190	};
191
192	speaker-leds {
193		compatible = "gpio-leds";
194
195		aled1 {
196			label = "speaker:aled1";
197			gpios = <&gpio_speaker 7 0>;
198		};
199
200		aled2 {
201			label = "speaker:aled2";
202			gpios = <&gpio_speaker 6 0>;
203		};
204
205		aled3 {
206			label = "speaker:aled3";
207			gpios = <&gpio_speaker 5 0>;
208		};
209
210		aled4 {
211			label = "speaker:aled4";
212			gpios = <&gpio_speaker 4 0>;
213		};
214
215		aled5 {
216			label = "speaker:aled5";
217			gpios = <&gpio_speaker 3 0>;
218		};
219
220		aled6 {
221			label = "speaker:aled6";
222			gpios = <&gpio_speaker 2 0>;
223		};
224	};
225
226	sound {
227		compatible = "amlogic,axg-sound-card";
228		model = "AXG-S400";
229		audio-aux-devs = <&tdmin_a>, <&tdmin_b>,  <&tdmin_c>,
230				 <&tdmin_lb>, <&tdmout_c>;
231		audio-widgets = "Line", "Lineout",
232				"Line", "Linein",
233				"Speaker", "Speaker1 Left",
234				"Speaker", "Speaker1 Right";
235		audio-routing = "TDMOUT_C IN 0", "FRDDR_A OUT 2",
236				"SPDIFOUT IN 0", "FRDDR_A OUT 3",
237				"TDMOUT_C IN 1", "FRDDR_B OUT 2",
238				"SPDIFOUT IN 1", "FRDDR_B OUT 3",
239				"TDMOUT_C IN 2", "FRDDR_C OUT 2",
240				"SPDIFOUT IN 2", "FRDDR_C OUT 3",
241				"TDM_C Playback", "TDMOUT_C OUT",
242				"TDMIN_A IN 2", "TDM_C Capture",
243				"TDMIN_A IN 5", "TDM_C Loopback",
244				"TDMIN_B IN 2", "TDM_C Capture",
245				"TDMIN_B IN 5", "TDM_C Loopback",
246				"TDMIN_C IN 2", "TDM_C Capture",
247				"TDMIN_C IN 5", "TDM_C Loopback",
248				"TDMIN_LB IN 2", "TDM_C Loopback",
249				"TDMIN_LB IN 5", "TDM_C Capture",
250				"TODDR_A IN 0", "TDMIN_A OUT",
251				"TODDR_B IN 0", "TDMIN_A OUT",
252				"TODDR_C IN 0", "TDMIN_A OUT",
253				"TODDR_A IN 1", "TDMIN_B OUT",
254				"TODDR_B IN 1", "TDMIN_B OUT",
255				"TODDR_C IN 1", "TDMIN_B OUT",
256				"TODDR_A IN 2", "TDMIN_C OUT",
257				"TODDR_B IN 2", "TDMIN_C OUT",
258				"TODDR_C IN 2", "TDMIN_C OUT",
259				"TODDR_A IN 3", "SPDIFIN Capture",
260				"TODDR_B IN 3", "SPDIFIN Capture",
261				"TODDR_C IN 3", "SPDIFIN Capture",
262				"TODDR_A IN 4", "PDM Capture",
263				"TODDR_B IN 4", "PDM Capture",
264				"TODDR_C IN 4", "PDM Capture",
265				"TODDR_A IN 6", "TDMIN_LB OUT",
266				"TODDR_B IN 6", "TDMIN_LB OUT",
267				"TODDR_C IN 6", "TDMIN_LB OUT",
268				"Lineout", "Lineout AOUTL",
269				"Lineout", "Lineout AOUTR",
270				"Speaker1 Left", "SPK1 OUT_A",
271				"Speaker1 Left", "SPK1 OUT_B",
272				"Speaker1 Right", "SPK1 OUT_C",
273				"Speaker1 Right", "SPK1 OUT_D",
274				"Linein AINL", "Linein",
275				"Linein AINR", "Linein";
276		assigned-clocks = <&clkc CLKID_HIFI_PLL>,
277				  <&clkc CLKID_MPLL0>,
278				  <&clkc CLKID_MPLL1>;
279		assigned-clock-parents = <0>, <0>, <0>;
280		assigned-clock-rates = <589824000>,
281				       <270950400>,
282				       <393216000>;
283		status = "okay";
284
285		dai-link-0 {
286			sound-dai = <&frddr_a>;
287		};
288
289		dai-link-1 {
290			sound-dai = <&frddr_b>;
291		};
292
293		dai-link-2 {
294			sound-dai = <&frddr_c>;
295		};
296
297		dai-link-3 {
298			sound-dai = <&toddr_a>;
299		};
300
301		dai-link-4 {
302			sound-dai = <&toddr_b>;
303		};
304
305		dai-link-5 {
306			sound-dai = <&toddr_c>;
307		};
308
309		dai-link-6 {
310			sound-dai = <&tdmif_c>;
311			dai-format = "i2s";
312			dai-tdm-slot-tx-mask-2 = <1 1>;
313			dai-tdm-slot-rx-mask-1 = <1 1>;
314			mclk-fs = <256>;
315
316			codec-0 {
317				sound-dai = <&lineout>;
318			};
319
320			codec-1 {
321				sound-dai = <&speaker_amp1>;
322			};
323
324			codec-2 {
325				sound-dai = <&linein>;
326			};
327
328		};
329
330		dai-link-7 {
331			sound-dai = <&spdifout>;
332
333			codec {
334				sound-dai = <&spdif_dit>;
335			};
336		};
337
338		dai-link-8 {
339			sound-dai = <&spdifin>;
340
341			codec {
342				sound-dai = <&spdif_dir>;
343			};
344		};
345
346		dai-link-9 {
347			sound-dai = <&pdm>;
348
349			codec {
350				sound-dai = <&dmics>;
351			};
352		};
353	};
354
355	wifi32k: wifi32k {
356		compatible = "pwm-clock";
357		#clock-cells = <0>;
358		clock-frequency = <32768>;
359		pwms = <&pwm_ab 0 30518 0>; /* PWM_A at 32.768KHz */
360	};
361};
362
363&ethmac {
364	status = "okay";
365	pinctrl-0 = <&eth_rgmii_y_pins>;
366	pinctrl-names = "default";
367	phy-handle = <&eth_phy0>;
368	phy-mode = "rgmii";
369
370	mdio {
371		compatible = "snps,dwmac-mdio";
372		#address-cells = <1>;
373		#size-cells = <0>;
374
375		eth_phy0: ethernet-phy@0 {
376			/* Realtek RTL8211F (0x001cc916) */
377			reg = <0>;
378			interrupt-parent = <&gpio_intc>;
379			interrupts = <98 IRQ_TYPE_LEVEL_LOW>;
380			eee-broken-1000t;
381		};
382	};
383};
384
385&frddr_a {
386	status = "okay";
387};
388
389&frddr_b {
390	status = "okay";
391};
392
393&frddr_c {
394	status = "okay";
395};
396
397&ir {
398	status = "okay";
399	pinctrl-0 = <&remote_input_ao_pins>;
400	pinctrl-names = "default";
401};
402
403&i2c1 {
404	status = "okay";
405	pinctrl-0 = <&i2c1_z_pins>;
406	pinctrl-names = "default";
407
408	speaker_amp1: audio-codec@1b {
409		compatible = "ti,tas5707";
410		reg = <0x1b>;
411		reset-gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
412		#sound-dai-cells = <0>;
413		AVDD-supply = <&vcc_3v3>;
414		DVDD-supply = <&vcc_3v3>;
415		PVDD_A-supply = <&main_12v>;
416		PVDD_B-supply = <&main_12v>;
417		PVDD_C-supply = <&main_12v>;
418		PVDD_D-supply = <&main_12v>;
419		sound-name-prefix = "SPK1";
420	};
421};
422
423&i2c_AO {
424	status = "okay";
425	pinctrl-0 = <&i2c_ao_sck_10_pins>, <&i2c_ao_sda_11_pins>;
426	pinctrl-names = "default";
427
428	gpio_speaker: gpio-controller@1f {
429		compatible = "nxp,pca9557";
430		reg = <0x1f>;
431		gpio-controller;
432		#gpio-cells = <2>;
433		vcc-supply = <&vddao_3v3>;
434	};
435};
436
437&pdm {
438	pinctrl-0 = <&pdm_dclk_a14_pins>, <&pdm_din0_pins>,
439		    <&pdm_din1_pins>, <&pdm_din2_pins>, <&pdm_din3_pins>;
440	pinctrl-names = "default";
441	status = "okay";
442};
443
444&pcieA {
445	reset-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_LOW>;
446	status = "okay";
447};
448
449&pcieB {
450	reset-gpios = <&gpio GPIOZ_10 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
451	status = "okay";
452};
453
454&pwm_ab {
455	status = "okay";
456	pinctrl-0 = <&pwm_a_x20_pins>;
457	pinctrl-names = "default";
458};
459
460&saradc {
461	status = "okay";
462	vref-supply = <&vddio_ao18>;
463};
464
465/* wifi module */
466&sd_emmc_b {
467	status = "okay";
468	#address-cells = <1>;
469	#size-cells = <0>;
470
471	pinctrl-0 = <&sdio_pins>;
472	pinctrl-1 = <&sdio_clk_gate_pins>;
473	pinctrl-names = "default", "clk-gate";
474
475	bus-width = <4>;
476	cap-sd-highspeed;
477	sd-uhs-sdr104;
478	max-frequency = <200000000>;
479	non-removable;
480	disable-wp;
481
482	mmc-pwrseq = <&sdio_pwrseq>;
483
484	vmmc-supply = <&vddao_3v3>;
485	vqmmc-supply = <&vddio_boot>;
486
487	brcmf: wifi@1 {
488		reg = <1>;
489		compatible = "brcm,bcm4329-fmac";
490	};
491};
492
493/* emmc storage */
494&sd_emmc_c {
495	status = "okay";
496	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
497	pinctrl-1 = <&emmc_clk_gate_pins>;
498	pinctrl-names = "default", "clk-gate";
499
500	bus-width = <8>;
501	cap-mmc-highspeed;
502	max-frequency = <200000000>;
503	non-removable;
504	disable-wp;
505	mmc-ddr-1_8v;
506	mmc-hs200-1_8v;
507
508	mmc-pwrseq = <&emmc_pwrseq>;
509
510	vmmc-supply = <&vcc_3v3>;
511	vqmmc-supply = <&vddio_boot>;
512};
513
514&spdifin {
515	pinctrl-0 = <&spdif_in_a19_pins>;
516	pinctrl-names = "default";
517	status = "okay";
518};
519
520&spdifout {
521	pinctrl-0 = <&spdif_out_a20_pins>;
522	pinctrl-names = "default";
523	status = "okay";
524};
525
526&tdmif_a {
527	pinctrl-0 = <&tdma_sclk_pins>, <&tdma_fs_pins>,
528		    <&tdma_din0_pins>, <&tdma_dout0_x15_pins>;
529	pinctrl-names = "default";
530	status = "okay";
531};
532
533&tdmif_b {
534	pinctrl-0 = <&tdmb_sclk_pins>, <&tdmb_fs_pins>,
535		    <&tdmb_din3_pins>, <&mclk_b_pins>;
536	pinctrl-names = "default";
537	status = "okay";
538};
539
540&tdmif_c {
541	pinctrl-0 = <&tdmc_sclk_pins>, <&tdmc_fs_pins>,
542		    <&tdmc_din1_pins>, <&tdmc_dout2_pins>,
543		    <&mclk_c_pins>;
544	pinctrl-names = "default";
545	status = "okay";
546};
547
548&tdmin_a {
549	status = "okay";
550};
551
552&tdmin_b {
553	status = "okay";
554};
555
556&tdmin_c {
557	status = "okay";
558};
559
560&tdmin_lb {
561	status = "okay";
562};
563
564&tdmout_c {
565	status = "okay";
566};
567
568&toddr_a {
569	status = "okay";
570};
571
572&toddr_b {
573	status = "okay";
574};
575
576&toddr_c {
577	status = "okay";
578};
579
580&uart_A {
581	status = "okay";
582	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
583	pinctrl-names = "default";
584	uart-has-rtscts;
585
586	bluetooth {
587		compatible = "brcm,bcm43438-bt";
588		shutdown-gpios = <&gpio GPIOX_21 GPIO_ACTIVE_HIGH>;
589	};
590};
591
592&uart_AO {
593	status = "okay";
594	pinctrl-0 = <&uart_ao_a_pins>;
595	pinctrl-names = "default";
596};
597
598&usb {
599	status = "okay";
600	dr_mode = "otg";
601	vbus-supply = <&usb_pwr>;
602};
603