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&pwm_ab {
445	status = "okay";
446	pinctrl-0 = <&pwm_a_x20_pins>;
447	pinctrl-names = "default";
448};
449
450&saradc {
451	status = "okay";
452	vref-supply = <&vddio_ao18>;
453};
454
455/* wifi module */
456&sd_emmc_b {
457	status = "okay";
458	#address-cells = <1>;
459	#size-cells = <0>;
460
461	pinctrl-0 = <&sdio_pins>;
462	pinctrl-1 = <&sdio_clk_gate_pins>;
463	pinctrl-names = "default", "clk-gate";
464
465	bus-width = <4>;
466	cap-sd-highspeed;
467	sd-uhs-sdr104;
468	max-frequency = <200000000>;
469	non-removable;
470	disable-wp;
471
472	mmc-pwrseq = <&sdio_pwrseq>;
473
474	vmmc-supply = <&vddao_3v3>;
475	vqmmc-supply = <&vddio_boot>;
476
477	brcmf: wifi@1 {
478		reg = <1>;
479		compatible = "brcm,bcm4329-fmac";
480	};
481};
482
483/* emmc storage */
484&sd_emmc_c {
485	status = "okay";
486	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
487	pinctrl-1 = <&emmc_clk_gate_pins>;
488	pinctrl-names = "default", "clk-gate";
489
490	bus-width = <8>;
491	cap-mmc-highspeed;
492	max-frequency = <200000000>;
493	non-removable;
494	disable-wp;
495	mmc-ddr-1_8v;
496	mmc-hs200-1_8v;
497
498	mmc-pwrseq = <&emmc_pwrseq>;
499
500	vmmc-supply = <&vcc_3v3>;
501	vqmmc-supply = <&vddio_boot>;
502};
503
504&spdifin {
505	pinctrl-0 = <&spdif_in_a19_pins>;
506	pinctrl-names = "default";
507	status = "okay";
508};
509
510&spdifout {
511	pinctrl-0 = <&spdif_out_a20_pins>;
512	pinctrl-names = "default";
513	status = "okay";
514};
515
516&tdmif_a {
517	pinctrl-0 = <&tdma_sclk_pins>, <&tdma_fs_pins>,
518		    <&tdma_din0_pins>, <&tdma_dout0_x15_pins>;
519	pinctrl-names = "default";
520	status = "okay";
521};
522
523&tdmif_b {
524	pinctrl-0 = <&tdmb_sclk_pins>, <&tdmb_fs_pins>,
525		    <&tdmb_din3_pins>, <&mclk_b_pins>;
526	pinctrl-names = "default";
527	status = "okay";
528};
529
530&tdmif_c {
531	pinctrl-0 = <&tdmc_sclk_pins>, <&tdmc_fs_pins>,
532		    <&tdmc_din1_pins>, <&tdmc_dout2_pins>,
533		    <&mclk_c_pins>;
534	pinctrl-names = "default";
535	status = "okay";
536};
537
538&tdmin_a {
539	status = "okay";
540};
541
542&tdmin_b {
543	status = "okay";
544};
545
546&tdmin_c {
547	status = "okay";
548};
549
550&tdmin_lb {
551	status = "okay";
552};
553
554&tdmout_c {
555	status = "okay";
556};
557
558&toddr_a {
559	status = "okay";
560};
561
562&toddr_b {
563	status = "okay";
564};
565
566&toddr_c {
567	status = "okay";
568};
569
570&uart_A {
571	status = "okay";
572	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
573	pinctrl-names = "default";
574	uart-has-rtscts;
575
576	bluetooth {
577		compatible = "brcm,bcm43438-bt";
578		shutdown-gpios = <&gpio GPIOX_21 GPIO_ACTIVE_HIGH>;
579	};
580};
581
582&uart_AO {
583	status = "okay";
584	pinctrl-0 = <&uart_ao_a_pins>;
585	pinctrl-names = "default";
586};
587