1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 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/input/input.h>
11#include <dt-bindings/gpio/meson-g12a-gpio.h>
12#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
13
14/ {
15	compatible = "seirobotics,sei510", "amlogic,g12a";
16	model = "SEI Robotics SEI510";
17
18	adc_keys {
19		compatible = "adc-keys";
20		io-channels = <&saradc 0>;
21		io-channel-names = "buttons";
22		keyup-threshold-microvolt = <1800000>;
23
24		button-onoff {
25			label = "On/Off";
26			linux,code = <KEY_POWER>;
27			press-threshold-microvolt = <1700000>;
28		};
29	};
30
31	aliases {
32		serial0 = &uart_AO;
33		ethernet0 = &ethmac;
34	};
35
36	mono_dac: audio-codec-0 {
37		compatible = "maxim,max98357a";
38		#sound-dai-cells = <0>;
39		sound-name-prefix = "U16";
40		sdmode-gpios = <&gpio GPIOX_8 GPIO_ACTIVE_HIGH>;
41	};
42
43	dmics: audio-codec-1 {
44		#sound-dai-cells = <0>;
45		compatible = "dmic-codec";
46		num-channels = <2>;
47		wakeup-delay-ms = <50>;
48		status = "okay";
49		sound-name-prefix = "MIC";
50	};
51
52	chosen {
53		stdout-path = "serial0:115200n8";
54	};
55
56	cvbs-connector {
57		compatible = "composite-video-connector";
58
59		port {
60			cvbs_connector_in: endpoint {
61				remote-endpoint = <&cvbs_vdac_out>;
62			};
63		};
64	};
65
66	emmc_pwrseq: emmc-pwrseq {
67		compatible = "mmc-pwrseq-emmc";
68		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
69	};
70
71	hdmi-connector {
72		compatible = "hdmi-connector";
73		type = "a";
74
75		port {
76			hdmi_connector_in: endpoint {
77				remote-endpoint = <&hdmi_tx_tmds_out>;
78			};
79		};
80	};
81
82	memory@0 {
83		device_type = "memory";
84		reg = <0x0 0x0 0x0 0x40000000>;
85	};
86
87	ao_5v: regulator-ao_5v {
88		compatible = "regulator-fixed";
89		regulator-name = "AO_5V";
90		regulator-min-microvolt = <5000000>;
91		regulator-max-microvolt = <5000000>;
92		vin-supply = <&dc_in>;
93		regulator-always-on;
94	};
95
96	dc_in: regulator-dc_in {
97		compatible = "regulator-fixed";
98		regulator-name = "DC_IN";
99		regulator-min-microvolt = <5000000>;
100		regulator-max-microvolt = <5000000>;
101		regulator-always-on;
102	};
103
104	emmc_1v8: regulator-emmc_1v8 {
105		compatible = "regulator-fixed";
106		regulator-name = "EMMC_1V8";
107		regulator-min-microvolt = <1800000>;
108		regulator-max-microvolt = <1800000>;
109		vin-supply = <&vddao_3v3>;
110		regulator-always-on;
111	};
112
113	vddao_3v3: regulator-vddao_3v3 {
114		compatible = "regulator-fixed";
115		regulator-name = "VDDAO_3V3";
116		regulator-min-microvolt = <3300000>;
117		regulator-max-microvolt = <3300000>;
118		vin-supply = <&dc_in>;
119		regulator-always-on;
120	};
121
122	vddao_3v3_t: regultor-vddao_3v3_t {
123		compatible = "regulator-fixed";
124		regulator-name = "VDDAO_3V3_T";
125		regulator-min-microvolt = <3300000>;
126		regulator-max-microvolt = <3300000>;
127		vin-supply = <&vddao_3v3>;
128		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
129		enable-active-high;
130	};
131
132	vddcpu: regulator-vddcpu {
133		/*
134		 * SY8120B1ABC DC/DC Regulator.
135		 */
136		compatible = "pwm-regulator";
137
138		regulator-name = "VDDCPU";
139		regulator-min-microvolt = <721000>;
140		regulator-max-microvolt = <1022000>;
141
142		pwm-supply = <&dc_in>;
143
144		pwms = <&pwm_AO_cd 1 1250 0>;
145		pwm-dutycycle-range = <100 0>;
146
147		regulator-boot-on;
148		regulator-always-on;
149	};
150
151	vddio_ao1v8: regulator-vddio_ao1v8 {
152		compatible = "regulator-fixed";
153		regulator-name = "VDDIO_AO1V8";
154		regulator-min-microvolt = <1800000>;
155		regulator-max-microvolt = <1800000>;
156		vin-supply = <&vddao_3v3>;
157		regulator-always-on;
158	};
159
160	sdio_pwrseq: sdio-pwrseq {
161		compatible = "mmc-pwrseq-simple";
162		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
163		clocks = <&wifi32k>;
164		clock-names = "ext_clock";
165	};
166
167	wifi32k: wifi32k {
168		compatible = "pwm-clock";
169		#clock-cells = <0>;
170		clock-frequency = <32768>;
171		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
172	};
173
174	sound {
175		compatible = "amlogic,axg-sound-card";
176		model = "SEI510";
177		audio-aux-devs = <&tdmout_a>, <&tdmout_b>,
178				 <&tdmin_a>, <&tdmin_b>;
179		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
180				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
181				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
182				"TDM_A Playback", "TDMOUT_A OUT",
183				"TDMOUT_B IN 0", "FRDDR_A OUT 1",
184				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
185				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
186				"TDM_B Playback", "TDMOUT_B OUT",
187				"TODDR_A IN 4", "PDM Capture",
188				"TODDR_B IN 4", "PDM Capture",
189				"TODDR_C IN 4", "PDM Capture",
190				"TDMIN_A IN 0", "TDM_A Capture",
191				"TDMIN_A IN 3", "TDM_A Loopback",
192				"TDMIN_B IN 0", "TDM_A Capture",
193				"TDMIN_B IN 3", "TDM_A Loopback",
194				"TDMIN_A IN 1", "TDM_B Capture",
195				"TDMIN_A IN 4", "TDM_B Loopback",
196				"TDMIN_B IN 1", "TDM_B Capture",
197				"TDMIN_B IN 4", "TDM_B Loopback",
198				"TODDR_A IN 0", "TDMIN_A OUT",
199				"TODDR_B IN 0", "TDMIN_A OUT",
200				"TODDR_C IN 0", "TDMIN_A OUT",
201				"TODDR_A IN 1", "TDMIN_B OUT",
202				"TODDR_B IN 1", "TDMIN_B OUT",
203				"TODDR_C IN 1", "TDMIN_B OUT";
204
205		assigned-clocks = <&clkc CLKID_MPLL2>,
206				  <&clkc CLKID_MPLL0>,
207				  <&clkc CLKID_MPLL1>;
208		assigned-clock-parents = <0>, <0>, <0>;
209		assigned-clock-rates = <294912000>,
210				       <270950400>,
211				       <393216000>;
212
213		dai-link-0 {
214			sound-dai = <&frddr_a>;
215		};
216
217		dai-link-1 {
218			sound-dai = <&frddr_b>;
219		};
220
221		dai-link-2 {
222			sound-dai = <&frddr_c>;
223		};
224
225		dai-link-3 {
226			sound-dai = <&toddr_a>;
227		};
228
229		dai-link-4 {
230			sound-dai = <&toddr_b>;
231		};
232
233		dai-link-5 {
234			sound-dai = <&toddr_c>;
235		};
236
237		/* internal speaker interface */
238		dai-link-6 {
239			sound-dai = <&tdmif_a>;
240			dai-format = "i2s";
241			dai-tdm-slot-tx-mask-0 = <1 1>;
242			mclk-fs = <256>;
243
244			codec-0 {
245				sound-dai = <&mono_dac>;
246			};
247
248			codec-1 {
249				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
250			};
251		};
252
253		/* 8ch hdmi interface */
254		dai-link-7 {
255			sound-dai = <&tdmif_b>;
256			dai-format = "i2s";
257			dai-tdm-slot-tx-mask-0 = <1 1>;
258			dai-tdm-slot-tx-mask-1 = <1 1>;
259			dai-tdm-slot-tx-mask-2 = <1 1>;
260			dai-tdm-slot-tx-mask-3 = <1 1>;
261			mclk-fs = <256>;
262
263			codec {
264				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
265			};
266		};
267
268		/* internal digital mics */
269		dai-link-8 {
270			sound-dai = <&pdm>;
271
272			codec {
273				sound-dai = <&dmics>;
274			};
275		};
276
277		/* hdmi glue */
278		dai-link-9 {
279			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
280
281			codec {
282				sound-dai = <&hdmi_tx>;
283			};
284		};
285	};
286};
287
288&arb {
289	status = "okay";
290};
291
292&cec_AO {
293	pinctrl-0 = <&cec_ao_a_h_pins>;
294	pinctrl-names = "default";
295	status = "disabled";
296	hdmi-phandle = <&hdmi_tx>;
297};
298
299&cecb_AO {
300	pinctrl-0 = <&cec_ao_b_h_pins>;
301	pinctrl-names = "default";
302	status = "okay";
303	hdmi-phandle = <&hdmi_tx>;
304};
305
306&clkc_audio {
307	status = "okay";
308};
309
310&cpu0 {
311	cpu-supply = <&vddcpu>;
312	operating-points-v2 = <&cpu_opp_table>;
313	clocks = <&clkc CLKID_CPU_CLK>;
314	clock-latency = <50000>;
315};
316
317&cpu1 {
318	cpu-supply = <&vddcpu>;
319	operating-points-v2 = <&cpu_opp_table>;
320	clocks = <&clkc CLKID_CPU_CLK>;
321	clock-latency = <50000>;
322};
323
324&cpu2 {
325	cpu-supply = <&vddcpu>;
326	operating-points-v2 = <&cpu_opp_table>;
327	clocks = <&clkc CLKID_CPU_CLK>;
328	clock-latency = <50000>;
329};
330
331&cpu3 {
332	cpu-supply = <&vddcpu>;
333	operating-points-v2 = <&cpu_opp_table>;
334	clocks = <&clkc CLKID_CPU_CLK>;
335	clock-latency = <50000>;
336};
337
338&cvbs_vdac_port {
339	cvbs_vdac_out: endpoint {
340		remote-endpoint = <&cvbs_connector_in>;
341	};
342};
343
344&ethmac {
345	status = "okay";
346	phy-handle = <&internal_ephy>;
347	phy-mode = "rmii";
348};
349
350&frddr_a {
351	status = "okay";
352};
353
354&frddr_b {
355	status = "okay";
356};
357
358&frddr_c {
359	status = "okay";
360};
361
362&hdmi_tx {
363	status = "okay";
364	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
365	pinctrl-names = "default";
366};
367
368&hdmi_tx_tmds_port {
369	hdmi_tx_tmds_out: endpoint {
370		remote-endpoint = <&hdmi_connector_in>;
371	};
372};
373
374&i2c3 {
375	status = "okay";
376	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
377	pinctrl-names = "default";
378};
379
380&ir {
381	status = "okay";
382	pinctrl-0 = <&remote_input_ao_pins>;
383	pinctrl-names = "default";
384};
385
386&pwm_AO_cd {
387	pinctrl-0 = <&pwm_ao_d_e_pins>;
388	pinctrl-names = "default";
389	clocks = <&xtal>;
390	clock-names = "clkin1";
391	status = "okay";
392};
393
394&pwm_ef {
395	status = "okay";
396	pinctrl-0 = <&pwm_e_pins>;
397	pinctrl-names = "default";
398	clocks = <&xtal>;
399	clock-names = "clkin0";
400};
401
402&pdm {
403	pinctrl-0 = <&pdm_din0_z_pins>, <&pdm_din1_z_pins>,
404		    <&pdm_din2_z_pins>, <&pdm_din3_z_pins>,
405		    <&pdm_dclk_z_pins>;
406	pinctrl-names = "default";
407	status = "okay";
408};
409
410&saradc {
411	status = "okay";
412	vref-supply = <&vddio_ao1v8>;
413};
414
415/* SDIO */
416&sd_emmc_a {
417	status = "okay";
418	pinctrl-0 = <&sdio_pins>;
419	pinctrl-1 = <&sdio_clk_gate_pins>;
420	pinctrl-names = "default", "clk-gate";
421	#address-cells = <1>;
422	#size-cells = <0>;
423
424	bus-width = <4>;
425	cap-sd-highspeed;
426	sd-uhs-sdr50;
427	max-frequency = <100000000>;
428
429	non-removable;
430	disable-wp;
431
432	/* WiFi firmware requires power to be kept while in suspend */
433	keep-power-in-suspend;
434
435	mmc-pwrseq = <&sdio_pwrseq>;
436
437	vmmc-supply = <&vddao_3v3>;
438	vqmmc-supply = <&vddio_ao1v8>;
439
440	brcmf: wifi@1 {
441		reg = <1>;
442		compatible = "brcm,bcm4329-fmac";
443	};
444};
445
446/* SD card */
447&sd_emmc_b {
448	status = "okay";
449	pinctrl-0 = <&sdcard_c_pins>;
450	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
451	pinctrl-names = "default", "clk-gate";
452
453	bus-width = <4>;
454	cap-sd-highspeed;
455	max-frequency = <50000000>;
456	disable-wp;
457
458	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
459	vmmc-supply = <&vddao_3v3>;
460	vqmmc-supply = <&vddao_3v3>;
461};
462
463/* eMMC */
464&sd_emmc_c {
465	status = "okay";
466	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
467	pinctrl-1 = <&emmc_clk_gate_pins>;
468	pinctrl-names = "default", "clk-gate";
469
470	bus-width = <8>;
471	cap-mmc-highspeed;
472	mmc-ddr-1_8v;
473	mmc-hs200-1_8v;
474	max-frequency = <200000000>;
475	non-removable;
476	disable-wp;
477
478	mmc-pwrseq = <&emmc_pwrseq>;
479	vmmc-supply = <&vddao_3v3>;
480	vqmmc-supply = <&emmc_1v8>;
481};
482
483&tdmif_a {
484	pinctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>;
485	pinctrl-names = "default";
486	status = "okay";
487
488	assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD0>,
489			  <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD0>;
490	assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
491				 <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
492	assigned-clock-rates = <0>, <0>;
493};
494
495&tdmif_b {
496	status = "okay";
497};
498
499&tdmin_a {
500	status = "okay";
501};
502
503&tdmin_b {
504	status = "okay";
505};
506
507&tdmout_a {
508	status = "okay";
509};
510
511&tdmout_b {
512	status = "okay";
513};
514
515&toddr_a {
516	status = "okay";
517};
518
519&toddr_b {
520	status = "okay";
521};
522
523&toddr_c {
524	status = "okay";
525};
526
527&tohdmitx {
528	status = "okay";
529};
530
531&uart_A {
532	status = "okay";
533	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
534	pinctrl-names = "default";
535	uart-has-rtscts;
536
537	bluetooth {
538		compatible = "brcm,bcm43438-bt";
539		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
540		max-speed = <2000000>;
541		clocks = <&wifi32k>;
542		clock-names = "lpo";
543		vbat-supply = <&vddao_3v3>;
544		vddio-supply = <&vddio_ao1v8>;
545	};
546};
547
548&uart_AO {
549	status = "okay";
550	pinctrl-0 = <&uart_ao_a_pins>;
551	pinctrl-names = "default";
552};
553
554&usb {
555	status = "okay";
556	dr_mode = "host";
557};
558