1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 */
6
7#include <dt-bindings/input/input.h>
8#include <dt-bindings/gpio/meson-g12a-gpio.h>
9#include <dt-bindings/sound/meson-g12a-toacodec.h>
10#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
11
12/ {
13	aliases {
14		serial0 = &uart_AO;
15		ethernet0 = &ethmac;
16		rtc1 = &vrtc;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	memory@0 {
24		device_type = "memory";
25		reg = <0x0 0x0 0x0 0x40000000>;
26	};
27
28	emmc_pwrseq: emmc-pwrseq {
29		compatible = "mmc-pwrseq-emmc";
30		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
31	};
32
33	fan: gpio-fan {
34		compatible = "gpio-fan";
35		gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>;
36		/* Using Dummy Speed */
37		gpio-fan,speed-map = <0 0>, <1 1>;
38		#cooling-cells = <2>;
39	};
40
41	leds {
42		compatible = "gpio-leds";
43
44		led-blue {
45			label = "n2:blue";
46			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
47			linux,default-trigger = "heartbeat";
48		};
49	};
50
51	tflash_vdd: regulator-tflash_vdd {
52		compatible = "regulator-fixed";
53
54		regulator-name = "TFLASH_VDD";
55		regulator-min-microvolt = <3300000>;
56		regulator-max-microvolt = <3300000>;
57
58		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
59		enable-active-high;
60		regulator-always-on;
61	};
62
63	tf_io: gpio-regulator-tf_io {
64		compatible = "regulator-gpio";
65
66		regulator-name = "TF_IO";
67		regulator-min-microvolt = <1800000>;
68		regulator-max-microvolt = <3300000>;
69
70		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
71		gpios-states = <0>;
72
73		states = <3300000 0>,
74			 <1800000 1>;
75	};
76
77	flash_1v8: regulator-flash_1v8 {
78		compatible = "regulator-fixed";
79		regulator-name = "FLASH_1V8";
80		regulator-min-microvolt = <1800000>;
81		regulator-max-microvolt = <1800000>;
82		vin-supply = <&vcc_3v3>;
83		regulator-always-on;
84	};
85
86	main_12v: regulator-main_12v {
87		compatible = "regulator-fixed";
88		regulator-name = "12V";
89		regulator-min-microvolt = <12000000>;
90		regulator-max-microvolt = <12000000>;
91		regulator-always-on;
92	};
93
94	usb_pwr_en: regulator-usb_pwr_en {
95		compatible = "regulator-fixed";
96		regulator-name = "USB_PWR_EN";
97		regulator-min-microvolt = <5000000>;
98		regulator-max-microvolt = <5000000>;
99		vin-supply = <&vcc_5v>;
100
101		/* Connected to the microUSB port power enable */
102		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
103		enable-active-high;
104	};
105
106	vcc_5v: regulator-vcc_5v {
107		compatible = "regulator-fixed";
108		regulator-name = "5V";
109		regulator-min-microvolt = <5000000>;
110		regulator-max-microvolt = <5000000>;
111		regulator-always-on;
112		vin-supply = <&main_12v>;
113		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
114		enable-active-high;
115	};
116
117	vcc_1v8: regulator-vcc_1v8 {
118		compatible = "regulator-fixed";
119		regulator-name = "VCC_1V8";
120		regulator-min-microvolt = <1800000>;
121		regulator-max-microvolt = <1800000>;
122		vin-supply = <&vcc_3v3>;
123		regulator-always-on;
124	};
125
126	vcc_3v3: regulator-vcc_3v3 {
127		compatible = "regulator-fixed";
128		regulator-name = "VCC_3V3";
129		regulator-min-microvolt = <3300000>;
130		regulator-max-microvolt = <3300000>;
131		vin-supply = <&vddao_3v3>;
132		regulator-always-on;
133		/* FIXME: actually controlled by VDDCPU_B_EN */
134	};
135
136	vddcpu_a: regulator-vddcpu-a {
137		/*
138		 * MP8756GD Regulator.
139		 */
140		compatible = "pwm-regulator";
141
142		regulator-name = "VDDCPU_A";
143		regulator-min-microvolt = <721000>;
144		regulator-max-microvolt = <1022000>;
145
146		pwm-supply = <&main_12v>;
147
148		pwms = <&pwm_ab 0 1250 0>;
149		pwm-dutycycle-range = <100 0>;
150
151		regulator-boot-on;
152		regulator-always-on;
153	};
154
155	vddcpu_b: regulator-vddcpu-b {
156		/*
157		 * Silergy SY8120B1ABC Regulator.
158		 */
159		compatible = "pwm-regulator";
160
161		regulator-name = "VDDCPU_B";
162		regulator-min-microvolt = <721000>;
163		regulator-max-microvolt = <1022000>;
164
165		pwm-supply = <&main_12v>;
166
167		pwms = <&pwm_AO_cd 1 1250 0>;
168		pwm-dutycycle-range = <100 0>;
169
170		regulator-boot-on;
171		regulator-always-on;
172	};
173
174	vddao_1v8: regulator-vddao_1v8 {
175		compatible = "regulator-fixed";
176		regulator-name = "VDDAO_1V8";
177		regulator-min-microvolt = <1800000>;
178		regulator-max-microvolt = <1800000>;
179		vin-supply = <&vddao_3v3>;
180		regulator-always-on;
181	};
182
183	vddao_3v3: regulator-vddao_3v3 {
184		compatible = "regulator-fixed";
185		regulator-name = "VDDAO_3V3";
186		regulator-min-microvolt = <3300000>;
187		regulator-max-microvolt = <3300000>;
188		vin-supply = <&main_12v>;
189		regulator-always-on;
190	};
191
192	hdmi-connector {
193		compatible = "hdmi-connector";
194		type = "a";
195
196		port {
197			hdmi_connector_in: endpoint {
198				remote-endpoint = <&hdmi_tx_tmds_out>;
199			};
200		};
201	};
202};
203
204&arb {
205	status = "okay";
206};
207
208&cec_AO {
209	pinctrl-0 = <&cec_ao_a_h_pins>;
210	pinctrl-names = "default";
211	status = "disabled";
212	hdmi-phandle = <&hdmi_tx>;
213};
214
215&cecb_AO {
216	pinctrl-0 = <&cec_ao_b_h_pins>;
217	pinctrl-names = "default";
218	status = "okay";
219	hdmi-phandle = <&hdmi_tx>;
220};
221
222&clkc_audio {
223	status = "okay";
224};
225
226&cpu0 {
227	cpu-supply = <&vddcpu_b>;
228	operating-points-v2 = <&cpu_opp_table_0>;
229	clocks = <&clkc CLKID_CPU_CLK>;
230	clock-latency = <50000>;
231};
232
233&cpu1 {
234	cpu-supply = <&vddcpu_b>;
235	operating-points-v2 = <&cpu_opp_table_0>;
236	clocks = <&clkc CLKID_CPU_CLK>;
237	clock-latency = <50000>;
238};
239
240&cpu100 {
241	cpu-supply = <&vddcpu_a>;
242	operating-points-v2 = <&cpub_opp_table_1>;
243	clocks = <&clkc CLKID_CPUB_CLK>;
244	clock-latency = <50000>;
245};
246
247&cpu101 {
248	cpu-supply = <&vddcpu_a>;
249	operating-points-v2 = <&cpub_opp_table_1>;
250	clocks = <&clkc CLKID_CPUB_CLK>;
251	clock-latency = <50000>;
252};
253
254&cpu102 {
255	cpu-supply = <&vddcpu_a>;
256	operating-points-v2 = <&cpub_opp_table_1>;
257	clocks = <&clkc CLKID_CPUB_CLK>;
258	clock-latency = <50000>;
259};
260
261&cpu103 {
262	cpu-supply = <&vddcpu_a>;
263	operating-points-v2 = <&cpub_opp_table_1>;
264	clocks = <&clkc CLKID_CPUB_CLK>;
265	clock-latency = <50000>;
266};
267
268&cpu_thermal {
269	trips {
270		cpu_active: cpu-active {
271			temperature = <60000>; /* millicelsius */
272			hysteresis = <2000>; /* millicelsius */
273			type = "active";
274		};
275	};
276
277	cooling-maps {
278		map {
279			trip = <&cpu_active>;
280			cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
281		};
282	};
283};
284
285&ddr_thermal {
286	trips {
287		ddr_active: ddr-active {
288			temperature = <60000>; /* millicelsius */
289			hysteresis = <2000>; /* millicelsius */
290			type = "active";
291		};
292	};
293
294	cooling-maps {
295		map {
296			trip = <&ddr_active>;
297			cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
298		};
299	};
300};
301
302&frddr_a {
303	status = "okay";
304};
305
306&frddr_b {
307	status = "okay";
308};
309
310&frddr_c {
311	status = "okay";
312};
313
314&hdmi_tx {
315	status = "okay";
316	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
317	pinctrl-names = "default";
318	hdmi-supply = <&vcc_5v>;
319};
320
321&hdmi_tx_tmds_port {
322	hdmi_tx_tmds_out: endpoint {
323		remote-endpoint = <&hdmi_connector_in>;
324	};
325};
326
327&pwm_ab {
328	pinctrl-0 = <&pwm_a_e_pins>;
329	pinctrl-names = "default";
330	clocks = <&xtal>;
331	clock-names = "clkin0";
332	status = "okay";
333};
334
335&pwm_AO_cd {
336	pinctrl-0 = <&pwm_ao_d_e_pins>;
337	pinctrl-names = "default";
338	clocks = <&xtal>;
339	clock-names = "clkin1";
340	status = "okay";
341};
342
343&saradc {
344	status = "okay";
345	vref-supply = <&vddao_1v8>;
346};
347
348/* SD card */
349&sd_emmc_b {
350	status = "okay";
351	pinctrl-0 = <&sdcard_c_pins>;
352	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
353	pinctrl-names = "default", "clk-gate";
354
355	bus-width = <4>;
356	cap-sd-highspeed;
357	max-frequency = <50000000>;
358	disable-wp;
359
360	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
361	vmmc-supply = <&tflash_vdd>;
362	vqmmc-supply = <&tf_io>;
363
364};
365
366/* eMMC */
367&sd_emmc_c {
368	status = "okay";
369	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
370	pinctrl-1 = <&emmc_clk_gate_pins>;
371	pinctrl-names = "default", "clk-gate";
372
373	bus-width = <8>;
374	cap-mmc-highspeed;
375	mmc-ddr-1_8v;
376	mmc-hs200-1_8v;
377	max-frequency = <200000000>;
378	disable-wp;
379
380	mmc-pwrseq = <&emmc_pwrseq>;
381	vmmc-supply = <&vcc_3v3>;
382	vqmmc-supply = <&flash_1v8>;
383};
384
385&tdmif_b {
386	status = "okay";
387};
388
389&tdmif_c {
390	status = "okay";
391};
392
393&tdmin_a {
394	status = "okay";
395};
396
397&tdmin_b {
398	status = "okay";
399};
400
401&tdmin_c {
402	status = "okay";
403};
404
405&tdmin_lb {
406	status = "okay";
407};
408
409&tdmout_b {
410	status = "okay";
411};
412
413&tdmout_c {
414	status = "okay";
415};
416
417&tohdmitx {
418	status = "okay";
419};
420
421&toddr_a {
422	status = "okay";
423};
424
425&toddr_b {
426	status = "okay";
427};
428
429&toddr_c {
430	status = "okay";
431};
432
433&uart_AO {
434	status = "okay";
435	pinctrl-0 = <&uart_ao_a_pins>;
436	pinctrl-names = "default";
437};
438
439&usb {
440	status = "okay";
441};
442
443&usb2_phy0 {
444	phy-supply = <&vcc_5v>;
445};
446