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