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/dts-v1/;
8
9#include "meson-g12b.dtsi"
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/gpio/meson-g12a-gpio.h>
12
13/ {
14	compatible = "hardkernel,odroid-n2", "amlogic,g12b";
15	model = "Hardkernel ODROID-N2";
16
17	aliases {
18		serial0 = &uart_AO;
19		ethernet0 = &ethmac;
20	};
21
22	chosen {
23		stdout-path = "serial0:115200n8";
24	};
25
26	memory@0 {
27		device_type = "memory";
28		reg = <0x0 0x0 0x0 0x40000000>;
29	};
30
31	emmc_pwrseq: emmc-pwrseq {
32		compatible = "mmc-pwrseq-emmc";
33		reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
34	};
35
36	leds {
37		compatible = "gpio-leds";
38
39		blue {
40			label = "n2:blue";
41			gpios = <&gpio_ao GPIOAO_11 GPIO_ACTIVE_HIGH>;
42			linux,default-trigger = "heartbeat";
43		};
44	};
45
46	tflash_vdd: regulator-tflash_vdd {
47		compatible = "regulator-fixed";
48
49		regulator-name = "TFLASH_VDD";
50		regulator-min-microvolt = <3300000>;
51		regulator-max-microvolt = <3300000>;
52
53		gpio = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
54		enable-active-high;
55	};
56
57	tf_io: gpio-regulator-tf_io {
58		compatible = "regulator-gpio";
59
60		regulator-name = "TF_IO";
61		regulator-min-microvolt = <1800000>;
62		regulator-max-microvolt = <3300000>;
63
64		gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>;
65		gpios-states = <0>;
66
67		states = <3300000 0
68			  1800000 1>;
69	};
70
71	flash_1v8: regulator-flash_1v8 {
72		compatible = "regulator-fixed";
73		regulator-name = "FLASH_1V8";
74		regulator-min-microvolt = <1800000>;
75		regulator-max-microvolt = <1800000>;
76		vin-supply = <&vcc_3v3>;
77		regulator-always-on;
78	};
79
80	main_12v: regulator-main_12v {
81		compatible = "regulator-fixed";
82		regulator-name = "12V";
83		regulator-min-microvolt = <12000000>;
84		regulator-max-microvolt = <12000000>;
85		regulator-always-on;
86	};
87
88	vcc_5v: regulator-vcc_5v {
89		compatible = "regulator-fixed";
90		regulator-name = "5V";
91		regulator-min-microvolt = <5000000>;
92		regulator-max-microvolt = <5000000>;
93		regulator-always-on;
94		vin-supply = <&main_12v>;
95	};
96
97	vcc_1v8: regulator-vcc_1v8 {
98		compatible = "regulator-fixed";
99		regulator-name = "VCC_1V8";
100		regulator-min-microvolt = <1800000>;
101		regulator-max-microvolt = <1800000>;
102		vin-supply = <&vcc_3v3>;
103		regulator-always-on;
104	};
105
106	vcc_3v3: regulator-vcc_3v3 {
107		compatible = "regulator-fixed";
108		regulator-name = "VCC_3V3";
109		regulator-min-microvolt = <3300000>;
110		regulator-max-microvolt = <3300000>;
111		vin-supply = <&vddao_3v3>;
112		regulator-always-on;
113		/* FIXME: actually controlled by VDDCPU_B_EN */
114	};
115
116	hub_5v: regulator-hub_5v {
117		compatible = "regulator-fixed";
118		regulator-name = "HUB_5V";
119		regulator-min-microvolt = <5000000>;
120		regulator-max-microvolt = <5000000>;
121		vin-supply = <&vcc_5v>;
122
123		/* Connected to the Hub CHIPENABLE, LOW sets low power state */
124		gpio = <&gpio GPIOH_5 GPIO_ACTIVE_HIGH>;
125		enable-active-high;
126	};
127
128	usb_pwr_en: regulator-usb_pwr_en {
129		compatible = "regulator-fixed";
130		regulator-name = "USB_PWR_EN";
131		regulator-min-microvolt = <5000000>;
132		regulator-max-microvolt = <5000000>;
133		vin-supply = <&vcc_5v>;
134
135		/* Connected to the microUSB port power enable */
136		gpio = <&gpio GPIOH_6 GPIO_ACTIVE_HIGH>;
137		enable-active-high;
138	};
139
140	vddao_1v8: regulator-vddao_1v8 {
141		compatible = "regulator-fixed";
142		regulator-name = "VDDAO_1V8";
143		regulator-min-microvolt = <1800000>;
144		regulator-max-microvolt = <1800000>;
145		vin-supply = <&vddao_3v3>;
146		regulator-always-on;
147	};
148
149	vddao_3v3: regulator-vddao_3v3 {
150		compatible = "regulator-fixed";
151		regulator-name = "VDDAO_3V3";
152		regulator-min-microvolt = <3300000>;
153		regulator-max-microvolt = <3300000>;
154		vin-supply = <&main_12v>;
155		regulator-always-on;
156	};
157
158	hdmi-connector {
159		compatible = "hdmi-connector";
160		type = "a";
161
162		port {
163			hdmi_connector_in: endpoint {
164				remote-endpoint = <&hdmi_tx_tmds_out>;
165			};
166		};
167	};
168};
169
170&cec_AO {
171	pinctrl-0 = <&cec_ao_a_h_pins>;
172	pinctrl-names = "default";
173	status = "disabled";
174	hdmi-phandle = <&hdmi_tx>;
175};
176
177&cecb_AO {
178	pinctrl-0 = <&cec_ao_b_h_pins>;
179	pinctrl-names = "default";
180	status = "okay";
181	hdmi-phandle = <&hdmi_tx>;
182};
183
184&ext_mdio {
185	external_phy: ethernet-phy@0 {
186		/* Realtek RTL8211F (0x001cc916) */
187		reg = <0>;
188		max-speed = <1000>;
189	};
190};
191
192&ethmac {
193	pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
194	pinctrl-names = "default";
195	status = "okay";
196	phy-mode = "rgmii";
197	phy-handle = <&external_phy>;
198	amlogic,tx-delay-ns = <2>;
199};
200
201&gpio {
202	/*
203	 * WARNING: The USB Hub on the Odroid-N2 needs a reset signal
204	 * to be turned high in order to be detected by the USB Controller
205	 * This signal should be handled by a USB specific power sequence
206	 * in order to reset the Hub when USB bus is powered down.
207	 */
208	usb-hub {
209		gpio-hog;
210		gpios = <GPIOH_4 GPIO_ACTIVE_HIGH>;
211		output-high;
212		line-name = "usb-hub-reset";
213	};
214};
215
216&hdmi_tx {
217	status = "okay";
218	pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
219	pinctrl-names = "default";
220	hdmi-supply = <&vcc_5v>;
221};
222
223&hdmi_tx_tmds_port {
224	hdmi_tx_tmds_out: endpoint {
225		remote-endpoint = <&hdmi_connector_in>;
226	};
227};
228
229&ir {
230	status = "okay";
231	pinctrl-0 = <&remote_input_ao_pins>;
232	pinctrl-names = "default";
233};
234
235/* SD card */
236&sd_emmc_b {
237	status = "okay";
238	pinctrl-0 = <&sdcard_c_pins>;
239	pinctrl-1 = <&sdcard_clk_gate_c_pins>;
240	pinctrl-names = "default", "clk-gate";
241
242	bus-width = <4>;
243	cap-sd-highspeed;
244	max-frequency = <50000000>;
245	disable-wp;
246
247	cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
248	vmmc-supply = <&tflash_vdd>;
249	vqmmc-supply = <&tf_io>;
250
251};
252
253/* eMMC */
254&sd_emmc_c {
255	status = "okay";
256	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
257	pinctrl-1 = <&emmc_clk_gate_pins>;
258	pinctrl-names = "default", "clk-gate";
259
260	bus-width = <8>;
261	cap-mmc-highspeed;
262	mmc-ddr-1_8v;
263	mmc-hs200-1_8v;
264	max-frequency = <200000000>;
265	disable-wp;
266
267	mmc-pwrseq = <&emmc_pwrseq>;
268	vmmc-supply = <&vcc_3v3>;
269	vqmmc-supply = <&flash_1v8>;
270};
271
272&uart_AO {
273	status = "okay";
274	pinctrl-0 = <&uart_ao_a_pins>;
275	pinctrl-names = "default";
276};
277
278&usb {
279	status = "okay";
280	vbus-supply = <&usb_pwr_en>;
281};
282
283&usb2_phy0 {
284	phy-supply = <&vcc_5v>;
285};
286
287&usb2_phy1 {
288	/* Enable the hub which is connected to this port */
289	phy-supply = <&hub_5v>;
290};
291