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