1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (c) 2016 Andreas Färber
4 * Copyright (c) 2016 BayLibre, Inc.
5 * Author: Kevin Hilman <khilman@kernel.org>
6 */
7
8/dts-v1/;
9
10#include "meson-gxbb.dtsi"
11#include <dt-bindings/gpio/gpio.h>
12
13/ {
14	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
15	model = "Hardkernel ODROID-C2";
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 0x80000000>;
29	};
30
31	usb_otg_pwr: regulator-usb-pwrs {
32		compatible = "regulator-fixed";
33
34		regulator-name = "USB_OTG_PWR";
35
36		regulator-min-microvolt = <5000000>;
37		regulator-max-microvolt = <5000000>;
38
39		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
40		enable-active-high;
41	};
42
43	leds {
44		compatible = "gpio-leds";
45		blue {
46			label = "c2:blue:alive";
47			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
48			linux,default-trigger = "heartbeat";
49			default-state = "off";
50		};
51	};
52
53	p5v0: regulator-p5v0 {
54		compatible = "regulator-fixed";
55
56		regulator-name = "P5V0";
57		regulator-min-microvolt = <5000000>;
58		regulator-max-microvolt = <5000000>;
59		regulator-always-on;
60	};
61
62	tflash_vdd: regulator-tflash_vdd {
63		/*
64		 * signal name from schematics: TFLASH_VDD_EN
65		 */
66		compatible = "regulator-fixed";
67
68		regulator-name = "TFLASH_VDD";
69		regulator-min-microvolt = <3300000>;
70		regulator-max-microvolt = <3300000>;
71
72		gpio = <&gpio GPIOY_12 GPIO_ACTIVE_HIGH>;
73		enable-active-high;
74	};
75
76	tf_io: gpio-regulator-tf_io {
77		compatible = "regulator-gpio";
78
79		regulator-name = "TF_IO";
80		regulator-min-microvolt = <1800000>;
81		regulator-max-microvolt = <3300000>;
82
83		/*
84		 * signal name from schematics: TF_3V3N_1V8_EN
85		 */
86		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
87		gpios-states = <0>;
88
89		states = <3300000 0>,
90			 <1800000 1>;
91	};
92
93	vcc1v8: regulator-vcc1v8 {
94		compatible = "regulator-fixed";
95		regulator-name = "VCC1V8";
96		regulator-min-microvolt = <1800000>;
97		regulator-max-microvolt = <1800000>;
98	};
99
100	vcc3v3: regulator-vcc3v3 {
101		compatible = "regulator-fixed";
102		regulator-name = "VCC3V3";
103		regulator-min-microvolt = <3300000>;
104		regulator-max-microvolt = <3300000>;
105	};
106
107	emmc_pwrseq: emmc-pwrseq {
108		compatible = "mmc-pwrseq-emmc";
109		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
110	};
111
112	hdmi-connector {
113		compatible = "hdmi-connector";
114		type = "a";
115
116		port {
117			hdmi_connector_in: endpoint {
118				remote-endpoint = <&hdmi_tx_tmds_out>;
119			};
120		};
121	};
122};
123
124&cec_AO {
125	status = "okay";
126	pinctrl-0 = <&ao_cec_pins>;
127	pinctrl-names = "default";
128	hdmi-phandle = <&hdmi_tx>;
129};
130
131&ethmac {
132	status = "okay";
133	pinctrl-0 = <&eth_rgmii_pins>;
134	pinctrl-names = "default";
135	phy-handle = <&eth_phy0>;
136	phy-mode = "rgmii";
137
138	amlogic,tx-delay-ns = <2>;
139
140	mdio {
141		compatible = "snps,dwmac-mdio";
142		#address-cells = <1>;
143		#size-cells = <0>;
144
145		eth_phy0: ethernet-phy@0 {
146			/* Realtek RTL8211F (0x001cc916) */
147			reg = <0>;
148
149			reset-assert-us = <10000>;
150			reset-deassert-us = <30000>;
151			reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
152
153			interrupt-parent = <&gpio_intc>;
154			/* MAC_INTR on GPIOZ_15 */
155			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
156		};
157	};
158};
159
160&gpio_ao {
161	/*
162	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
163	 * to be turned high in order to be detected by the USB Controller
164	 * This signal should be handled by a USB specific power sequence
165	 * in order to reset the Hub when USB bus is powered down.
166	 */
167	usb-hub {
168		gpio-hog;
169		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
170		output-high;
171		line-name = "usb-hub-reset";
172	};
173};
174
175&hdmi_tx {
176	status = "okay";
177	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
178	pinctrl-names = "default";
179};
180
181&hdmi_tx_tmds_port {
182	hdmi_tx_tmds_out: endpoint {
183		remote-endpoint = <&hdmi_connector_in>;
184	};
185};
186
187&i2c_A {
188	status = "okay";
189	pinctrl-0 = <&i2c_a_pins>;
190	pinctrl-names = "default";
191};
192
193&ir {
194	status = "okay";
195	pinctrl-0 = <&remote_input_ao_pins>;
196	pinctrl-names = "default";
197};
198
199&gpio_ao {
200	gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
201			  "USB HUB nRESET", "USB OTG Power En",
202			  "J7 Header Pin2", "IR In", "J7 Header Pin4",
203			  "J7 Header Pin6", "J7 Header Pin5", "J7 Header Pin7",
204			  "HDMI CEC", "SYS LED",
205			  /* GPIO_TEST_N */
206			  "";
207};
208
209&gpio {
210	gpio-line-names = /* Bank GPIOZ */
211			  "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
212			  "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
213			  "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
214			  "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
215			  "Eth PHY nRESET", "Eth PHY Intc",
216			  /* Bank GPIOH */
217			  "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL", "",
218			  /* Bank BOOT */
219			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
220			  "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
221			  "eMMC Reset", "eMMC CMD",
222			  "", "", "", "", "", "", "",
223			  /* Bank CARD */
224			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
225			  "SDCard D3", "SDCard D2", "SDCard Det",
226			  /* Bank GPIODV */
227			  "", "", "", "", "", "", "", "", "", "", "", "", "",
228			  "", "", "", "", "", "", "", "", "", "", "",
229			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
230			  "PWM D", "PWM B",
231			  /* Bank GPIOY */
232			  "Revision Bit0", "Revision Bit1", "",
233			  "J2 Header Pin35", "", "", "", "J2 Header Pin36",
234			  "J2 Header Pin31", "", "", "", "TF VDD En",
235			  "J2 Header Pin32", "J2 Header Pin26", "", "",
236			  /* Bank GPIOX */
237			  "J2 Header Pin29", "J2 Header Pin24",
238			  "J2 Header Pin23", "J2 Header Pin22",
239			  "J2 Header Pin21", "J2 Header Pin18",
240			  "J2 Header Pin33", "J2 Header Pin19",
241			  "J2 Header Pin16", "J2 Header Pin15",
242			  "J2 Header Pin12", "J2 Header Pin13",
243			  "J2 Header Pin8", "J2 Header Pin10",
244			  "", "", "", "", "",
245			  "J2 Header Pin11", "", "J2 Header Pin7", "",
246			  /* Bank GPIOCLK */
247			  "", "", "", "";
248};
249
250&saradc {
251	status = "okay";
252	vref-supply = <&vcc1v8>;
253};
254
255&scpi_clocks {
256	status = "disabled";
257};
258
259/* SD */
260&sd_emmc_b {
261	status = "okay";
262	pinctrl-0 = <&sdcard_pins>;
263	pinctrl-1 = <&sdcard_clk_gate_pins>;
264	pinctrl-names = "default", "clk-gate";
265
266	bus-width = <4>;
267	cap-sd-highspeed;
268	sd-uhs-sdr12;
269	sd-uhs-sdr25;
270	sd-uhs-sdr50;
271	sd-uhs-ddr50;
272	max-frequency = <100000000>;
273	disable-wp;
274
275	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
276
277	vmmc-supply = <&tflash_vdd>;
278	vqmmc-supply = <&tf_io>;
279};
280
281/* eMMC */
282&sd_emmc_c {
283	status = "okay";
284	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
285	pinctrl-1 = <&emmc_clk_gate_pins>;
286	pinctrl-names = "default", "clk-gate";
287
288	bus-width = <8>;
289	max-frequency = <200000000>;
290	non-removable;
291	disable-wp;
292	cap-mmc-highspeed;
293	mmc-ddr-1_8v;
294	mmc-hs200-1_8v;
295
296	mmc-pwrseq = <&emmc_pwrseq>;
297	vmmc-supply = <&vcc3v3>;
298	vqmmc-supply = <&vcc1v8>;
299};
300
301&uart_AO {
302	status = "okay";
303	pinctrl-0 = <&uart_ao_a_pins>;
304	pinctrl-names = "default";
305};
306
307&usb0_phy {
308	status = "okay";
309	phy-supply = <&usb_otg_pwr>;
310};
311
312&usb1_phy {
313	status = "okay";
314	phy-supply = <&usb_otg_pwr>;
315};
316
317&usb0 {
318	status = "okay";
319};
320
321&usb1 {
322	status = "okay";
323};
324