1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2020 Dongjin Kim <tobetter@gmail.com>
4 */
5
6#include "meson-sm1.dtsi"
7#include <dt-bindings/gpio/meson-g12a-gpio.h>
8#include <dt-bindings/leds/common.h>
9#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
10
11/ {
12	aliases {
13		serial0 = &uart_AO;
14		ethernet0 = &ethmac;
15	};
16
17	chosen {
18		stdout-path = "serial0:115200n8";
19	};
20
21	memory@0 {
22		device_type = "memory";
23		reg = <0x0 0x0 0x0 0x40000000>;
24	};
25
26	emmc_pwrseq: emmc-pwrseq {
27		compatible = "mmc-pwrseq-emmc";
28		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
29	};
30
31	tflash_vdd: regulator-tflash_vdd {
32		compatible = "regulator-fixed";
33
34		regulator-name = "TFLASH_VDD";
35		regulator-min-microvolt = <3300000>;
36		regulator-max-microvolt = <3300000>;
37
38		gpio = <&gpio_ao GPIOAO_3 GPIO_OPEN_DRAIN>;
39		enable-active-high;
40		regulator-always-on;
41	};
42
43	tf_io: gpio-regulator-tf_io {
44		compatible = "regulator-gpio";
45
46		regulator-name = "TF_IO";
47		regulator-min-microvolt = <1800000>;
48		regulator-max-microvolt = <3300000>;
49
50		gpios = <&gpio_ao GPIOAO_6 GPIO_ACTIVE_HIGH>;
51		gpios-states = <0>;
52
53		states = <3300000 0>,
54			 <1800000 1>;
55	};
56
57	flash_1v8: regulator-flash_1v8 {
58		compatible = "regulator-fixed";
59		regulator-name = "FLASH_1V8";
60		regulator-min-microvolt = <1800000>;
61		regulator-max-microvolt = <1800000>;
62		vin-supply = <&vcc_3v3>;
63		regulator-always-on;
64	};
65
66	main_12v: regulator-main_12v {
67		compatible = "regulator-fixed";
68		regulator-name = "12V";
69		regulator-min-microvolt = <12000000>;
70		regulator-max-microvolt = <12000000>;
71		regulator-always-on;
72	};
73
74	vcc_5v: regulator-vcc_5v {
75		compatible = "regulator-fixed";
76		regulator-name = "5V";
77		regulator-min-microvolt = <5000000>;
78		regulator-max-microvolt = <5000000>;
79		regulator-always-on;
80		vin-supply = <&main_12v>;
81	};
82
83	vcc_1v8: regulator-vcc_1v8 {
84		compatible = "regulator-fixed";
85		regulator-name = "VCC_1V8";
86		regulator-min-microvolt = <1800000>;
87		regulator-max-microvolt = <1800000>;
88		vin-supply = <&vcc_3v3>;
89		regulator-always-on;
90	};
91
92	vcc_3v3: regulator-vcc_3v3 {
93		compatible = "regulator-fixed";
94		regulator-name = "VCC_3V3";
95		regulator-min-microvolt = <3300000>;
96		regulator-max-microvolt = <3300000>;
97		vin-supply = <&vddao_3v3>;
98		regulator-always-on;
99		/* FIXME: actually controlled by VDDCPU_B_EN */
100	};
101
102	vddcpu: regulator-vddcpu {
103		/*
104		 * MP8756GD Regulator.
105		 */
106		compatible = "pwm-regulator";
107
108		regulator-name = "VDDCPU";
109		regulator-min-microvolt = <721000>;
110		regulator-max-microvolt = <1022000>;
111
112		vin-supply = <&main_12v>;
113
114		pwms = <&pwm_AO_cd 1 1250 0>;
115		pwm-dutycycle-range = <100 0>;
116
117		regulator-boot-on;
118		regulator-always-on;
119	};
120
121	usb_pwr_en: regulator-usb_pwr_en {
122		compatible = "regulator-fixed";
123		regulator-name = "USB_PWR_EN";
124		regulator-min-microvolt = <5000000>;
125		regulator-max-microvolt = <5000000>;
126		vin-supply = <&vcc_5v>;
127
128		/* Connected to the microUSB port power enable */
129		gpio = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
130		enable-active-high;
131	};
132
133	vddao_1v8: regulator-vddao_1v8 {
134		compatible = "regulator-fixed";
135		regulator-name = "VDDAO_1V8";
136		regulator-min-microvolt = <1800000>;
137		regulator-max-microvolt = <1800000>;
138		vin-supply = <&vddao_3v3>;
139		regulator-always-on;
140	};
141
142	vddao_3v3: regulator-vddao_3v3 {
143		compatible = "regulator-fixed";
144		regulator-name = "VDDAO_3V3";
145		regulator-min-microvolt = <3300000>;
146		regulator-max-microvolt = <3300000>;
147		vin-supply = <&main_12v>;
148		regulator-always-on;
149	};
150
151	hdmi-connector {
152		compatible = "hdmi-connector";
153		type = "a";
154
155		port {
156			hdmi_connector_in: endpoint {
157				remote-endpoint = <&hdmi_tx_tmds_out>;
158			};
159		};
160	};
161
162	sound {
163		compatible = "amlogic,axg-sound-card";
164		audio-aux-devs = <&tdmout_b>;
165		audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
166				"TDMOUT_B IN 1", "FRDDR_B OUT 1",
167				"TDMOUT_B IN 2", "FRDDR_C OUT 1",
168				"TDM_B Playback", "TDMOUT_B OUT";
169
170		assigned-clocks = <&clkc CLKID_MPLL2>,
171				  <&clkc CLKID_MPLL0>,
172				  <&clkc CLKID_MPLL1>;
173		assigned-clock-parents = <0>, <0>, <0>;
174		assigned-clock-rates = <294912000>,
175				       <270950400>,
176				       <393216000>;
177		status = "okay";
178
179		dai-link-0 {
180			sound-dai = <&frddr_a>;
181		};
182
183		dai-link-1 {
184			sound-dai = <&frddr_b>;
185		};
186
187		dai-link-2 {
188			sound-dai = <&frddr_c>;
189		};
190
191		/* 8ch hdmi interface */
192		dai-link-3 {
193			sound-dai = <&tdmif_b>;
194			dai-format = "i2s";
195			dai-tdm-slot-tx-mask-0 = <1 1>;
196			dai-tdm-slot-tx-mask-1 = <1 1>;
197			dai-tdm-slot-tx-mask-2 = <1 1>;
198			dai-tdm-slot-tx-mask-3 = <1 1>;
199			mclk-fs = <256>;
200
201			codec {
202				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
203			};
204		};
205
206		/* hdmi glue */
207		dai-link-4 {
208			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
209
210			codec {
211				sound-dai = <&hdmi_tx>;
212			};
213		};
214	};
215};
216
217&arb {
218	status = "okay";
219};
220
221&clkc_audio {
222	status = "okay";
223};
224
225&cpu0 {
226	cpu-supply = <&vddcpu>;
227	operating-points-v2 = <&cpu_opp_table>;
228	clocks = <&clkc CLKID_CPU_CLK>;
229	clock-latency = <50000>;
230};
231
232&cpu1 {
233	cpu-supply = <&vddcpu>;
234	operating-points-v2 = <&cpu_opp_table>;
235	clocks = <&clkc CLKID_CPU1_CLK>;
236	clock-latency = <50000>;
237};
238
239&cpu2 {
240	cpu-supply = <&vddcpu>;
241	operating-points-v2 = <&cpu_opp_table>;
242	clocks = <&clkc CLKID_CPU2_CLK>;
243	clock-latency = <50000>;
244};
245
246&cpu3 {
247	cpu-supply = <&vddcpu>;
248	operating-points-v2 = <&cpu_opp_table>;
249	clocks = <&clkc CLKID_CPU3_CLK>;
250	clock-latency = <50000>;
251};
252
253&ext_mdio {
254	external_phy: ethernet-phy@0 {
255		/* Realtek RTL8211F (0x001cc916) */
256		reg = <0>;
257		max-speed = <1000>;
258
259		interrupt-parent = <&gpio_intc>;
260		/* MAC_INTR on GPIOZ_14 */
261		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
262	};
263};
264
265&ethmac {
266	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
267	pinctrl-names = "default";
268	status = "okay";
269	phy-mode = "rgmii";
270	phy-handle = <&external_phy>;
271	amlogic,tx-delay-ns = <2>;
272};
273
274&frddr_a {
275	status = "okay";
276};
277
278&frddr_b {
279	status = "okay";
280};
281
282&frddr_c {
283	status = "okay";
284};
285
286&gpio {
287	gpio-line-names =
288		/* GPIOZ */
289		"", "", "", "", "", "", "", "",
290		"", "", "", "", "", "", "", "",
291		/* GPIOH */
292		"", "", "", "", "",
293		"PIN_36", /* GPIOH_5 */
294		"PIN_26", /* GPIOH_6 */
295		"PIN_32", /* GPIOH_7 */
296		"",
297		/* BOOT */
298		"", "", "", "", "", "", "", "",
299		"", "", "", "", "", "", "", "",
300		/* GPIOC */
301		"", "", "", "", "", "", "", "",
302		/* GPIOA */
303		"", "", "", "", "", "", "", "",
304		"", "", "", "", "", "",
305		"PIN_27", /* GPIOA_14 */
306		"PIN_28", /* GPIOA_15 */
307		/* GPIOX */
308		"PIN_16", /* GPIOX_0 */
309		"PIN_18", /* GPIOX_1 */
310		"PIN_22", /* GPIOX_2 */
311		"PIN_11", /* GPIOX_3 */
312		"PIN_13", /* GPIOX_4 */
313		"PIN_7",  /* GPIOX_5 */
314		"PIN_33", /* GPIOX_6 */
315		"PIN_15", /* GPIOX_7 */
316		"PIN_19", /* GPIOX_8 */
317		"PIN_21", /* GPIOX_9 */
318		"PIN_24", /* GPIOX_10 */
319		"PIN_23", /* GPIOX_11 */
320		"PIN_8",  /* GPIOX_12 */
321		"PIN_10", /* GPIOX_13 */
322		"PIN_29", /* GPIOX_14 */
323		"PIN_31", /* GPIOX_15 */
324		"PIN_12", /* GPIOX_16 */
325		"PIN_3",  /* GPIOX_17 */
326		"PIN_5",  /* GPIOX_18 */
327		"PIN_35"; /* GPIOX_19 */
328};
329
330&gpio_ao {
331	gpio-line-names =
332		/* GPIOAO */
333		"", "", "", "",
334		"PIN_47", /* GPIOAO_4 */
335		"", "",
336		"PIN_45", /* GPIOAO_7 */
337		"PIN_46", /* GPIOAO_8 */
338		"PIN_44", /* GPIOAO_9 */
339		"PIN_42", /* GPIOAO_10 */
340		"",
341		/* GPIOE */
342		"", "", "";
343};
344
345&hdmi_tx {
346	status = "okay";
347	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
348	pinctrl-names = "default";
349	hdmi-supply = <&vcc_5v>;
350};
351
352&hdmi_tx_tmds_port {
353	hdmi_tx_tmds_out: endpoint {
354		remote-endpoint = <&hdmi_connector_in>;
355	};
356};
357
358&ir {
359	status = "okay";
360	pinctrl-0 = <&remote_input_ao_pins>;
361	pinctrl-names = "default";
362};
363
364&pwm_AO_cd {
365	pinctrl-0 = <&pwm_ao_d_e_pins>;
366	pinctrl-names = "default";
367	clocks = <&xtal>;
368	clock-names = "clkin1";
369	status = "okay";
370};
371
372&saradc {
373	status = "okay";
374};
375
376/* SD card */
377&sd_emmc_b {
378	status = "okay";
379	pinctrl-0 = <&sdcard_c_pins>;
380	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
381	pinctrl-names = "default", "clk-gate";
382
383	bus-width = <4>;
384	cap-sd-highspeed;
385	max-frequency = <200000000>;
386	sd-uhs-sdr12;
387	sd-uhs-sdr25;
388	sd-uhs-sdr50;
389	sd-uhs-sdr104;
390	disable-wp;
391
392	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
393	vmmc-supply = <&tflash_vdd>;
394	vqmmc-supply = <&tf_io>;
395};
396
397/* eMMC */
398&sd_emmc_c {
399	status = "okay";
400	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
401	pinctrl-1 = <&emmc_clk_gate_pins>;
402	pinctrl-names = "default", "clk-gate";
403
404	bus-width = <8>;
405	cap-mmc-highspeed;
406	mmc-ddr-1_8v;
407	mmc-hs200-1_8v;
408	max-frequency = <200000000>;
409	disable-wp;
410
411	mmc-pwrseq = <&emmc_pwrseq>;
412	vmmc-supply = <&vcc_3v3>;
413	vqmmc-supply = <&flash_1v8>;
414};
415
416&tdmif_b {
417	status = "okay";
418};
419
420&tdmout_b {
421	status = "okay";
422};
423
424&tohdmitx {
425	status = "okay";
426};
427
428&uart_AO {
429	status = "okay";
430	pinctrl-0 = <&uart_ao_a_pins>;
431	pinctrl-names = "default";
432};
433
434&usb {
435	status = "okay";
436	vbus-supply = <&usb_pwr_en>;
437};
438
439&usb2_phy0 {
440	phy-supply = <&vcc_5v>;
441};
442
443