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
284		dai-link-0 {
285			sound-dai = <&frddr_a>;
286		};
287
288		dai-link-1 {
289			sound-dai = <&frddr_b>;
290		};
291
292		dai-link-2 {
293			sound-dai = <&frddr_c>;
294		};
295
296		dai-link-3 {
297			sound-dai = <&toddr_a>;
298		};
299
300		dai-link-4 {
301			sound-dai = <&toddr_b>;
302		};
303
304		dai-link-5 {
305			sound-dai = <&toddr_c>;
306		};
307
308		dai-link-6 {
309			sound-dai = <&tdmif_c>;
310			dai-format = "i2s";
311			dai-tdm-slot-tx-mask-2 = <1 1>;
312			dai-tdm-slot-rx-mask-1 = <1 1>;
313			mclk-fs = <256>;
314
315			codec-0 {
316				sound-dai = <&lineout>;
317			};
318
319			codec-1 {
320				sound-dai = <&speaker_amp1>;
321			};
322
323			codec-2 {
324				sound-dai = <&linein>;
325			};
326
327		};
328
329		dai-link-7 {
330			sound-dai = <&spdifout>;
331
332			codec {
333				sound-dai = <&spdif_dit>;
334			};
335		};
336
337		dai-link-8 {
338			sound-dai = <&spdifin>;
339
340			codec {
341				sound-dai = <&spdif_dir>;
342			};
343		};
344
345		dai-link-9 {
346			sound-dai = <&pdm>;
347
348			codec {
349				sound-dai = <&dmics>;
350			};
351		};
352	};
353
354	wifi32k: wifi32k {
355		compatible = "pwm-clock";
356		#clock-cells = <0>;
357		clock-frequency = <32768>;
358		pwms = <&pwm_ab 0 30518 0>; /* PWM_A at 32.768KHz */
359	};
360};
361
362&ethmac {
363	status = "okay";
364	pinctrl-0 = <&eth_rgmii_y_pins>;
365	pinctrl-names = "default";
366	phy-handle = <&eth_phy0>;
367	phy-mode = "rgmii";
368
369	mdio {
370		compatible = "snps,dwmac-mdio";
371		#address-cells = <1>;
372		#size-cells = <0>;
373
374		eth_phy0: ethernet-phy@0 {
375			/* Realtek RTL8211F (0x001cc916) */
376			reg = <0>;
377			interrupt-parent = <&gpio_intc>;
378			interrupts = <98 IRQ_TYPE_LEVEL_LOW>;
379			eee-broken-1000t;
380		};
381	};
382};
383
384&frddr_a {
385	status = "okay";
386};
387
388&frddr_b {
389	status = "okay";
390};
391
392&frddr_c {
393	status = "okay";
394};
395
396&ir {
397	status = "okay";
398	pinctrl-0 = <&remote_input_ao_pins>;
399	pinctrl-names = "default";
400};
401
402&i2c1 {
403	status = "okay";
404	pinctrl-0 = <&i2c1_z_pins>;
405	pinctrl-names = "default";
406
407	speaker_amp1: audio-codec@1b {
408		compatible = "ti,tas5707";
409		reg = <0x1b>;
410		reset-gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>;
411		#sound-dai-cells = <0>;
412		AVDD-supply = <&vcc_3v3>;
413		DVDD-supply = <&vcc_3v3>;
414		PVDD_A-supply = <&main_12v>;
415		PVDD_B-supply = <&main_12v>;
416		PVDD_C-supply = <&main_12v>;
417		PVDD_D-supply = <&main_12v>;
418		sound-name-prefix = "SPK1";
419	};
420};
421
422&i2c_AO {
423	status = "okay";
424	pinctrl-0 = <&i2c_ao_sck_10_pins>, <&i2c_ao_sda_11_pins>;
425	pinctrl-names = "default";
426
427	gpio_speaker: gpio-controller@1f {
428		compatible = "nxp,pca9557";
429		reg = <0x1f>;
430		gpio-controller;
431		#gpio-cells = <2>;
432		vcc-supply = <&vddao_3v3>;
433	};
434};
435
436&pdm {
437	pinctrl-0 = <&pdm_dclk_a14_pins>, <&pdm_din0_pins>,
438		    <&pdm_din1_pins>, <&pdm_din2_pins>, <&pdm_din3_pins>;
439	pinctrl-names = "default";
440	status = "okay";
441};
442
443&pcieA {
444	reset-gpios = <&gpio GPIOX_19 GPIO_ACTIVE_LOW>;
445	status = "okay";
446};
447
448&pcieB {
449	reset-gpios = <&gpio GPIOZ_10 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
450	status = "okay";
451};
452
453&pwm_ab {
454	status = "okay";
455	pinctrl-0 = <&pwm_a_x20_pins>;
456	pinctrl-names = "default";
457};
458
459&saradc {
460	status = "okay";
461	vref-supply = <&vddio_ao18>;
462};
463
464/* wifi module */
465&sd_emmc_b {
466	status = "okay";
467	#address-cells = <1>;
468	#size-cells = <0>;
469
470	pinctrl-0 = <&sdio_pins>;
471	pinctrl-1 = <&sdio_clk_gate_pins>;
472	pinctrl-names = "default", "clk-gate";
473
474	bus-width = <4>;
475	cap-sd-highspeed;
476	sd-uhs-sdr104;
477	max-frequency = <200000000>;
478	non-removable;
479	disable-wp;
480
481	mmc-pwrseq = <&sdio_pwrseq>;
482
483	vmmc-supply = <&vddao_3v3>;
484	vqmmc-supply = <&vddio_boot>;
485
486	brcmf: wifi@1 {
487		reg = <1>;
488		compatible = "brcm,bcm4329-fmac";
489	};
490};
491
492/* emmc storage */
493&sd_emmc_c {
494	status = "okay";
495	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
496	pinctrl-1 = <&emmc_clk_gate_pins>;
497	pinctrl-names = "default", "clk-gate";
498
499	bus-width = <8>;
500	cap-mmc-highspeed;
501	max-frequency = <200000000>;
502	non-removable;
503	disable-wp;
504	mmc-ddr-1_8v;
505	mmc-hs200-1_8v;
506
507	mmc-pwrseq = <&emmc_pwrseq>;
508
509	vmmc-supply = <&vcc_3v3>;
510	vqmmc-supply = <&vddio_boot>;
511};
512
513&spdifin {
514	pinctrl-0 = <&spdif_in_a19_pins>;
515	pinctrl-names = "default";
516	status = "okay";
517};
518
519&spdifout {
520	pinctrl-0 = <&spdif_out_a20_pins>;
521	pinctrl-names = "default";
522	status = "okay";
523};
524
525&tdmif_a {
526	pinctrl-0 = <&tdma_sclk_pins>, <&tdma_fs_pins>,
527		    <&tdma_din0_pins>, <&tdma_dout0_x15_pins>;
528	pinctrl-names = "default";
529	status = "okay";
530};
531
532&tdmif_b {
533	pinctrl-0 = <&tdmb_sclk_pins>, <&tdmb_fs_pins>,
534		    <&tdmb_din3_pins>, <&mclk_b_pins>;
535	pinctrl-names = "default";
536	status = "okay";
537};
538
539&tdmif_c {
540	pinctrl-0 = <&tdmc_sclk_pins>, <&tdmc_fs_pins>,
541		    <&tdmc_din1_pins>, <&tdmc_dout2_pins>,
542		    <&mclk_c_pins>;
543	pinctrl-names = "default";
544	status = "okay";
545};
546
547&tdmin_a {
548	status = "okay";
549};
550
551&tdmin_b {
552	status = "okay";
553};
554
555&tdmin_c {
556	status = "okay";
557};
558
559&tdmin_lb {
560	status = "okay";
561};
562
563&tdmout_c {
564	status = "okay";
565};
566
567&toddr_a {
568	status = "okay";
569};
570
571&toddr_b {
572	status = "okay";
573};
574
575&toddr_c {
576	status = "okay";
577};
578
579&uart_A {
580	status = "okay";
581	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
582	pinctrl-names = "default";
583	uart-has-rtscts;
584
585	bluetooth {
586		compatible = "brcm,bcm43438-bt";
587		shutdown-gpios = <&gpio GPIOX_21 GPIO_ACTIVE_HIGH>;
588	};
589};
590
591&uart_AO {
592	status = "okay";
593	pinctrl-0 = <&uart_ao_a_pins>;
594	pinctrl-names = "default";
595};
596
597&usb {
598	status = "okay";
599	dr_mode = "otg";
600	vbus-supply = <&usb_pwr>;
601};
602