xref: /linux/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2019 BayLibre, SAS
4 * Author: Neil Armstrong <narmstrong@baylibre.com>
5 * Copyright (c) 2019 Christian Hewitt <christianshewitt@gmail.com>
6 */
7
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/leds/common.h>
10#include <dt-bindings/gpio/meson-g12a-gpio.h>
11#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
12
13/ {
14	aliases {
15		serial0 = &uart_AO;
16		ethernet0 = &ethmac;
17		rtc0 = &rtc;
18		rtc1 = &vrtc;
19	};
20
21	chosen {
22		stdout-path = "serial0:115200n8";
23	};
24
25	memory@0 {
26		device_type = "memory";
27		reg = <0x0 0x0 0x0 0x80000000>;
28	};
29
30	adc-keys {
31		compatible = "adc-keys";
32		io-channels = <&saradc 2>;
33		io-channel-names = "buttons";
34		keyup-threshold-microvolt = <1710000>;
35
36		button-function {
37			label = "Function";
38			linux,code = <KEY_FN>;
39			press-threshold-microvolt = <10000>;
40		};
41	};
42
43	leds {
44		compatible = "gpio-leds";
45
46		led-white {
47			color = <LED_COLOR_ID_WHITE>;
48			function = LED_FUNCTION_STATUS;
49			gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
50			linux,default-trigger = "heartbeat";
51		};
52
53		led-red {
54			color = <LED_COLOR_ID_RED>;
55			function = LED_FUNCTION_STATUS;
56			gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
57		};
58	};
59
60	emmc_pwrseq: emmc-pwrseq {
61		compatible = "mmc-pwrseq-emmc";
62		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
63	};
64
65	gpio-keys-polled {
66		compatible = "gpio-keys-polled";
67		poll-interval = <100>;
68
69		power-button {
70			label = "power";
71			linux,code = <KEY_POWER>;
72			gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
73		};
74	};
75
76	sdio_pwrseq: sdio-pwrseq {
77		compatible = "mmc-pwrseq-simple";
78		reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
79		clocks = <&wifi32k>;
80		clock-names = "ext_clock";
81	};
82
83	dc_in: regulator-dc-in {
84		compatible = "regulator-fixed";
85		regulator-name = "DC_IN";
86		regulator-min-microvolt = <5000000>;
87		regulator-max-microvolt = <5000000>;
88		regulator-always-on;
89	};
90
91	vcc_5v: regulator-vcc-5v {
92		compatible = "regulator-fixed";
93		regulator-name = "VCC_5V";
94		regulator-min-microvolt = <5000000>;
95		regulator-max-microvolt = <5000000>;
96		vin-supply = <&dc_in>;
97
98		gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
99		enable-active-high;
100	};
101
102	vcc_1v8: regulator-vcc-1v8 {
103		compatible = "regulator-fixed";
104		regulator-name = "VCC_1V8";
105		regulator-min-microvolt = <1800000>;
106		regulator-max-microvolt = <1800000>;
107		vin-supply = <&vcc_3v3>;
108		regulator-always-on;
109	};
110
111	vcc_3v3: regulator-vcc-3v3 {
112		compatible = "regulator-fixed";
113		regulator-name = "VCC_3V3";
114		regulator-min-microvolt = <3300000>;
115		regulator-max-microvolt = <3300000>;
116		vin-supply = <&vsys_3v3>;
117		regulator-always-on;
118		/* FIXME: actually controlled by VDDCPU_B_EN */
119	};
120
121	vddao_1v8: regulator-vddao-1v8 {
122		compatible = "regulator-fixed";
123		regulator-name = "VDDIO_AO1V8";
124		regulator-min-microvolt = <1800000>;
125		regulator-max-microvolt = <1800000>;
126		vin-supply = <&vsys_3v3>;
127		regulator-always-on;
128	};
129
130	emmc_1v8: regulator-emmc-1v8 {
131		compatible = "regulator-fixed";
132		regulator-name = "EMMC_AO1V8";
133		regulator-min-microvolt = <1800000>;
134		regulator-max-microvolt = <1800000>;
135		vin-supply = <&vcc_3v3>;
136		regulator-always-on;
137	};
138
139	vsys_3v3: regulator-vsys-3v3 {
140		compatible = "regulator-fixed";
141		regulator-name = "VSYS_3V3";
142		regulator-min-microvolt = <3300000>;
143		regulator-max-microvolt = <3300000>;
144		vin-supply = <&dc_in>;
145		regulator-always-on;
146	};
147
148	usb_pwr: regulator-usb-pwr {
149		compatible = "regulator-fixed";
150		regulator-name = "USB_PWR";
151		regulator-min-microvolt = <5000000>;
152		regulator-max-microvolt = <5000000>;
153		vin-supply = <&vcc_5v>;
154
155		gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
156		enable-active-high;
157	};
158
159	hdmi-connector {
160		compatible = "hdmi-connector";
161		type = "a";
162
163		port {
164			hdmi_connector_in: endpoint {
165				remote-endpoint = <&hdmi_tx_tmds_out>;
166			};
167		};
168	};
169
170
171	sound {
172		compatible = "amlogic,axg-sound-card";
173		model = "KHADAS-VIM3";
174		audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
175		audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
176				"TDMOUT_A IN 1", "FRDDR_B OUT 0",
177				"TDMOUT_A IN 2", "FRDDR_C OUT 0",
178				"TDM_A Playback", "TDMOUT_A OUT",
179				"TDMIN_A IN 0", "TDM_A Capture",
180				"TDMIN_A IN 3", "TDM_A Loopback",
181				"TODDR_A IN 0", "TDMIN_A OUT",
182				"TODDR_B IN 0", "TDMIN_A OUT",
183				"TODDR_C IN 0", "TDMIN_A OUT";
184
185		clocks = <&clkc CLKID_MPLL2>,
186			 <&clkc CLKID_MPLL0>,
187			 <&clkc CLKID_MPLL1>;
188
189		assigned-clocks = <&clkc CLKID_MPLL2>,
190				  <&clkc CLKID_MPLL0>,
191				  <&clkc CLKID_MPLL1>;
192		assigned-clock-parents = <0>, <0>, <0>;
193		assigned-clock-rates = <294912000>,
194				       <270950400>,
195				       <393216000>;
196
197		dai-link-0 {
198			sound-dai = <&frddr_a>;
199		};
200
201		dai-link-1 {
202			sound-dai = <&frddr_b>;
203		};
204
205		dai-link-2 {
206			sound-dai = <&frddr_c>;
207		};
208
209		dai-link-3 {
210			sound-dai = <&toddr_a>;
211		};
212
213		dai-link-4 {
214			sound-dai = <&toddr_b>;
215		};
216
217		dai-link-5 {
218			sound-dai = <&toddr_c>;
219		};
220
221		/* 8ch hdmi interface */
222		dai-link-6 {
223			sound-dai = <&tdmif_a>;
224			dai-format = "i2s";
225			dai-tdm-slot-tx-mask-0 = <1 1>;
226			dai-tdm-slot-tx-mask-1 = <1 1>;
227			dai-tdm-slot-tx-mask-2 = <1 1>;
228			dai-tdm-slot-tx-mask-3 = <1 1>;
229			mclk-fs = <256>;
230
231			codec {
232				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
233			};
234		};
235
236		/* hdmi glue */
237		dai-link-7 {
238			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
239
240			codec {
241				sound-dai = <&hdmi_tx>;
242			};
243		};
244	};
245
246	wifi32k: wifi32k {
247		compatible = "pwm-clock";
248		#clock-cells = <0>;
249		clock-frequency = <32768>;
250		pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
251	};
252};
253
254&arb {
255	status = "okay";
256};
257
258&clkc_audio {
259	status = "okay";
260};
261
262&cec_AO {
263	pinctrl-0 = <&cec_ao_a_h_pins>;
264	pinctrl-names = "default";
265	status = "disabled";
266	hdmi-phandle = <&hdmi_tx>;
267};
268
269&cecb_AO {
270	pinctrl-0 = <&cec_ao_b_h_pins>;
271	pinctrl-names = "default";
272	status = "okay";
273	hdmi-phandle = <&hdmi_tx>;
274};
275
276&cpu_thermal {
277	trips {
278		cpu_active: cpu-active {
279			temperature = <80000>; /* millicelsius */
280			hysteresis = <2000>; /* millicelsius */
281			type = "active";
282		};
283	};
284
285	cooling-maps {
286		map {
287			trip = <&cpu_active>;
288			cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
289		};
290	};
291};
292
293&ext_mdio {
294	external_phy: ethernet-phy@0 {
295		/* Realtek RTL8211F (0x001cc916) */
296		reg = <0>;
297		max-speed = <1000>;
298
299		interrupt-parent = <&gpio_intc>;
300		/* MAC_INTR on GPIOZ_14 */
301		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
302	};
303};
304
305&ethmac {
306	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
307	pinctrl-names = "default";
308	status = "okay";
309	phy-mode = "rgmii";
310	phy-handle = <&external_phy>;
311	amlogic,tx-delay-ns = <2>;
312};
313
314&frddr_a {
315	status = "okay";
316};
317
318&frddr_b {
319	status = "okay";
320};
321
322&frddr_c {
323	status = "okay";
324};
325
326&hdmi_tx {
327	status = "okay";
328	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
329	pinctrl-names = "default";
330	hdmi-supply = <&vcc_5v>;
331};
332
333&hdmi_tx_tmds_port {
334	hdmi_tx_tmds_out: endpoint {
335		remote-endpoint = <&hdmi_connector_in>;
336	};
337};
338
339&i2c_AO {
340	status = "okay";
341	pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
342	pinctrl-names = "default";
343
344	khadas_mcu: system-controller@18 {
345		compatible = "khadas,mcu";
346		reg = <0x18>;
347		#cooling-cells = <2>;
348	};
349
350	gpio_expander: gpio-controller@20 {
351		compatible = "ti,tca6408";
352		reg = <0x20>;
353		vcc-supply = <&vcc_3v3>;
354		gpio-controller;
355		#gpio-cells = <2>;
356	};
357
358	rtc: rtc@51 {
359		compatible = "haoyu,hym8563";
360		reg = <0x51>;
361		#clock-cells = <0>;
362	};
363};
364
365&ir {
366	status = "okay";
367	pinctrl-0 = <&remote_input_ao_pins>;
368	pinctrl-names = "default";
369	linux,rc-map-name = "rc-khadas";
370};
371
372&pcie {
373	reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
374};
375
376&pwm_ef {
377	status = "okay";
378	pinctrl-0 = <&pwm_e_pins>;
379	pinctrl-names = "default";
380};
381
382&saradc {
383	status = "okay";
384	vref-supply = <&vddao_1v8>;
385};
386
387/* SDIO */
388&sd_emmc_a {
389	status = "okay";
390	pinctrl-0 = <&sdio_pins>;
391	pinctrl-1 = <&sdio_clk_gate_pins>;
392	pinctrl-names = "default", "clk-gate";
393	#address-cells = <1>;
394	#size-cells = <0>;
395
396	bus-width = <4>;
397	cap-sd-highspeed;
398	max-frequency = <100000000>;
399
400	non-removable;
401	disable-wp;
402
403	/* WiFi firmware requires power to be kept while in suspend */
404	keep-power-in-suspend;
405
406	mmc-pwrseq = <&sdio_pwrseq>;
407
408	vmmc-supply = <&vsys_3v3>;
409	vqmmc-supply = <&vddao_1v8>;
410
411	brcmf: wifi@1 {
412		reg = <1>;
413		compatible = "brcm,bcm4329-fmac";
414	};
415};
416
417/* SD card */
418&sd_emmc_b {
419	status = "okay";
420	pinctrl-0 = <&sdcard_c_pins>;
421	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
422	pinctrl-names = "default", "clk-gate";
423
424	bus-width = <4>;
425	cap-sd-highspeed;
426	max-frequency = <50000000>;
427	disable-wp;
428
429	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
430	vmmc-supply = <&vsys_3v3>;
431	vqmmc-supply = <&vsys_3v3>;
432};
433
434/* eMMC */
435&sd_emmc_c {
436	status = "okay";
437	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
438	pinctrl-1 = <&emmc_clk_gate_pins>;
439	pinctrl-names = "default", "clk-gate";
440
441	bus-width = <8>;
442	cap-mmc-highspeed;
443	mmc-ddr-1_8v;
444	mmc-hs200-1_8v;
445	max-frequency = <200000000>;
446	disable-wp;
447
448	mmc-pwrseq = <&emmc_pwrseq>;
449	vmmc-supply = <&vcc_3v3>;
450	vqmmc-supply = <&emmc_1v8>;
451};
452
453/*
454 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
455 * and eMMC Data 4 to 7 pins.
456 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
457 * and change bus-width to 4 then spifc can be enabled.
458 */
459&spifc {
460	status = "disabled";
461	pinctrl-0 = <&nor_pins>;
462	pinctrl-names = "default";
463
464	w25q128: flash@0 {
465		#address-cells = <1>;
466		#size-cells = <1>;
467		compatible = "winbond,w25q128fw", "jedec,spi-nor";
468		reg = <0>;
469		spi-max-frequency = <104000000>;
470	};
471};
472
473&tdmif_a {
474	status = "okay";
475};
476
477&tdmin_a {
478	status = "okay";
479};
480
481&tdmout_a {
482	status = "okay";
483};
484
485&toddr_a {
486	status = "okay";
487};
488
489&toddr_b {
490	status = "okay";
491};
492
493&toddr_c {
494	status = "okay";
495};
496
497&tohdmitx {
498	status = "okay";
499};
500
501&uart_A {
502	status = "okay";
503	pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
504	pinctrl-names = "default";
505	uart-has-rtscts;
506
507	bluetooth {
508		compatible = "brcm,bcm43438-bt";
509		shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
510		max-speed = <2000000>;
511		clocks = <&wifi32k>;
512		clock-names = "lpo";
513	};
514};
515
516&uart_AO {
517	status = "okay";
518	pinctrl-0 = <&uart_ao_a_pins>;
519	pinctrl-names = "default";
520};
521
522&usb2_phy0 {
523	phy-supply = <&dc_in>;
524};
525
526&usb2_phy1 {
527	phy-supply = <&usb_pwr>;
528};
529
530&usb3_pcie_phy {
531	phy-supply = <&usb_pwr>;
532};
533
534&usb {
535	status = "okay";
536	dr_mode = "peripheral";
537};
538