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