xref: /linux/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi (revision a460513ed4b6994bfeb7bd86f72853140bc1ac12)
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		rtc0 = &rtc;
17		rtc1 = &vrtc;
18	};
19
20	dioo2133: audio-amplifier-0 {
21		compatible = "simple-audio-amplifier";
22		enable-gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>;
23		VCC-supply = <&vcc_5v>;
24		sound-name-prefix = "U19";
25		status = "okay";
26	};
27
28	chosen {
29		stdout-path = "serial0:115200n8";
30	};
31
32	memory@0 {
33		device_type = "memory";
34		reg = <0x0 0x0 0x0 0x40000000>;
35	};
36
37	emmc_pwrseq: emmc-pwrseq {
38		compatible = "mmc-pwrseq-emmc";
39		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
40	};
41
42	leds {
43		compatible = "gpio-leds";
44
45		blue {
46			label = "n2:blue";
47			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
48			linux,default-trigger = "heartbeat";
49		};
50	};
51
52	tflash_vdd: regulator-tflash_vdd {
53		compatible = "regulator-fixed";
54
55		regulator-name = "TFLASH_VDD";
56		regulator-min-microvolt = <3300000>;
57		regulator-max-microvolt = <3300000>;
58
59		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
60		enable-active-high;
61		regulator-always-on;
62	};
63
64	tf_io: gpio-regulator-tf_io {
65		compatible = "regulator-gpio";
66
67		regulator-name = "TF_IO";
68		regulator-min-microvolt = <1800000>;
69		regulator-max-microvolt = <3300000>;
70
71		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
72		gpios-states = <0>;
73
74		states = <3300000 0>,
75			 <1800000 1>;
76	};
77
78	flash_1v8: regulator-flash_1v8 {
79		compatible = "regulator-fixed";
80		regulator-name = "FLASH_1V8";
81		regulator-min-microvolt = <1800000>;
82		regulator-max-microvolt = <1800000>;
83		vin-supply = <&vcc_3v3>;
84		regulator-always-on;
85	};
86
87	main_12v: regulator-main_12v {
88		compatible = "regulator-fixed";
89		regulator-name = "12V";
90		regulator-min-microvolt = <12000000>;
91		regulator-max-microvolt = <12000000>;
92		regulator-always-on;
93	};
94
95	vcc_5v: regulator-vcc_5v {
96		compatible = "regulator-fixed";
97		regulator-name = "5V";
98		regulator-min-microvolt = <5000000>;
99		regulator-max-microvolt = <5000000>;
100		regulator-always-on;
101		vin-supply = <&main_12v>;
102	};
103
104	vcc_1v8: regulator-vcc_1v8 {
105		compatible = "regulator-fixed";
106		regulator-name = "VCC_1V8";
107		regulator-min-microvolt = <1800000>;
108		regulator-max-microvolt = <1800000>;
109		vin-supply = <&vcc_3v3>;
110		regulator-always-on;
111	};
112
113	vcc_3v3: regulator-vcc_3v3 {
114		compatible = "regulator-fixed";
115		regulator-name = "VCC_3V3";
116		regulator-min-microvolt = <3300000>;
117		regulator-max-microvolt = <3300000>;
118		vin-supply = <&vddao_3v3>;
119		regulator-always-on;
120		/* FIXME: actually controlled by VDDCPU_B_EN */
121	};
122
123	vddcpu_a: regulator-vddcpu-a {
124		/*
125		 * MP8756GD Regulator.
126		 */
127		compatible = "pwm-regulator";
128
129		regulator-name = "VDDCPU_A";
130		regulator-min-microvolt = <721000>;
131		regulator-max-microvolt = <1022000>;
132
133		vin-supply = <&main_12v>;
134
135		pwms = <&pwm_ab 0 1250 0>;
136		pwm-dutycycle-range = <100 0>;
137
138		regulator-boot-on;
139		regulator-always-on;
140	};
141
142	vddcpu_b: regulator-vddcpu-b {
143		/*
144		 * Silergy SY8120B1ABC Regulator.
145		 */
146		compatible = "pwm-regulator";
147
148		regulator-name = "VDDCPU_B";
149		regulator-min-microvolt = <721000>;
150		regulator-max-microvolt = <1022000>;
151
152		vin-supply = <&main_12v>;
153
154		pwms = <&pwm_AO_cd 1 1250 0>;
155		pwm-dutycycle-range = <100 0>;
156
157		regulator-boot-on;
158		regulator-always-on;
159	};
160
161	hub_5v: regulator-hub_5v {
162		compatible = "regulator-fixed";
163		regulator-name = "HUB_5V";
164		regulator-min-microvolt = <5000000>;
165		regulator-max-microvolt = <5000000>;
166		vin-supply = <&vcc_5v>;
167
168		/* Connected to the Hub CHIPENABLE, LOW sets low power state */
169		gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
170		enable-active-high;
171	};
172
173	usb_pwr_en: regulator-usb_pwr_en {
174		compatible = "regulator-fixed";
175		regulator-name = "USB_PWR_EN";
176		regulator-min-microvolt = <5000000>;
177		regulator-max-microvolt = <5000000>;
178		vin-supply = <&vcc_5v>;
179
180		/* Connected to the microUSB port power enable */
181		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
182		enable-active-high;
183	};
184
185	vddao_1v8: regulator-vddao_1v8 {
186		compatible = "regulator-fixed";
187		regulator-name = "VDDAO_1V8";
188		regulator-min-microvolt = <1800000>;
189		regulator-max-microvolt = <1800000>;
190		vin-supply = <&vddao_3v3>;
191		regulator-always-on;
192	};
193
194	vddao_3v3: regulator-vddao_3v3 {
195		compatible = "regulator-fixed";
196		regulator-name = "VDDAO_3V3";
197		regulator-min-microvolt = <3300000>;
198		regulator-max-microvolt = <3300000>;
199		vin-supply = <&main_12v>;
200		regulator-always-on;
201	};
202
203	hdmi-connector {
204		compatible = "hdmi-connector";
205		type = "a";
206
207		port {
208			hdmi_connector_in: endpoint {
209				remote-endpoint = <&hdmi_tx_tmds_out>;
210			};
211		};
212	};
213
214	sound {
215		compatible = "amlogic,axg-sound-card";
216		model = "ODROID-N2";
217		audio-widgets = "Line", "Lineout";
218		audio-aux-devs = <&tdmout_b>, <&tdmout_c>, <&tdmin_a>,
219				 <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>,
220				 <&dioo2133>;
221		audio-routing = "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				"TDMOUT_C IN 0", "FRDDR_A OUT 2",
226				"TDMOUT_C IN 1", "FRDDR_B OUT 2",
227				"TDMOUT_C IN 2", "FRDDR_C OUT 2",
228				"TDM_C Playback", "TDMOUT_C OUT",
229				"TDMIN_A IN 4", "TDM_B Loopback",
230				"TDMIN_B IN 4", "TDM_B Loopback",
231				"TDMIN_C IN 4", "TDM_B Loopback",
232				"TDMIN_LB IN 1", "TDM_B Loopback",
233				"TDMIN_A IN 5", "TDM_C Loopback",
234				"TDMIN_B IN 5", "TDM_C Loopback",
235				"TDMIN_C IN 5", "TDM_C Loopback",
236				"TDMIN_LB IN 2", "TDM_C 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				"TODDR_A IN 2", "TDMIN_C OUT",
244				"TODDR_B IN 2", "TDMIN_C OUT",
245				"TODDR_C IN 2", "TDMIN_C OUT",
246				"TODDR_A IN 6", "TDMIN_LB OUT",
247				"TODDR_B IN 6", "TDMIN_LB OUT",
248				"TODDR_C IN 6", "TDMIN_LB OUT",
249				"U19 INL", "ACODEC LOLP",
250				"U19 INR", "ACODEC LORP",
251				"Lineout", "U19 OUTL",
252				"Lineout", "U19 OUTR";
253
254		assigned-clocks = <&clkc CLKID_MPLL2>,
255				  <&clkc CLKID_MPLL0>,
256				  <&clkc CLKID_MPLL1>;
257		assigned-clock-parents = <0>, <0>, <0>;
258		assigned-clock-rates = <294912000>,
259				       <270950400>,
260				       <393216000>;
261		status = "okay";
262
263		dai-link-0 {
264			sound-dai = <&frddr_a>;
265		};
266
267		dai-link-1 {
268			sound-dai = <&frddr_b>;
269		};
270
271		dai-link-2 {
272			sound-dai = <&frddr_c>;
273		};
274
275		dai-link-3 {
276			sound-dai = <&toddr_a>;
277		};
278
279		dai-link-4 {
280			sound-dai = <&toddr_b>;
281		};
282
283		dai-link-5 {
284			sound-dai = <&toddr_c>;
285		};
286
287		/* 8ch hdmi interface */
288		dai-link-6 {
289			sound-dai = <&tdmif_b>;
290			dai-format = "i2s";
291			dai-tdm-slot-tx-mask-0 = <1 1>;
292			dai-tdm-slot-tx-mask-1 = <1 1>;
293			dai-tdm-slot-tx-mask-2 = <1 1>;
294			dai-tdm-slot-tx-mask-3 = <1 1>;
295			mclk-fs = <256>;
296
297			codec-0 {
298				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
299			};
300
301			codec-1 {
302				sound-dai = <&toacodec TOACODEC_IN_B>;
303			};
304		};
305
306		/* i2s jack output interface */
307		dai-link-7 {
308			sound-dai = <&tdmif_c>;
309			dai-format = "i2s";
310			dai-tdm-slot-tx-mask-0 = <1 1>;
311			mclk-fs = <256>;
312
313			codec-0 {
314				sound-dai = <&tohdmitx TOHDMITX_I2S_IN_C>;
315			};
316
317			codec-1 {
318				sound-dai = <&toacodec TOACODEC_IN_C>;
319			};
320		};
321
322		/* hdmi glue */
323		dai-link-8 {
324			sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
325
326			codec {
327				sound-dai = <&hdmi_tx>;
328			};
329		};
330
331		/* acodec glue */
332		dai-link-9 {
333			sound-dai = <&toacodec TOACODEC_OUT>;
334
335			codec {
336				sound-dai = <&acodec>;
337			};
338		};
339	};
340};
341
342&acodec {
343	AVDD-supply = <&vddao_1v8>;
344	status = "okay";
345};
346
347&arb {
348	status = "okay";
349};
350
351&cec_AO {
352	pinctrl-0 = <&cec_ao_a_h_pins>;
353	pinctrl-names = "default";
354	status = "disabled";
355	hdmi-phandle = <&hdmi_tx>;
356};
357
358&cecb_AO {
359	pinctrl-0 = <&cec_ao_b_h_pins>;
360	pinctrl-names = "default";
361	status = "okay";
362	hdmi-phandle = <&hdmi_tx>;
363};
364
365&clkc_audio {
366	status = "okay";
367};
368
369&cpu0 {
370	cpu-supply = <&vddcpu_b>;
371	operating-points-v2 = <&cpu_opp_table_0>;
372	clocks = <&clkc CLKID_CPU_CLK>;
373	clock-latency = <50000>;
374};
375
376&cpu1 {
377	cpu-supply = <&vddcpu_b>;
378	operating-points-v2 = <&cpu_opp_table_0>;
379	clocks = <&clkc CLKID_CPU_CLK>;
380	clock-latency = <50000>;
381};
382
383&cpu100 {
384	cpu-supply = <&vddcpu_a>;
385	operating-points-v2 = <&cpub_opp_table_1>;
386	clocks = <&clkc CLKID_CPUB_CLK>;
387	clock-latency = <50000>;
388};
389
390&cpu101 {
391	cpu-supply = <&vddcpu_a>;
392	operating-points-v2 = <&cpub_opp_table_1>;
393	clocks = <&clkc CLKID_CPUB_CLK>;
394	clock-latency = <50000>;
395};
396
397&cpu102 {
398	cpu-supply = <&vddcpu_a>;
399	operating-points-v2 = <&cpub_opp_table_1>;
400	clocks = <&clkc CLKID_CPUB_CLK>;
401	clock-latency = <50000>;
402};
403
404&cpu103 {
405	cpu-supply = <&vddcpu_a>;
406	operating-points-v2 = <&cpub_opp_table_1>;
407	clocks = <&clkc CLKID_CPUB_CLK>;
408	clock-latency = <50000>;
409};
410
411&ext_mdio {
412	external_phy: ethernet-phy@0 {
413		/* Realtek RTL8211F (0x001cc916) */
414		reg = <0>;
415		max-speed = <1000>;
416
417		reset-assert-us = <10000>;
418		reset-deassert-us = <80000>;
419		reset-gpios = <&gpio GPIOZ_15 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>;
420
421		interrupt-parent = <&gpio_intc>;
422		/* MAC_INTR on GPIOZ_14 */
423		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
424	};
425};
426
427&ethmac {
428	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
429	pinctrl-names = "default";
430	status = "okay";
431	phy-mode = "rgmii";
432	phy-handle = <&external_phy>;
433	amlogic,tx-delay-ns = <2>;
434};
435
436&frddr_a {
437	status = "okay";
438};
439
440&frddr_b {
441	status = "okay";
442};
443
444&frddr_c {
445	status = "okay";
446};
447
448&gpio {
449	/*
450	 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
451	 * to be turned high in order to be detected by the USB Controller
452	 * This signal should be handled by a USB specific power sequence
453	 * in order to reset the Hub when USB bus is powered down.
454	 */
455	usb-hub {
456		gpio-hog;
457		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
458		output-high;
459		line-name = "usb-hub-reset";
460	};
461};
462
463&hdmi_tx {
464	status = "okay";
465	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
466	pinctrl-names = "default";
467	hdmi-supply = <&vcc_5v>;
468};
469
470&hdmi_tx_tmds_port {
471	hdmi_tx_tmds_out: endpoint {
472		remote-endpoint = <&hdmi_connector_in>;
473	};
474};
475
476&ir {
477	status = "okay";
478	pinctrl-0 = <&remote_input_ao_pins>;
479	pinctrl-names = "default";
480	linux,rc-map-name = "rc-odroid";
481};
482
483&i2c3 {
484	status = "okay";
485	pinctrl-0 = <&i2c3_sda_a_pins>, <&i2c3_sck_a_pins>;
486	pinctrl-names = "default";
487
488	rtc: rtc@51 {
489		compatible = "nxp,pcf8563";
490		reg = <0x51>;
491		wakeup-source;
492	};
493};
494
495&pwm_ab {
496	pinctrl-0 = <&pwm_a_e_pins>;
497	pinctrl-names = "default";
498	clocks = <&xtal>;
499	clock-names = "clkin0";
500	status = "okay";
501};
502
503&pwm_AO_cd {
504	pinctrl-0 = <&pwm_ao_d_e_pins>;
505	pinctrl-names = "default";
506	clocks = <&xtal>;
507	clock-names = "clkin1";
508	status = "okay";
509};
510
511/* SD card */
512&sd_emmc_b {
513	status = "okay";
514	pinctrl-0 = <&sdcard_c_pins>;
515	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
516	pinctrl-names = "default", "clk-gate";
517
518	bus-width = <4>;
519	cap-sd-highspeed;
520	max-frequency = <50000000>;
521	disable-wp;
522
523	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
524	vmmc-supply = <&tflash_vdd>;
525	vqmmc-supply = <&tf_io>;
526
527};
528
529/* eMMC */
530&sd_emmc_c {
531	status = "okay";
532	pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
533	pinctrl-1 = <&emmc_clk_gate_pins>;
534	pinctrl-names = "default", "clk-gate";
535
536	bus-width = <8>;
537	cap-mmc-highspeed;
538	mmc-ddr-1_8v;
539	mmc-hs200-1_8v;
540	max-frequency = <200000000>;
541	disable-wp;
542
543	mmc-pwrseq = <&emmc_pwrseq>;
544	vmmc-supply = <&vcc_3v3>;
545	vqmmc-supply = <&flash_1v8>;
546};
547
548/*
549 * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR pins
550 * and eMMC Data 4 to 7 pins.
551 * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
552 * and change bus-width to 4 then spifc can be enabled.
553 * The SW1 slide should also be set to the correct position.
554 */
555&spifc {
556	status = "disabled";
557	pinctrl-0 = <&nor_pins>;
558	pinctrl-names = "default";
559
560	mx25u64: spi-flash@0 {
561		#address-cells = <1>;
562		#size-cells = <1>;
563		compatible = "mxicy,mx25u6435f", "jedec,spi-nor";
564		reg = <0>;
565		spi-max-frequency = <104000000>;
566	};
567};
568
569&tdmif_b {
570	status = "okay";
571};
572
573&tdmif_c {
574	status = "okay";
575};
576
577&tdmin_a {
578	status = "okay";
579};
580
581&tdmin_b {
582	status = "okay";
583};
584
585&tdmin_c {
586	status = "okay";
587};
588
589&tdmin_lb {
590	status = "okay";
591};
592
593&tdmout_b {
594	status = "okay";
595};
596
597&tdmout_c {
598	status = "okay";
599};
600
601&toacodec {
602	status = "okay";
603};
604
605&tohdmitx {
606	status = "okay";
607};
608
609&toddr_a {
610	status = "okay";
611};
612
613&toddr_b {
614	status = "okay";
615};
616
617&toddr_c {
618	status = "okay";
619};
620
621&uart_AO {
622	status = "okay";
623	pinctrl-0 = <&uart_ao_a_pins>;
624	pinctrl-names = "default";
625};
626
627&usb {
628	status = "okay";
629	vbus-supply = <&usb_pwr_en>;
630};
631
632&usb2_phy0 {
633	phy-supply = <&vcc_5v>;
634};
635
636&usb2_phy1 {
637	/* Enable the hub which is connected to this port */
638	phy-supply = <&hub_5v>;
639};
640