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;
5685596034SKevin Hilman	};
5785596034SKevin Hilman
5885596034SKevin Hilman	chosen {
5985596034SKevin Hilman		stdout-path = "serial0:115200n8";
6085596034SKevin Hilman	};
6185596034SKevin Hilman
6285596034SKevin Hilman	memory@0 {
6385596034SKevin Hilman		device_type = "memory";
6485596034SKevin Hilman		reg = <0x0 0x0 0x0 0x80000000>;
6585596034SKevin Hilman	};
66f40d437fSCarlo Caione
675a0803bdSBrian Kim	usb_otg_pwr: regulator-usb-pwrs {
685a0803bdSBrian Kim		compatible = "regulator-fixed";
695a0803bdSBrian Kim
705a0803bdSBrian Kim		regulator-name = "USB_OTG_PWR";
715a0803bdSBrian Kim
725a0803bdSBrian Kim		regulator-min-microvolt = <5000000>;
735a0803bdSBrian Kim		regulator-max-microvolt = <5000000>;
745a0803bdSBrian Kim
755a0803bdSBrian Kim		gpio = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
765a0803bdSBrian Kim		enable-active-high;
775a0803bdSBrian Kim	};
785a0803bdSBrian Kim
79f40d437fSCarlo Caione	leds {
80f40d437fSCarlo Caione		compatible = "gpio-leds";
81f40d437fSCarlo Caione		blue {
82f40d437fSCarlo Caione			label = "c2:blue:alive";
83f40d437fSCarlo Caione			gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>;
84f40d437fSCarlo Caione			linux,default-trigger = "heartbeat";
85f40d437fSCarlo Caione			default-state = "off";
86f40d437fSCarlo Caione		};
87f40d437fSCarlo Caione	};
88ef8d2ffeSKevin Hilman
89ef8d2ffeSKevin Hilman	tflash_vdd: regulator-tflash_vdd {
90ef8d2ffeSKevin Hilman		/*
91ef8d2ffeSKevin Hilman		 * signal name from schematics: TFLASH_VDD_EN
92ef8d2ffeSKevin Hilman		 */
93ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
94ef8d2ffeSKevin Hilman
95ef8d2ffeSKevin Hilman		regulator-name = "TFLASH_VDD";
96ef8d2ffeSKevin Hilman		regulator-min-microvolt = <3300000>;
97ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
98ef8d2ffeSKevin Hilman
99c34cd35eSNeil Armstrong		gpio = <&gpio GPIOY_12 GPIO_ACTIVE_HIGH>;
100ef8d2ffeSKevin Hilman		enable-active-high;
101ef8d2ffeSKevin Hilman	};
102ef8d2ffeSKevin Hilman
103ef8d2ffeSKevin Hilman	tf_io: gpio-regulator-tf_io {
104ef8d2ffeSKevin Hilman		compatible = "regulator-gpio";
105ef8d2ffeSKevin Hilman
106ef8d2ffeSKevin Hilman		regulator-name = "TF_IO";
107ef8d2ffeSKevin Hilman		regulator-min-microvolt = <1800000>;
108ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
109ef8d2ffeSKevin Hilman
110ef8d2ffeSKevin Hilman		/*
111ef8d2ffeSKevin Hilman		 * signal name from schematics: TF_3V3N_1V8_EN
112ef8d2ffeSKevin Hilman		 */
113ef8d2ffeSKevin Hilman		gpios = <&gpio_ao GPIOAO_3 GPIO_ACTIVE_HIGH>;
114ef8d2ffeSKevin Hilman		gpios-states = <0>;
115ef8d2ffeSKevin Hilman
116ef8d2ffeSKevin Hilman		states = <3300000 0
117ef8d2ffeSKevin Hilman			  1800000 1>;
118ef8d2ffeSKevin Hilman	};
119ef8d2ffeSKevin Hilman
120ef8d2ffeSKevin Hilman	vcc1v8: regulator-vcc1v8 {
121ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
122ef8d2ffeSKevin Hilman		regulator-name = "VCC1V8";
123ef8d2ffeSKevin Hilman		regulator-min-microvolt = <1800000>;
124ef8d2ffeSKevin Hilman		regulator-max-microvolt = <1800000>;
125ef8d2ffeSKevin Hilman	};
126ef8d2ffeSKevin Hilman
127ef8d2ffeSKevin Hilman	vcc3v3: regulator-vcc3v3 {
128ef8d2ffeSKevin Hilman		compatible = "regulator-fixed";
129ef8d2ffeSKevin Hilman		regulator-name = "VCC3V3";
130ef8d2ffeSKevin Hilman		regulator-min-microvolt = <3300000>;
131ef8d2ffeSKevin Hilman		regulator-max-microvolt = <3300000>;
132ef8d2ffeSKevin Hilman	};
133ef8d2ffeSKevin Hilman
134ef8d2ffeSKevin Hilman	emmc_pwrseq: emmc-pwrseq {
135ef8d2ffeSKevin Hilman		compatible = "mmc-pwrseq-emmc";
136ef8d2ffeSKevin Hilman		reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
137ef8d2ffeSKevin Hilman	};
13885596034SKevin Hilman};
13985596034SKevin Hilman
140f7bcd4b6SNeil Armstrong&scpi_clocks {
141f7bcd4b6SNeil Armstrong	status = "disabled";
142f7bcd4b6SNeil Armstrong};
143f7bcd4b6SNeil Armstrong
14485596034SKevin Hilman&uart_AO {
14585596034SKevin Hilman	status = "okay";
146f40d437fSCarlo Caione	pinctrl-0 = <&uart_ao_a_pins>;
147f40d437fSCarlo Caione	pinctrl-names = "default";
14885596034SKevin Hilman};
1498e6320ddSKevin Hilman
1508c5509f0SKevin Hilman&ethmac {
1518c5509f0SKevin Hilman	status = "okay";
1523be2d9cfSNeil Armstrong	pinctrl-0 = <&eth_rgmii_pins>;
1538c5509f0SKevin Hilman	pinctrl-names = "default";
154feb3cbeaSJerome Brunet	phy-handle = <&eth_phy0>;
155b6ff2721SMartin Blumenstingl	phy-mode = "rgmii";
156b6ff2721SMartin Blumenstingl
157b6ff2721SMartin Blumenstingl	snps,reset-gpio = <&gpio GPIOZ_14 0>;
158b6ff2721SMartin Blumenstingl	snps,reset-delays-us = <0 10000 1000000>;
159b6ff2721SMartin Blumenstingl	snps,reset-active-low;
160feb3cbeaSJerome Brunet
161093d23dbSMartin Blumenstingl	amlogic,tx-delay-ns = <2>;
162093d23dbSMartin Blumenstingl
163feb3cbeaSJerome Brunet	mdio {
164feb3cbeaSJerome Brunet		compatible = "snps,dwmac-mdio";
165feb3cbeaSJerome Brunet		#address-cells = <1>;
166feb3cbeaSJerome Brunet		#size-cells = <0>;
167feb3cbeaSJerome Brunet
168feb3cbeaSJerome Brunet		eth_phy0: ethernet-phy@0 {
169feb3cbeaSJerome Brunet			reg = <0>;
170feb3cbeaSJerome Brunet			eee-broken-1000t;
171feb3cbeaSJerome Brunet		};
172feb3cbeaSJerome Brunet	};
1738c5509f0SKevin Hilman};
1748c5509f0SKevin Hilman
175b03c7d64SNeil Armstrong&pinctrl_aobus {
176b03c7d64SNeil Armstrong	gpio-line-names = "UART TX", "UART RX", "VCCK En", "TF 3V3/1V8 En",
177b03c7d64SNeil Armstrong			  "USB HUB nRESET", "USB OTG Power En",
178b03c7d64SNeil Armstrong			  "J7 Header Pin2", "IR In", "J7 Header Pin4",
179b03c7d64SNeil Armstrong			  "J7 Header Pin6", "J7 Header Pin5", "J7 Header Pin7",
180b03c7d64SNeil Armstrong			  "HDMI CEC", "SYS LED";
181b03c7d64SNeil Armstrong};
182b03c7d64SNeil Armstrong
183b03c7d64SNeil Armstrong&pinctrl_periphs {
184b03c7d64SNeil Armstrong	gpio-line-names = /* Bank GPIOZ */
185b03c7d64SNeil Armstrong			  "Eth MDIO", "Eth MDC", "Eth RGMII RX Clk",
186b03c7d64SNeil Armstrong			  "Eth RX DV", "Eth RX D0", "Eth RX D1", "Eth RX D2",
187b03c7d64SNeil Armstrong			  "Eth RX D3", "Eth RGMII TX Clk", "Eth TX En",
188b03c7d64SNeil Armstrong			  "Eth TX D0", "Eth TX D1", "Eth TX D2", "Eth TX D3",
189b03c7d64SNeil Armstrong			  "Eth PHY nRESET", "Eth PHY Intc",
190b03c7d64SNeil Armstrong			  /* Bank GPIOH */
191b03c7d64SNeil Armstrong			  "HDMI HPD", "HDMI DDC SDA", "HDMI DDC SCL", "",
192b03c7d64SNeil Armstrong			  /* Bank BOOT */
193b03c7d64SNeil Armstrong			  "eMMC D0", "eMMC D1", "eMMC D2", "eMMC D3", "eMMC D4",
194b03c7d64SNeil Armstrong			  "eMMC D5", "eMMC D6", "eMMC D7", "eMMC Clk",
195b03c7d64SNeil Armstrong			  "eMMC Reset", "eMMC CMD",
196b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "",
197b03c7d64SNeil Armstrong			  /* Bank CARD */
198b03c7d64SNeil Armstrong			  "SDCard D1", "SDCard D0", "SDCard CLK", "SDCard CMD",
199b03c7d64SNeil Armstrong			  "SDCard D3", "SDCard D2", "SDCard Det",
200b03c7d64SNeil Armstrong			  /* Bank GPIODV */
201b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "", "", "", "", "", "", "",
202b03c7d64SNeil Armstrong			  "", "", "", "", "", "", "", "", "", "", "",
203b03c7d64SNeil Armstrong			  "I2C A SDA", "I2C A SCK", "I2C B SDA", "I2C B SCK",
204b03c7d64SNeil Armstrong			  "PWM D", "PWM B",
205b03c7d64SNeil Armstrong			  /* Bank GPIOY */
206b03c7d64SNeil Armstrong			  "Revision Bit0", "Revision Bit1", "",
207b03c7d64SNeil Armstrong			  "J2 Header Pin35", "", "", "", "J2 Header Pin36",
208b03c7d64SNeil Armstrong			  "J2 Header Pin31", "", "", "", "TF VDD En",
209b03c7d64SNeil Armstrong			  "J2 Header Pin32", "J2 Header Pin26", "", "",
210b03c7d64SNeil Armstrong			  /* Bank GPIOX */
211b03c7d64SNeil Armstrong			  "J2 Header Pin29", "J2 Header Pin24",
212b03c7d64SNeil Armstrong			  "J2 Header Pin23", "J2 Header Pin22",
213b03c7d64SNeil Armstrong			  "J2 Header Pin21", "J2 Header Pin18",
214b03c7d64SNeil Armstrong			  "J2 Header Pin33", "J2 Header Pin19",
215b03c7d64SNeil Armstrong			  "J2 Header Pin16", "J2 Header Pin15",
216b03c7d64SNeil Armstrong			  "J2 Header Pin12", "J2 Header Pin13",
217b03c7d64SNeil Armstrong			  "J2 Header Pin8", "J2 Header Pin10",
218b03c7d64SNeil Armstrong			  "", "", "", "", "",
219b03c7d64SNeil Armstrong			  "J2 Header Pin11", "", "J2 Header Pin7",
220b03c7d64SNeil Armstrong			  /* Bank GPIOCLK */
221b03c7d64SNeil Armstrong			  "", "", "", "",
222b03c7d64SNeil Armstrong			  /* GPIO_TEST_N */
223b03c7d64SNeil Armstrong			  "";
224b03c7d64SNeil Armstrong};
225b03c7d64SNeil Armstrong
226ae89ed79SMartin Blumenstingl&ir {
227ae89ed79SMartin Blumenstingl	status = "okay";
228ae89ed79SMartin Blumenstingl	pinctrl-0 = <&remote_input_ao_pins>;
229ae89ed79SMartin Blumenstingl	pinctrl-names = "default";
230ae89ed79SMartin Blumenstingl};
231cb700f49SJerome Brunet
232cb700f49SJerome Brunet&i2c_A {
233cb700f49SJerome Brunet	status = "okay";
234cb700f49SJerome Brunet	pinctrl-0 = <&i2c_a_pins>;
235cb700f49SJerome Brunet	pinctrl-names = "default";
236cb700f49SJerome Brunet};
2375a0803bdSBrian Kim
2381db3b92cSNeil Armstrong&gpio_ao {
2391db3b92cSNeil Armstrong	/*
2401db3b92cSNeil Armstrong	 * WARNING: The USB Hub on the Odroid-C2 needs a reset signal
2411db3b92cSNeil Armstrong	 * to be turned high in order to be detected by the USB Controller
2421db3b92cSNeil Armstrong	 * This signal should be handled by a USB specific power sequence
2431db3b92cSNeil Armstrong	 * in order to reset the Hub when USB bus is powered down.
2441db3b92cSNeil Armstrong	 */
2451db3b92cSNeil Armstrong	usb-hub {
2461db3b92cSNeil Armstrong		gpio-hog;
2471db3b92cSNeil Armstrong		gpios = <GPIOAO_4 GPIO_ACTIVE_HIGH>;
2481db3b92cSNeil Armstrong		output-high;
2491db3b92cSNeil Armstrong		line-name = "usb-hub-reset";
2501db3b92cSNeil Armstrong	};
2511db3b92cSNeil Armstrong};
2521db3b92cSNeil Armstrong
2535a0803bdSBrian Kim&usb0_phy {
2545a0803bdSBrian Kim	status = "okay";
2555a0803bdSBrian Kim	phy-supply = <&usb_otg_pwr>;
2565a0803bdSBrian Kim};
2575a0803bdSBrian Kim
2585a0803bdSBrian Kim&usb1_phy {
2595a0803bdSBrian Kim	status = "okay";
2605a0803bdSBrian Kim};
2615a0803bdSBrian Kim
2625a0803bdSBrian Kim&usb0 {
2635a0803bdSBrian Kim	status = "okay";
2645a0803bdSBrian Kim};
2655a0803bdSBrian Kim
2665a0803bdSBrian Kim&usb1 {
2675a0803bdSBrian Kim	status = "okay";
2685a0803bdSBrian Kim};
269ef8d2ffeSKevin Hilman
27062158c6aSHeiner Kallweit&saradc {
27162158c6aSHeiner Kallweit	status = "okay";
27262158c6aSHeiner Kallweit	vref-supply = <&vcc1v8>;
27362158c6aSHeiner Kallweit};
27462158c6aSHeiner Kallweit
275ef8d2ffeSKevin Hilman/* SD */
276ef8d2ffeSKevin Hilman&sd_emmc_b {
277ef8d2ffeSKevin Hilman	status = "okay";
278ef8d2ffeSKevin Hilman	pinctrl-0 = <&sdcard_pins>;
279ef8d2ffeSKevin Hilman	pinctrl-names = "default";
280ef8d2ffeSKevin Hilman
281ef8d2ffeSKevin Hilman	bus-width = <4>;
282ef8d2ffeSKevin Hilman	cap-sd-highspeed;
283ef8d2ffeSKevin Hilman	max-frequency = <100000000>;
284ef8d2ffeSKevin Hilman	disable-wp;
285ef8d2ffeSKevin Hilman
286ef8d2ffeSKevin Hilman	cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_HIGH>;
287ef8d2ffeSKevin Hilman	cd-inverted;
288ef8d2ffeSKevin Hilman
289ef8d2ffeSKevin Hilman	vmmc-supply = <&tflash_vdd>;
290ef8d2ffeSKevin Hilman	vqmmc-supply = <&tf_io>;
291ef8d2ffeSKevin Hilman};
292ef8d2ffeSKevin Hilman
293ef8d2ffeSKevin Hilman/* eMMC */
294ef8d2ffeSKevin Hilman&sd_emmc_c {
295ef8d2ffeSKevin Hilman	status = "okay";
296ef8d2ffeSKevin Hilman	pinctrl-0 = <&emmc_pins>;
297ef8d2ffeSKevin Hilman	pinctrl-names = "default";
298ef8d2ffeSKevin Hilman
299ef8d2ffeSKevin Hilman	bus-width = <8>;
300ef8d2ffeSKevin Hilman	cap-sd-highspeed;
301ef8d2ffeSKevin Hilman	max-frequency = <200000000>;
302ef8d2ffeSKevin Hilman	non-removable;
303ef8d2ffeSKevin Hilman	disable-wp;
304ef8d2ffeSKevin Hilman	cap-mmc-highspeed;
305ef8d2ffeSKevin Hilman	mmc-ddr-1_8v;
306ef8d2ffeSKevin Hilman	mmc-hs200-1_8v;
307ef8d2ffeSKevin Hilman
308ef8d2ffeSKevin Hilman	mmc-pwrseq = <&emmc_pwrseq>;
309ef8d2ffeSKevin Hilman	vmmc-supply = <&vcc3v3>;
310ef8d2ffeSKevin Hilman	vqmmc-supply = <&vcc1v8>;
311ef8d2ffeSKevin Hilman};
312