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