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