185596034SKevin Hilman/*
285596034SKevin Hilman * Copyright (c) 2016 Andreas Färber
385596034SKevin Hilman * Copyright (c) 2016 BayLibre, Inc.
485596034SKevin Hilman * Author: Kevin Hilman <khilman@kernel.org>
585596034SKevin Hilman *
685596034SKevin Hilman * This file is dual-licensed: you can use it either under the terms
785596034SKevin Hilman * of the GPL or the X11 license, at your option. Note that this dual
885596034SKevin Hilman * licensing only applies to this file, and not this project as a
985596034SKevin Hilman * whole.
1085596034SKevin Hilman *
1185596034SKevin Hilman *  a) This library is free software; you can redistribute it and/or
1285596034SKevin Hilman *     modify it under the terms of the GNU General Public License as
1385596034SKevin Hilman *     published by the Free Software Foundation; either version 2 of the
1485596034SKevin Hilman *     License, or (at your option) any later version.
1585596034SKevin Hilman *
1685596034SKevin Hilman *     This library is distributed in the hope that it will be useful,
1785596034SKevin Hilman *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1885596034SKevin Hilman *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1985596034SKevin Hilman *     GNU General Public License for more details.
2085596034SKevin Hilman *
2185596034SKevin Hilman * Or, alternatively,
2285596034SKevin Hilman *
2385596034SKevin Hilman *  b) Permission is hereby granted, free of charge, to any person
2485596034SKevin Hilman *     obtaining a copy of this software and associated documentation
2585596034SKevin Hilman *     files (the "Software"), to deal in the Software without
2685596034SKevin Hilman *     restriction, including without limitation the rights to use,
2785596034SKevin Hilman *     copy, modify, merge, publish, distribute, sublicense, and/or
2885596034SKevin Hilman *     sell copies of the Software, and to permit persons to whom the
2985596034SKevin Hilman *     Software is furnished to do so, subject to the following
3085596034SKevin Hilman *     conditions:
3185596034SKevin Hilman *
3285596034SKevin Hilman *     The above copyright notice and this permission notice shall be
3385596034SKevin Hilman *     included in all copies or substantial portions of the Software.
3485596034SKevin Hilman *
3585596034SKevin Hilman *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3685596034SKevin Hilman *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
3785596034SKevin Hilman *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3885596034SKevin Hilman *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
3985596034SKevin Hilman *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
4085596034SKevin Hilman *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4185596034SKevin Hilman *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
4285596034SKevin Hilman *     OTHER DEALINGS IN THE SOFTWARE.
4385596034SKevin Hilman */
4485596034SKevin Hilman
4585596034SKevin Hilman/dts-v1/;
4685596034SKevin Hilman
4785596034SKevin Hilman#include "meson-gxbb.dtsi"
48f40d437fSCarlo Caione#include <dt-bindings/gpio/gpio.h>
4985596034SKevin Hilman
5085596034SKevin Hilman/ {
5185596034SKevin Hilman	compatible = "hardkernel,odroid-c2", "amlogic,meson-gxbb";
5285596034SKevin Hilman	model = "Hardkernel ODROID-C2";
5385596034SKevin Hilman
5485596034SKevin Hilman	aliases {
5585596034SKevin Hilman		serial0 = &uart_AO;
56059a58fcSJorge Ramirez-Ortiz		ethernet0 = &ethmac;
5785596034SKevin Hilman	};
5885596034SKevin Hilman
5985596034SKevin Hilman	chosen {
6085596034SKevin Hilman		stdout-path = "serial0:115200n8";
6185596034SKevin Hilman	};
6285596034SKevin Hilman
6385596034SKevin Hilman	memory@0 {
6485596034SKevin Hilman		device_type = "memory";
6585596034SKevin Hilman		reg = <0x0 0x0 0x0 0x80000000>;
6685596034SKevin Hilman	};
67f40d437fSCarlo Caione
685a0803bdSBrian Kim	usb_otg_pwr: regulator-usb-pwrs {
695a0803bdSBrian Kim		compatible = "regulator-fixed";
705a0803bdSBrian Kim
715a0803bdSBrian Kim		regulator-name = "USB_OTG_PWR";
725a0803bdSBrian Kim
735a0803bdSBrian Kim		regulator-min-microvolt = <5000000>;
745a0803bdSBrian Kim		regulator-max-microvolt = <5000000>;
755a0803bdSBrian Kim
765a0803bdSBrian Kim		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
775a0803bdSBrian Kim		enable-active-high;
785a0803bdSBrian Kim	};
795a0803bdSBrian Kim
80f40d437fSCarlo Caione	leds {
81f40d437fSCarlo Caione		compatible = "gpio-leds";
82f40d437fSCarlo Caione		blue {
83f40d437fSCarlo Caione			label = "c2:blue:alive";
84f40d437fSCarlo Caione			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
85f40d437fSCarlo Caione			linux,default-trigger = "heartbeat";
86f40d437fSCarlo Caione			default-state = "off";
87f40d437fSCarlo Caione		};
88f40d437fSCarlo Caione	};
89ef8d2ffeSKevin Hilman
90ef8d2ffeSKevin Hilman	tflash_vdd: regulator-tflash_vdd {
91ef8d2ffeSKevin Hilman		/*
92ef8d2ffeSKevin Hilman		 * signal name from schematics: TFLASH_VDD_EN
93ef8d2ffeSKevin Hilman		 */
94ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
95ef8d2ffeSKevin Hilman
96ef8d2ffeSKevin Hilman		regulator-name = "TFLASH_VDD";
97ef8d2ffeSKevin Hilman		regulator-min-microvolt = <3300000>;
98ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
99ef8d2ffeSKevin Hilman
100c34cd35eSNeil Armstrong		gpio = <&gpio GPIOY_12 GPIO_ACTIVE_HIGH>;
101ef8d2ffeSKevin Hilman		enable-active-high;
102ef8d2ffeSKevin Hilman	};
103ef8d2ffeSKevin Hilman
104ef8d2ffeSKevin Hilman	tf_io: gpio-regulator-tf_io {
105ef8d2ffeSKevin Hilman		compatible = "regulator-gpio";
106ef8d2ffeSKevin Hilman
107ef8d2ffeSKevin Hilman		regulator-name = "TF_IO";
108ef8d2ffeSKevin Hilman		regulator-min-microvolt = <1800000>;
109ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
110ef8d2ffeSKevin Hilman
111ef8d2ffeSKevin Hilman		/*
112ef8d2ffeSKevin Hilman		 * signal name from schematics: TF_3V3N_1V8_EN
113ef8d2ffeSKevin Hilman		 */
114ef8d2ffeSKevin Hilman		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
115ef8d2ffeSKevin Hilman		gpios-states = <0>;
116ef8d2ffeSKevin Hilman
117ef8d2ffeSKevin Hilman		states = <3300000 0
118ef8d2ffeSKevin Hilman			  1800000 1>;
119ef8d2ffeSKevin Hilman	};
120ef8d2ffeSKevin Hilman
121ef8d2ffeSKevin Hilman	vcc1v8: regulator-vcc1v8 {
122ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
123ef8d2ffeSKevin Hilman		regulator-name = "VCC1V8";
124ef8d2ffeSKevin Hilman		regulator-min-microvolt = <1800000>;
125ef8d2ffeSKevin Hilman		regulator-max-microvolt = <1800000>;
126ef8d2ffeSKevin Hilman	};
127ef8d2ffeSKevin Hilman
128ef8d2ffeSKevin Hilman	vcc3v3: regulator-vcc3v3 {
129ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
130ef8d2ffeSKevin Hilman		regulator-name = "VCC3V3";
131ef8d2ffeSKevin Hilman		regulator-min-microvolt = <3300000>;
132ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
133ef8d2ffeSKevin Hilman	};
134ef8d2ffeSKevin Hilman
135ef8d2ffeSKevin Hilman	emmc_pwrseq: emmc-pwrseq {
136ef8d2ffeSKevin Hilman		compatible = "mmc-pwrseq-emmc";
137ef8d2ffeSKevin Hilman		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
138ef8d2ffeSKevin Hilman	};
139fc19afa1SNeil Armstrong
140fc19afa1SNeil Armstrong	hdmi-connector {
141fc19afa1SNeil Armstrong		compatible = "hdmi-connector";
142fc19afa1SNeil Armstrong		type = "a";
143fc19afa1SNeil Armstrong
144fc19afa1SNeil Armstrong		port {
145fc19afa1SNeil Armstrong			hdmi_connector_in: endpoint {
146fc19afa1SNeil Armstrong				remote-endpoint = <&hdmi_tx_tmds_out>;
147fc19afa1SNeil Armstrong			};
148fc19afa1SNeil Armstrong		};
149fc19afa1SNeil Armstrong	};
150fc19afa1SNeil Armstrong};
151fc19afa1SNeil Armstrong
152fc19afa1SNeil Armstrong&cec_AO {
153fc19afa1SNeil Armstrong	status = "okay";
154fc19afa1SNeil Armstrong	pinctrl-0 = <&ao_cec_pins>;
155fc19afa1SNeil Armstrong	pinctrl-names = "default";
156fc19afa1SNeil Armstrong	hdmi-phandle = <&hdmi_tx>;
15785596034SKevin Hilman};
15885596034SKevin Hilman
1598c5509f0SKevin Hilman&ethmac {
1608c5509f0SKevin Hilman	status = "okay";
1613be2d9cfSNeil Armstrong	pinctrl-0 = <&eth_rgmii_pins>;
1628c5509f0SKevin Hilman	pinctrl-names = "default";
163feb3cbeaSJerome Brunet	phy-handle = <&eth_phy0>;
164b6ff2721SMartin Blumenstingl	phy-mode = "rgmii";
165b6ff2721SMartin Blumenstingl
166b6ff2721SMartin Blumenstingl	snps,reset-gpio = <&gpio GPIOZ_14 0>;
167b6ff2721SMartin Blumenstingl	snps,reset-delays-us = <0 10000 1000000>;
168b6ff2721SMartin Blumenstingl	snps,reset-active-low;
169feb3cbeaSJerome Brunet
170093d23dbSMartin Blumenstingl	amlogic,tx-delay-ns = <2>;
171093d23dbSMartin Blumenstingl
172feb3cbeaSJerome Brunet	mdio {
173feb3cbeaSJerome Brunet		compatible = "snps,dwmac-mdio";
174feb3cbeaSJerome Brunet		#address-cells = <1>;
175feb3cbeaSJerome Brunet		#size-cells = <0>;
176feb3cbeaSJerome Brunet
177feb3cbeaSJerome Brunet		eth_phy0: ethernet-phy@0 {
17850290cfeSMartin Blumenstingl			/* Realtek RTL8211F (0x001cc916) */
179feb3cbeaSJerome Brunet			reg = <0>;
180b94d22d9SJerome Brunet			interrupt-parent = <&gpio_intc>;
18150290cfeSMartin Blumenstingl			/* MAC_INTR on GPIOZ_15 */
182b94d22d9SJerome Brunet			interrupts = <29 IRQ_TYPE_LEVEL_LOW>;
183feb3cbeaSJerome Brunet			eee-broken-1000t;
184feb3cbeaSJerome Brunet		};
185feb3cbeaSJerome Brunet	};
1868c5509f0SKevin Hilman};
1878c5509f0SKevin Hilman
1883b69bdbfSAndreas Färber&gpio_ao {
1893b69bdbfSAndreas Färber	/*
1903b69bdbfSAndreas Färber	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
1913b69bdbfSAndreas Färber	 * to be turned high in order to be detected by the USB Controller
1923b69bdbfSAndreas Färber	 * This signal should be handled by a USB specific power sequence
1933b69bdbfSAndreas Färber	 * in order to reset the Hub when USB bus is powered down.
1943b69bdbfSAndreas Färber	 */
1953b69bdbfSAndreas Färber	usb-hub {
1963b69bdbfSAndreas Färber		gpio-hog;
1973b69bdbfSAndreas Färber		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
1983b69bdbfSAndreas Färber		output-high;
1993b69bdbfSAndreas Färber		line-name = "usb-hub-reset";
2003b69bdbfSAndreas Färber	};
2013b69bdbfSAndreas Färber};
2023b69bdbfSAndreas Färber
203fc19afa1SNeil Armstrong&hdmi_tx {
204fc19afa1SNeil Armstrong	status = "okay";
205fc19afa1SNeil Armstrong	pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
206fc19afa1SNeil Armstrong	pinctrl-names = "default";
207fc19afa1SNeil Armstrong};
208fc19afa1SNeil Armstrong
209fc19afa1SNeil Armstrong&hdmi_tx_tmds_port {
210fc19afa1SNeil Armstrong	hdmi_tx_tmds_out: endpoint {
211fc19afa1SNeil Armstrong		remote-endpoint = <&hdmi_connector_in>;
212fc19afa1SNeil Armstrong	};
213fc19afa1SNeil Armstrong};
214fc19afa1SNeil Armstrong
2153b69bdbfSAndreas Färber&i2c_A {
2163b69bdbfSAndreas Färber	status = "okay";
2173b69bdbfSAndreas Färber	pinctrl-0 = <&i2c_a_pins>;
2183b69bdbfSAndreas Färber	pinctrl-names = "default";
2193b69bdbfSAndreas Färber};
2203b69bdbfSAndreas Färber
2213b69bdbfSAndreas Färber&ir {
2223b69bdbfSAndreas Färber	status = "okay";
2233b69bdbfSAndreas Färber	pinctrl-0 = <&remote_input_ao_pins>;
2243b69bdbfSAndreas Färber	pinctrl-names = "default";
2253b69bdbfSAndreas Färber};
2263b69bdbfSAndreas Färber
227b03c7d64SNeil Armstrong&pinctrl_aobus {
228b03c7d64SNeil Armstrong	gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
229b03c7d64SNeil Armstrong			  "USB HUB nRESET", "USB OTG Power En",
230b03c7d64SNeil Armstrong			  "J7 Header Pin2", "IR In", "J7 Header Pin4",
231b03c7d64SNeil Armstrong			  "J7 Header Pin6", "J7 Header Pin5", "J7 Header Pin7",
232e43f20e8SJerome Brunet			  "HDMI CEC", "SYS LED",
233e43f20e8SJerome Brunet			  /* GPIO_TEST_N */
234e43f20e8SJerome Brunet			  "";
235b03c7d64SNeil Armstrong};
236b03c7d64SNeil Armstrong
237b03c7d64SNeil Armstrong&pinctrl_periphs {
238b03c7d64SNeil Armstrong	gpio-line-names = /* Bank GPIOZ */
239b03c7d64SNeil Armstrong			  "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
240b03c7d64SNeil Armstrong			  "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
241b03c7d64SNeil Armstrong			  "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
242b03c7d64SNeil Armstrong			  "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
243b03c7d64SNeil Armstrong			  "Eth PHY nRESET", "Eth PHY Intc",
244b03c7d64SNeil Armstrong			  /* Bank GPIOH */
245b03c7d64SNeil Armstrong			  "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL", "",
246b03c7d64SNeil Armstrong			  /* Bank BOOT */
247b03c7d64SNeil Armstrong			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
248b03c7d64SNeil Armstrong			  "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
249b03c7d64SNeil Armstrong			  "eMMC Reset", "eMMC CMD",
250b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "",
251b03c7d64SNeil Armstrong			  /* Bank CARD */
252b03c7d64SNeil Armstrong			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
253b03c7d64SNeil Armstrong			  "SDCard D3", "SDCard D2", "SDCard Det",
254b03c7d64SNeil Armstrong			  /* Bank GPIODV */
255b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "", "", "", "", "", "", "",
256b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "", "", "", "", "",
257b03c7d64SNeil Armstrong			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
258b03c7d64SNeil Armstrong			  "PWM D", "PWM B",
259b03c7d64SNeil Armstrong			  /* Bank GPIOY */
260b03c7d64SNeil Armstrong			  "Revision Bit0", "Revision Bit1", "",
261b03c7d64SNeil Armstrong			  "J2 Header Pin35", "", "", "", "J2 Header Pin36",
262b03c7d64SNeil Armstrong			  "J2 Header Pin31", "", "", "", "TF VDD En",
263b03c7d64SNeil Armstrong			  "J2 Header Pin32", "J2 Header Pin26", "", "",
264b03c7d64SNeil Armstrong			  /* Bank GPIOX */
265b03c7d64SNeil Armstrong			  "J2 Header Pin29", "J2 Header Pin24",
266b03c7d64SNeil Armstrong			  "J2 Header Pin23", "J2 Header Pin22",
267b03c7d64SNeil Armstrong			  "J2 Header Pin21", "J2 Header Pin18",
268b03c7d64SNeil Armstrong			  "J2 Header Pin33", "J2 Header Pin19",
269b03c7d64SNeil Armstrong			  "J2 Header Pin16", "J2 Header Pin15",
270b03c7d64SNeil Armstrong			  "J2 Header Pin12", "J2 Header Pin13",
271b03c7d64SNeil Armstrong			  "J2 Header Pin8", "J2 Header Pin10",
272b03c7d64SNeil Armstrong			  "", "", "", "", "",
273e43f20e8SJerome Brunet			  "J2 Header Pin11", "", "J2 Header Pin7", "",
274b03c7d64SNeil Armstrong			  /* Bank GPIOCLK */
275e43f20e8SJerome Brunet			  "", "", "", "";
276b03c7d64SNeil Armstrong};
277b03c7d64SNeil Armstrong
27862158c6aSHeiner Kallweit&saradc {
27962158c6aSHeiner Kallweit	status = "okay";
28062158c6aSHeiner Kallweit	vref-supply = <&vcc1v8>;
28162158c6aSHeiner Kallweit};
28262158c6aSHeiner Kallweit
2833b69bdbfSAndreas Färber&scpi_clocks {
2843b69bdbfSAndreas Färber	status = "disabled";
2853b69bdbfSAndreas Färber};
2863b69bdbfSAndreas Färber
287ef8d2ffeSKevin Hilman/* SD */
288ef8d2ffeSKevin Hilman&sd_emmc_b {
289ef8d2ffeSKevin Hilman	status = "okay";
290ef8d2ffeSKevin Hilman	pinctrl-0 = <&sdcard_pins>;
29167e7607fSJerome Brunet	pinctrl-1 = <&sdcard_clk_gate_pins>;
29267e7607fSJerome Brunet	pinctrl-names = "default", "clk-gate";
293ef8d2ffeSKevin Hilman
294ef8d2ffeSKevin Hilman	bus-width = <4>;
295ef8d2ffeSKevin Hilman	cap-sd-highspeed;
296ef8d2ffeSKevin Hilman	max-frequency = <100000000>;
297ef8d2ffeSKevin Hilman	disable-wp;
298ef8d2ffeSKevin Hilman
299ef8d2ffeSKevin Hilman	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
300ef8d2ffeSKevin Hilman	cd-inverted;
301ef8d2ffeSKevin Hilman
302ef8d2ffeSKevin Hilman	vmmc-supply = <&tflash_vdd>;
303ef8d2ffeSKevin Hilman	vqmmc-supply = <&tf_io>;
304ef8d2ffeSKevin Hilman};
305ef8d2ffeSKevin Hilman
306ef8d2ffeSKevin Hilman/* eMMC */
307ef8d2ffeSKevin Hilman&sd_emmc_c {
308ef8d2ffeSKevin Hilman	status = "okay";
309ab36be66SNeil Armstrong	pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
31067e7607fSJerome Brunet	pinctrl-1 = <&emmc_clk_gate_pins>;
31167e7607fSJerome Brunet	pinctrl-names = "default", "clk-gate";
312ef8d2ffeSKevin Hilman
313ef8d2ffeSKevin Hilman	bus-width = <8>;
314ef8d2ffeSKevin Hilman	max-frequency = <200000000>;
315ef8d2ffeSKevin Hilman	non-removable;
316ef8d2ffeSKevin Hilman	disable-wp;
317ef8d2ffeSKevin Hilman	cap-mmc-highspeed;
318ef8d2ffeSKevin Hilman	mmc-ddr-1_8v;
319ef8d2ffeSKevin Hilman	mmc-hs200-1_8v;
320ef8d2ffeSKevin Hilman
321ef8d2ffeSKevin Hilman	mmc-pwrseq = <&emmc_pwrseq>;
322ef8d2ffeSKevin Hilman	vmmc-supply = <&vcc3v3>;
323ef8d2ffeSKevin Hilman	vqmmc-supply = <&vcc1v8>;
324ef8d2ffeSKevin Hilman};
3253b69bdbfSAndreas Färber
3263b69bdbfSAndreas Färber&uart_AO {
3273b69bdbfSAndreas Färber	status = "okay";
3283b69bdbfSAndreas Färber	pinctrl-0 = <&uart_ao_a_pins>;
3293b69bdbfSAndreas Färber	pinctrl-names = "default";
3303b69bdbfSAndreas Färber};
3313b69bdbfSAndreas Färber
3323b69bdbfSAndreas Färber&usb0_phy {
3333b69bdbfSAndreas Färber	status = "okay";
3343b69bdbfSAndreas Färber	phy-supply = <&usb_otg_pwr>;
3353b69bdbfSAndreas Färber};
3363b69bdbfSAndreas Färber
3373b69bdbfSAndreas Färber&usb1_phy {
3383b69bdbfSAndreas Färber	status = "okay";
339e841ec95SNeil Armstrong	phy-supply = <&usb_otg_pwr>;
3403b69bdbfSAndreas Färber};
3413b69bdbfSAndreas Färber
3423b69bdbfSAndreas Färber&usb0 {
3433b69bdbfSAndreas Färber	status = "okay";
3443b69bdbfSAndreas Färber};
3453b69bdbfSAndreas Färber
3463b69bdbfSAndreas Färber&usb1 {
3473b69bdbfSAndreas Färber	status = "okay";
3483b69bdbfSAndreas Färber};
349