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		regulator-always-on;
175	};
176
177	vddcpu: regulator-vddcpu {
178		/*
179		 * SY8120B1ABC DC/DC Regulator.
180		 */
181		compatible = "pwm-regulator";
182
183		regulator-name = "VDDCPU";
184		regulator-min-microvolt = <690000>;
185		regulator-max-microvolt = <1050000>;
186
187		pwm-supply = <&dc_in>;
188
189		pwms = <&pwm_AO_cd 1 1500 0>;
190		pwm-dutycycle-range = <100 0>;
191
192		regulator-boot-on;
193		regulator-always-on;
194	};
195
196	vddio_ao1v8: regulator-vddio_ao1v8 {
197		compatible = "regulator-fixed";
198		regulator-name = "VDDIO_AO1V8";
199		regulator-min-microvolt = <1800000>;
200		regulator-max-microvolt = <1800000>;
201		vin-supply = <&vddao_3v3>;
202		regulator-always-on;
203	};
204
205	sdio_pwrseq: sdio-pwrseq {
206		compatible = "mmc-pwrseq-simple";
207		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
208		clocks = <&wifi32k>;
209		clock-names = "ext_clock";
210	};
211
212	sound {
213		compatible = "amlogic,axg-sound-card";
214		model = "SEI610";
215		audio-aux-devs = <&tdmout_a>, <&tdmout_b>,
216				 <&tdmin_a>, <&tdmin_b>;
217		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
218				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
219				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
220				"TDM_A Playback", "TDMOUT_A OUT",
221				"TDMOUT_B IN 0", "FRDDR_A OUT 1",
222				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
223				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
224				"TDM_B Playback", "TDMOUT_B OUT",
225				"TODDR_A IN 4", "PDM Capture",
226				"TODDR_B IN 4", "PDM Capture",
227				"TODDR_C IN 4", "PDM Capture",
228				"TDMIN_A IN 0", "TDM_A Capture",
229				"TDMIN_A IN 3", "TDM_A Loopback",
230				"TDMIN_B IN 0", "TDM_A Capture",
231				"TDMIN_B IN 3", "TDM_A Loopback",
232				"TDMIN_A IN 1", "TDM_B Capture",
233				"TDMIN_A IN 4", "TDM_B Loopback",
234				"TDMIN_B IN 1", "TDM_B Capture",
235				"TDMIN_B IN 4", "TDM_B Loopback",
236				"TODDR_A IN 0", "TDMIN_A OUT",
237				"TODDR_B IN 0", "TDMIN_A OUT",
238				"TODDR_C IN 0", "TDMIN_A OUT",
239				"TODDR_A IN 1", "TDMIN_B OUT",
240				"TODDR_B IN 1", "TDMIN_B OUT",
241				"TODDR_C IN 1", "TDMIN_B OUT";
242
243		assigned-clocks = <&clkc CLKID_MPLL2>,
244				  <&clkc CLKID_MPLL0>,
245				  <&clkc CLKID_MPLL1>;
246		assigned-clock-parents = <0>, <0>, <0>;
247		assigned-clock-rates = <294912000>,
248				       <270950400>,
249				       <393216000>;
250		status = "okay";
251
252		dai-link-0 {
253			sound-dai = <&frddr_a>;
254		};
255
256		dai-link-1 {
257			sound-dai = <&frddr_b>;
258		};
259
260		dai-link-2 {
261			sound-dai = <&frddr_c>;
262		};
263
264		dai-link-3 {
265			sound-dai = <&toddr_a>;
266		};
267
268		dai-link-4 {
269			sound-dai = <&toddr_b>;
270		};
271
272		dai-link-5 {
273			sound-dai = <&toddr_c>;
274		};
275
276		/* internal speaker interface */
277		dai-link-6 {
278			sound-dai = <&tdmif_a>;
279			dai-format = "i2s";
280			dai-tdm-slot-tx-mask-0 = <1 1>;
281			mclk-fs = <256>;
282
283			codec-0 {
284				sound-dai = <&mono_dac>;
285			};
286
287			codec-1 {
288				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
289			};
290		};
291
292		/* 8ch hdmi interface */
293		dai-link-7 {
294			sound-dai = <&tdmif_b>;
295			dai-format = "i2s";
296			dai-tdm-slot-tx-mask-0 = <1 1>;
297			dai-tdm-slot-tx-mask-1 = <1 1>;
298			dai-tdm-slot-tx-mask-2 = <1 1>;
299			dai-tdm-slot-tx-mask-3 = <1 1>;
300			mclk-fs = <256>;
301
302			codec {
303				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
304			};
305		};
306
307		/* internal digital mics */
308		dai-link-8 {
309			sound-dai = <&pdm>;
310
311			codec {
312				sound-dai = <&dmics>;
313			};
314		};
315
316		/* hdmi glue */
317		dai-link-9 {
318			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
319
320			codec {
321				sound-dai = <&hdmi_tx>;
322			};
323		};
324	};
325
326	wifi32k: wifi32k {
327		compatible = "pwm-clock";
328		#clock-cells = <0>;
329		clock-frequency = <32768>;
330		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
331	};
332};
333
334&arb {
335	status = "okay";
336};
337
338&cec_AO {
339	pinctrl-0 = <&cec_ao_a_h_pins>;
340	pinctrl-names = "default";
341	status = "disabled";
342	hdmi-phandle = <&hdmi_tx>;
343};
344
345&cecb_AO {
346	pinctrl-0 = <&cec_ao_b_h_pins>;
347	pinctrl-names = "default";
348	status = "okay";
349	hdmi-phandle = <&hdmi_tx>;
350};
351
352&clkc_audio {
353	status = "okay";
354};
355
356&cpu0 {
357	cpu-supply = <&vddcpu>;
358	operating-points-v2 = <&cpu_opp_table>;
359	clocks = <&clkc CLKID_CPU_CLK>;
360	clock-latency = <50000>;
361};
362
363&cpu1 {
364	cpu-supply = <&vddcpu>;
365	operating-points-v2 = <&cpu_opp_table>;
366	clocks = <&clkc CLKID_CPU1_CLK>;
367	clock-latency = <50000>;
368};
369
370&cpu2 {
371	cpu-supply = <&vddcpu>;
372	operating-points-v2 = <&cpu_opp_table>;
373	clocks = <&clkc CLKID_CPU2_CLK>;
374	clock-latency = <50000>;
375};
376
377&cpu3 {
378	cpu-supply = <&vddcpu>;
379	operating-points-v2 = <&cpu_opp_table>;
380	clocks = <&clkc CLKID_CPU3_CLK>;
381	clock-latency = <50000>;
382};
383
384&ethmac {
385	status = "okay";
386	phy-handle = <&internal_ephy>;
387	phy-mode = "rmii";
388};
389
390&frddr_a {
391	status = "okay";
392};
393
394&frddr_b {
395	status = "okay";
396};
397
398&frddr_c {
399	status = "okay";
400};
401
402&hdmi_tx {
403	status = "okay";
404	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
405	pinctrl-names = "default";
406};
407
408&hdmi_tx_tmds_port {
409	hdmi_tx_tmds_out: endpoint {
410		remote-endpoint = <&hdmi_connector_in>;
411	};
412};
413
414&i2c3 {
415	status = "okay";
416	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
417	pinctrl-names = "default";
418};
419
420&ir {
421	status = "okay";
422	pinctrl-0 = <&remote_input_ao_pins>;
423	pinctrl-names = "default";
424};
425
426&pdm {
427	pinctrl-0 = <&pdm_din0_z_pins>, <&pdm_dclk_z_pins>;
428	pinctrl-names = "default";
429	status = "okay";
430};
431
432&pwm_AO_ab {
433	status = "okay";
434	pinctrl-0 = <&pwm_ao_a_pins>;
435	pinctrl-names = "default";
436	clocks = <&xtal>;
437	clock-names = "clkin0";
438};
439
440&pwm_AO_cd {
441	pinctrl-0 = <&pwm_ao_d_e_pins>;
442	pinctrl-names = "default";
443	clocks = <&xtal>;
444	clock-names = "clkin1";
445	status = "okay";
446};
447
448&pwm_ef {
449	status = "okay";
450	pinctrl-0 = <&pwm_e_pins>;
451	pinctrl-names = "default";
452	clocks = <&xtal>;
453	clock-names = "clkin0";
454};
455
456&saradc {
457	status = "okay";
458	vref-supply = <&vddio_ao1v8>;
459};
460
461/* SDIO */
462&sd_emmc_a {
463	status = "okay";
464	pinctrl-0 = <&sdio_pins>;
465	pinctrl-1 = <&sdio_clk_gate_pins>;
466	pinctrl-names = "default", "clk-gate";
467	#address-cells = <1>;
468	#size-cells = <0>;
469
470	bus-width = <4>;
471	cap-sd-highspeed;
472	sd-uhs-sdr50;
473	max-frequency = <100000000>;
474
475	non-removable;
476	disable-wp;
477
478	/* WiFi firmware requires power to be kept while in suspend */
479	keep-power-in-suspend;
480
481	mmc-pwrseq = <&sdio_pwrseq>;
482
483	vmmc-supply = <&vddao_3v3>;
484	vqmmc-supply = <&vddio_ao1v8>;
485
486	brcmf: wifi@1 {
487		reg = <1>;
488		compatible = "brcm,bcm4329-fmac";
489	};
490};
491
492/* SD card */
493&sd_emmc_b {
494	status = "okay";
495	pinctrl-0 = <&sdcard_c_pins>;
496	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
497	pinctrl-names = "default", "clk-gate";
498
499	bus-width = <4>;
500	cap-sd-highspeed;
501	max-frequency = <50000000>;
502	disable-wp;
503
504	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
505	vmmc-supply = <&vddao_3v3>;
506	vqmmc-supply = <&vddao_3v3>;
507};
508
509/* eMMC */
510&sd_emmc_c {
511	status = "okay";
512	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
513	pinctrl-1 = <&emmc_clk_gate_pins>;
514	pinctrl-names = "default", "clk-gate";
515
516	bus-width = <8>;
517	cap-mmc-highspeed;
518	mmc-ddr-1_8v;
519	mmc-hs200-1_8v;
520	max-frequency = <200000000>;
521	non-removable;
522	disable-wp;
523
524	mmc-pwrseq = <&emmc_pwrseq>;
525	vmmc-supply = <&vddao_3v3>;
526	vqmmc-supply = <&emmc_1v8>;
527};
528
529&tdmif_a {
530	pinctrl-0 = <&tdm_a_dout0_pins>, <&tdm_a_fs_pins>, <&tdm_a_sclk_pins>;
531	pinctrl-names = "default";
532	status = "okay";
533
534	assigned-clocks = <&clkc_audio AUD_CLKID_TDM_SCLK_PAD0>,
535			  <&clkc_audio AUD_CLKID_TDM_LRCLK_PAD0>;
536	assigned-clock-parents = <&clkc_audio AUD_CLKID_MST_A_SCLK>,
537				 <&clkc_audio AUD_CLKID_MST_A_LRCLK>;
538	assigned-clock-rates = <0>, <0>;
539};
540
541&tdmif_b {
542	status = "okay";
543};
544
545&tdmin_a {
546	status = "okay";
547};
548
549&tdmin_b {
550	status = "okay";
551};
552
553&tdmout_a {
554	status = "okay";
555};
556
557&tdmout_b {
558	status = "okay";
559};
560
561&toddr_a {
562	status = "okay";
563};
564
565&toddr_b {
566	status = "okay";
567};
568
569&toddr_c {
570	status = "okay";
571};
572
573&tohdmitx {
574	status = "okay";
575};
576
577&uart_A {
578	status = "okay";
579	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
580	pinctrl-names = "default";
581	uart-has-rtscts;
582
583	bluetooth {
584		compatible = "brcm,bcm43438-bt";
585		interrupt-parent = <&gpio_intc>;
586		interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
587		interrupt-names = "host-wakeup";
588		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
589		max-speed = <2000000>;
590		clocks = <&wifi32k>;
591		clock-names = "lpo";
592		vbat-supply = <&vddao_3v3>;
593		vddio-supply = <&vddio_ao1v8>;
594	};
595};
596
597/* Exposed via the on-board USB to Serial FT232RL IC */
598&uart_AO {
599	status = "okay";
600	pinctrl-0 = <&uart_ao_a_pins>;
601	pinctrl-names = "default";
602};
603
604&usb {
605	status = "okay";
606	dr_mode = "otg";
607};
608