1/*
2 * Copyright (c) 2016 Andreas Färber
3 * Copyright (c) 2016 BayLibre, Inc.
4 * Author: Kevin Hilman <khilman@kernel.org>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This library is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This library is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 * Or, alternatively,
22 *
23 *  b) Permission is hereby granted, free of charge, to any person
24 *     obtaining a copy of this software and associated documentation
25 *     files (the "Software"), to deal in the Software without
26 *     restriction, including without limitation the rights to use,
27 *     copy, modify, merge, publish, distribute, sublicense, and/or
28 *     sell copies of the Software, and to permit persons to whom the
29 *     Software is furnished to do so, subject to the following
30 *     conditions:
31 *
32 *     The above copyright notice and this permission notice shall be
33 *     included in all copies or substantial portions of the Software.
34 *
35 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
36 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
37 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
38 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
39 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
40 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
42 *     OTHER DEALINGS IN THE SOFTWARE.
43 */
44
45/dts-v1/;
46
47#include "meson-gxbb.dtsi"
48#include <dt-bindings/gpio/gpio.h>
49
50/ {
51	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
52	model = "Hardkernel ODROID-C2";
53
54	aliases {
55		serial0 = &uart_AO;
56	};
57
58	chosen {
59		stdout-path = "serial0:115200n8";
60	};
61
62	memory@0 {
63		device_type = "memory";
64		reg = <0x0 0x0 0x0 0x80000000>;
65	};
66
67	usb_otg_pwr: regulator-usb-pwrs {
68		compatible = "regulator-fixed";
69
70		regulator-name = "USB_OTG_PWR";
71
72		regulator-min-microvolt = <5000000>;
73		regulator-max-microvolt = <5000000>;
74
75		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
76		enable-active-high;
77	};
78
79	leds {
80		compatible = "gpio-leds";
81		blue {
82			label = "c2:blue:alive";
83			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
84			linux,default-trigger = "heartbeat";
85			default-state = "off";
86		};
87	};
88
89	tflash_vdd: regulator-tflash_vdd {
90		/*
91		 * signal name from schematics: TFLASH_VDD_EN
92		 */
93		compatible = "regulator-fixed";
94
95		regulator-name = "TFLASH_VDD";
96		regulator-min-microvolt = <3300000>;
97		regulator-max-microvolt = <3300000>;
98
99		gpio = <&gpio GPIOY_12 GPIO_ACTIVE_HIGH>;
100		enable-active-high;
101	};
102
103	tf_io: gpio-regulator-tf_io {
104		compatible = "regulator-gpio";
105
106		regulator-name = "TF_IO";
107		regulator-min-microvolt = <1800000>;
108		regulator-max-microvolt = <3300000>;
109
110		/*
111		 * signal name from schematics: TF_3V3N_1V8_EN
112		 */
113		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
114		gpios-states = <0>;
115
116		states = <3300000 0
117			  1800000 1>;
118	};
119
120	vcc1v8: regulator-vcc1v8 {
121		compatible = "regulator-fixed";
122		regulator-name = "VCC1V8";
123		regulator-min-microvolt = <1800000>;
124		regulator-max-microvolt = <1800000>;
125	};
126
127	vcc3v3: regulator-vcc3v3 {
128		compatible = "regulator-fixed";
129		regulator-name = "VCC3V3";
130		regulator-min-microvolt = <3300000>;
131		regulator-max-microvolt = <3300000>;
132	};
133
134	emmc_pwrseq: emmc-pwrseq {
135		compatible = "mmc-pwrseq-emmc";
136		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
137	};
138
139	hdmi-connector {
140		compatible = "hdmi-connector";
141		type = "a";
142
143		port {
144			hdmi_connector_in: endpoint {
145				remote-endpoint = <&hdmi_tx_tmds_out>;
146			};
147		};
148	};
149};
150
151&cec_AO {
152	status = "okay";
153	pinctrl-0 = <&ao_cec_pins>;
154	pinctrl-names = "default";
155	hdmi-phandle = <&hdmi_tx>;
156};
157
158&ethmac {
159	status = "okay";
160	pinctrl-0 = <&eth_rgmii_pins>;
161	pinctrl-names = "default";
162	phy-handle = <&eth_phy0>;
163	phy-mode = "rgmii";
164
165	snps,reset-gpio = <&gpio GPIOZ_14 0>;
166	snps,reset-delays-us = <0 10000 1000000>;
167	snps,reset-active-low;
168
169	amlogic,tx-delay-ns = <2>;
170
171	mdio {
172		compatible = "snps,dwmac-mdio";
173		#address-cells = <1>;
174		#size-cells = <0>;
175
176		eth_phy0: ethernet-phy@0 {
177			/* Realtek RTL8211F (0x001cc916) */
178			reg = <0>;
179			interrupt-parent = <&gpio_intc>;
180			/* MAC_INTR on GPIOZ_15 */
181			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
182			eee-broken-1000t;
183		};
184	};
185};
186
187&gpio_ao {
188	/*
189	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
190	 * to be turned high in order to be detected by the USB Controller
191	 * This signal should be handled by a USB specific power sequence
192	 * in order to reset the Hub when USB bus is powered down.
193	 */
194	usb-hub {
195		gpio-hog;
196		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
197		output-high;
198		line-name = "usb-hub-reset";
199	};
200};
201
202&hdmi_tx {
203	status = "okay";
204	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
205	pinctrl-names = "default";
206};
207
208&hdmi_tx_tmds_port {
209	hdmi_tx_tmds_out: endpoint {
210		remote-endpoint = <&hdmi_connector_in>;
211	};
212};
213
214&i2c_A {
215	status = "okay";
216	pinctrl-0 = <&i2c_a_pins>;
217	pinctrl-names = "default";
218};
219
220&ir {
221	status = "okay";
222	pinctrl-0 = <&remote_input_ao_pins>;
223	pinctrl-names = "default";
224};
225
226&pinctrl_aobus {
227	gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
228			  "USB HUB nRESET", "USB OTG Power En",
229			  "J7 Header Pin2", "IR In", "J7 Header Pin4",
230			  "J7 Header Pin6", "J7 Header Pin5", "J7 Header Pin7",
231			  "HDMI CEC", "SYS LED",
232			  /* GPIO_TEST_N */
233			  "";
234};
235
236&pinctrl_periphs {
237	gpio-line-names = /* Bank GPIOZ */
238			  "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
239			  "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
240			  "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
241			  "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
242			  "Eth PHY nRESET", "Eth PHY Intc",
243			  /* Bank GPIOH */
244			  "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL", "",
245			  /* Bank BOOT */
246			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
247			  "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
248			  "eMMC Reset", "eMMC CMD",
249			  "", "", "", "", "", "", "",
250			  /* Bank CARD */
251			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
252			  "SDCard D3", "SDCard D2", "SDCard Det",
253			  /* Bank GPIODV */
254			  "", "", "", "", "", "", "", "", "", "", "", "", "",
255			  "", "", "", "", "", "", "", "", "", "", "",
256			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
257			  "PWM D", "PWM B",
258			  /* Bank GPIOY */
259			  "Revision Bit0", "Revision Bit1", "",
260			  "J2 Header Pin35", "", "", "", "J2 Header Pin36",
261			  "J2 Header Pin31", "", "", "", "TF VDD En",
262			  "J2 Header Pin32", "J2 Header Pin26", "", "",
263			  /* Bank GPIOX */
264			  "J2 Header Pin29", "J2 Header Pin24",
265			  "J2 Header Pin23", "J2 Header Pin22",
266			  "J2 Header Pin21", "J2 Header Pin18",
267			  "J2 Header Pin33", "J2 Header Pin19",
268			  "J2 Header Pin16", "J2 Header Pin15",
269			  "J2 Header Pin12", "J2 Header Pin13",
270			  "J2 Header Pin8", "J2 Header Pin10",
271			  "", "", "", "", "",
272			  "J2 Header Pin11", "", "J2 Header Pin7", "",
273			  /* Bank GPIOCLK */
274			  "", "", "", "";
275};
276
277&saradc {
278	status = "okay";
279	vref-supply = <&vcc1v8>;
280};
281
282&scpi_clocks {
283	status = "disabled";
284};
285
286/* SD */
287&sd_emmc_b {
288	status = "okay";
289	pinctrl-0 = <&sdcard_pins>;
290	pinctrl-1 = <&sdcard_clk_gate_pins>;
291	pinctrl-names = "default", "clk-gate";
292
293	bus-width = <4>;
294	cap-sd-highspeed;
295	max-frequency = <100000000>;
296	disable-wp;
297
298	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
299	cd-inverted;
300
301	vmmc-supply = <&tflash_vdd>;
302	vqmmc-supply = <&tf_io>;
303};
304
305/* eMMC */
306&sd_emmc_c {
307	status = "okay";
308	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
309	pinctrl-1 = <&emmc_clk_gate_pins>;
310	pinctrl-names = "default", "clk-gate";
311
312	bus-width = <8>;
313	max-frequency = <200000000>;
314	non-removable;
315	disable-wp;
316	cap-mmc-highspeed;
317	mmc-ddr-1_8v;
318	mmc-hs200-1_8v;
319
320	mmc-pwrseq = <&emmc_pwrseq>;
321	vmmc-supply = <&vcc3v3>;
322	vqmmc-supply = <&vcc1v8>;
323};
324
325&uart_AO {
326	status = "okay";
327	pinctrl-0 = <&uart_ao_a_pins>;
328	pinctrl-names = "default";
329};
330
331&usb0_phy {
332	status = "okay";
333	phy-supply = <&usb_otg_pwr>;
334};
335
336&usb1_phy {
337	status = "okay";
338	phy-supply = <&usb_otg_pwr>;
339};
340
341&usb0 {
342	status = "okay";
343};
344
345&usb1 {
346	status = "okay";
347};
348