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