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