1ec770dbaSHans de Goede/*
2ec770dbaSHans de Goede * Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
3ec770dbaSHans de Goede *
4ec770dbaSHans de Goede * This file is dual-licensed: you can use it either under the terms
5ec770dbaSHans de Goede * of the GPL or the X11 license, at your option. Note that this dual
6ec770dbaSHans de Goede * licensing only applies to this file, and not this project as a
7ec770dbaSHans de Goede * whole.
8ec770dbaSHans de Goede *
9ec770dbaSHans de Goede *  a) This file is free software; you can redistribute it and/or
10ec770dbaSHans de Goede *     modify it under the terms of the GNU General Public License as
11ec770dbaSHans de Goede *     published by the Free Software Foundation; either version 2 of the
12ec770dbaSHans de Goede *     License, or (at your option) any later version.
13ec770dbaSHans de Goede *
14ec770dbaSHans de Goede *     This file is distributed in the hope that it will be useful,
15ec770dbaSHans de Goede *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16ec770dbaSHans de Goede *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17ec770dbaSHans de Goede *     GNU General Public License for more details.
18ec770dbaSHans de Goede *
19ec770dbaSHans de Goede * Or, alternatively,
20ec770dbaSHans de Goede *
21ec770dbaSHans de Goede *  b) Permission is hereby granted, free of charge, to any person
22ec770dbaSHans de Goede *     obtaining a copy of this software and associated documentation
23ec770dbaSHans de Goede *     files (the "Software"), to deal in the Software without
24ec770dbaSHans de Goede *     restriction, including without limitation the rights to use,
25ec770dbaSHans de Goede *     copy, modify, merge, publish, distribute, sublicense, and/or
26ec770dbaSHans de Goede *     sell copies of the Software, and to permit persons to whom the
27ec770dbaSHans de Goede *     Software is furnished to do so, subject to the following
28ec770dbaSHans de Goede *     conditions:
29ec770dbaSHans de Goede *
30ec770dbaSHans de Goede *     The above copyright notice and this permission notice shall be
31ec770dbaSHans de Goede *     included in all copies or substantial portions of the Software.
32ec770dbaSHans de Goede *
33ec770dbaSHans de Goede *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34ec770dbaSHans de Goede *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35ec770dbaSHans de Goede *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36ec770dbaSHans de Goede *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37ec770dbaSHans de Goede *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38ec770dbaSHans de Goede *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39ec770dbaSHans de Goede *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40ec770dbaSHans de Goede *     OTHER DEALINGS IN THE SOFTWARE.
41ec770dbaSHans de Goede */
42ec770dbaSHans de Goede
43ec770dbaSHans de Goede/dts-v1/;
44ec770dbaSHans de Goede#include "sun8i-h3.dtsi"
45ec770dbaSHans de Goede#include "sunxi-common-regulators.dtsi"
46ec770dbaSHans de Goede
47ec770dbaSHans de Goede#include <dt-bindings/gpio/gpio.h>
48ec770dbaSHans de Goede#include <dt-bindings/input/input.h>
49ec770dbaSHans de Goede
50ec770dbaSHans de Goede/ {
51ec770dbaSHans de Goede	model = "Xunlong Orange Pi One";
52ec770dbaSHans de Goede	compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";
53ec770dbaSHans de Goede
54ec770dbaSHans de Goede	aliases {
55e88d2a57SAndre Przywara		ethernet0 = &emac;
56ec770dbaSHans de Goede		serial0 = &uart0;
57ec770dbaSHans de Goede	};
58ec770dbaSHans de Goede
59ec770dbaSHans de Goede	chosen {
60ec770dbaSHans de Goede		stdout-path = "serial0:115200n8";
61ec770dbaSHans de Goede	};
62ec770dbaSHans de Goede
63*2d0c3d6bSAndre Przywara	connector {
64*2d0c3d6bSAndre Przywara		compatible = "hdmi-connector";
65*2d0c3d6bSAndre Przywara		type = "a";
66*2d0c3d6bSAndre Przywara
67*2d0c3d6bSAndre Przywara		port {
68*2d0c3d6bSAndre Przywara			hdmi_con_in: endpoint {
69*2d0c3d6bSAndre Przywara				remote-endpoint = <&hdmi_out_con>;
70*2d0c3d6bSAndre Przywara			};
71*2d0c3d6bSAndre Przywara		};
72*2d0c3d6bSAndre Przywara	};
73*2d0c3d6bSAndre Przywara
74ec770dbaSHans de Goede	leds {
75ec770dbaSHans de Goede		compatible = "gpio-leds";
76ec770dbaSHans de Goede		pinctrl-names = "default";
77ec770dbaSHans de Goede		pinctrl-0 = <&leds_opc>, <&leds_r_opc>;
78ec770dbaSHans de Goede
79ec770dbaSHans de Goede		pwr_led {
80ec770dbaSHans de Goede			label = "orangepi:green:pwr";
81ec770dbaSHans de Goede			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
82ec770dbaSHans de Goede			default-state = "on";
83ec770dbaSHans de Goede		};
84ec770dbaSHans de Goede
85ec770dbaSHans de Goede		status_led {
86ec770dbaSHans de Goede			label = "orangepi:red:status";
87ec770dbaSHans de Goede			gpios = <&pio 0 15 GPIO_ACTIVE_HIGH>;
88ec770dbaSHans de Goede		};
89ec770dbaSHans de Goede	};
90ec770dbaSHans de Goede
91ec770dbaSHans de Goede	r_gpio_keys {
92ec770dbaSHans de Goede		compatible = "gpio-keys";
93ec770dbaSHans de Goede		pinctrl-names = "default";
94ec770dbaSHans de Goede		pinctrl-0 = <&sw_r_opc>;
95ec770dbaSHans de Goede
96ec770dbaSHans de Goede		sw4 {
97ec770dbaSHans de Goede			label = "sw4";
98ec770dbaSHans de Goede			linux,code = <BTN_0>;
99ec770dbaSHans de Goede			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
100ec770dbaSHans de Goede		};
101ec770dbaSHans de Goede	};
102*2d0c3d6bSAndre Przywara
103*2d0c3d6bSAndre Przywara	reg_vdd_cpux: vdd-cpux-regulator {
104*2d0c3d6bSAndre Przywara		compatible = "regulator-gpio";
105*2d0c3d6bSAndre Przywara		regulator-name = "vdd-cpux";
106*2d0c3d6bSAndre Przywara		regulator-type = "voltage";
107*2d0c3d6bSAndre Przywara		regulator-boot-on;
108*2d0c3d6bSAndre Przywara		regulator-always-on;
109*2d0c3d6bSAndre Przywara		regulator-min-microvolt = <1100000>;
110*2d0c3d6bSAndre Przywara		regulator-max-microvolt = <1300000>;
111*2d0c3d6bSAndre Przywara		regulator-ramp-delay = <50>; /* 4ms */
112*2d0c3d6bSAndre Przywara
113*2d0c3d6bSAndre Przywara		gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
114*2d0c3d6bSAndre Przywara		enable-active-high;
115*2d0c3d6bSAndre Przywara		gpios-states = <0x1>;
116*2d0c3d6bSAndre Przywara		states = <1100000 0x0
117*2d0c3d6bSAndre Przywara			  1300000 0x1>;
118*2d0c3d6bSAndre Przywara	};
119*2d0c3d6bSAndre Przywara};
120*2d0c3d6bSAndre Przywara
121*2d0c3d6bSAndre Przywara&cpu0 {
122*2d0c3d6bSAndre Przywara	cpu-supply = <&reg_vdd_cpux>;
123*2d0c3d6bSAndre Przywara};
124*2d0c3d6bSAndre Przywara
125*2d0c3d6bSAndre Przywara&de {
126*2d0c3d6bSAndre Przywara	status = "okay";
127*2d0c3d6bSAndre Przywara};
128*2d0c3d6bSAndre Przywara
129*2d0c3d6bSAndre Przywara&ehci0 {
130*2d0c3d6bSAndre Przywara	status = "okay";
131ec770dbaSHans de Goede};
132ec770dbaSHans de Goede
133ec770dbaSHans de Goede&ehci1 {
134ec770dbaSHans de Goede	status = "okay";
135ec770dbaSHans de Goede};
136ec770dbaSHans de Goede
137fcada3b0SHans de Goede&emac {
138e88d2a57SAndre Przywara	phy-handle = <&int_mii_phy>;
139fcada3b0SHans de Goede	phy-mode = "mii";
140fcada3b0SHans de Goede	allwinner,leds-active-low;
141fcada3b0SHans de Goede	status = "okay";
142fcada3b0SHans de Goede};
143fcada3b0SHans de Goede
144*2d0c3d6bSAndre Przywara&hdmi {
145*2d0c3d6bSAndre Przywara	status = "okay";
146*2d0c3d6bSAndre Przywara};
147*2d0c3d6bSAndre Przywara
148*2d0c3d6bSAndre Przywara&hdmi_out {
149*2d0c3d6bSAndre Przywara	hdmi_out_con: endpoint {
150*2d0c3d6bSAndre Przywara		remote-endpoint = <&hdmi_con_in>;
151*2d0c3d6bSAndre Przywara	};
152*2d0c3d6bSAndre Przywara};
153*2d0c3d6bSAndre Przywara
154ec770dbaSHans de Goede&mmc0 {
155ec770dbaSHans de Goede	vmmc-supply = <&reg_vcc3v3>;
156ec770dbaSHans de Goede	bus-width = <4>;
157*2d0c3d6bSAndre Przywara	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
158*2d0c3d6bSAndre Przywara	status = "okay";
159*2d0c3d6bSAndre Przywara};
160*2d0c3d6bSAndre Przywara
161*2d0c3d6bSAndre Przywara&ohci0 {
162ec770dbaSHans de Goede	status = "okay";
163ec770dbaSHans de Goede};
164ec770dbaSHans de Goede
165ec770dbaSHans de Goede&ohci1 {
166ec770dbaSHans de Goede	status = "okay";
167ec770dbaSHans de Goede};
168ec770dbaSHans de Goede
169ec770dbaSHans de Goede&pio {
170*2d0c3d6bSAndre Przywara	leds_opc: led_pins {
171*2d0c3d6bSAndre Przywara		pins = "PA15";
172*2d0c3d6bSAndre Przywara		function = "gpio_out";
173ec770dbaSHans de Goede	};
174ec770dbaSHans de Goede};
175ec770dbaSHans de Goede
176ec770dbaSHans de Goede&r_pio {
177*2d0c3d6bSAndre Przywara	leds_r_opc: led_pins {
178*2d0c3d6bSAndre Przywara		pins = "PL10";
179*2d0c3d6bSAndre Przywara		function = "gpio_out";
180ec770dbaSHans de Goede	};
181ec770dbaSHans de Goede
182*2d0c3d6bSAndre Przywara	sw_r_opc: key_pins {
183*2d0c3d6bSAndre Przywara		pins = "PL3";
184*2d0c3d6bSAndre Przywara		function = "gpio_in";
185ec770dbaSHans de Goede	};
186ec770dbaSHans de Goede};
187ec770dbaSHans de Goede
188*2d0c3d6bSAndre Przywara&reg_usb0_vbus {
189*2d0c3d6bSAndre Przywara	gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
190*2d0c3d6bSAndre Przywara	status = "okay";
191*2d0c3d6bSAndre Przywara};
192*2d0c3d6bSAndre Przywara
193ec770dbaSHans de Goede&uart0 {
194ec770dbaSHans de Goede	pinctrl-names = "default";
195ec770dbaSHans de Goede	pinctrl-0 = <&uart0_pins_a>;
196ec770dbaSHans de Goede	status = "okay";
197ec770dbaSHans de Goede};
198ec770dbaSHans de Goede
199*2d0c3d6bSAndre Przywara&uart1 {
200*2d0c3d6bSAndre Przywara	pinctrl-names = "default";
201*2d0c3d6bSAndre Przywara	pinctrl-0 = <&uart1_pins>;
202*2d0c3d6bSAndre Przywara	status = "disabled";
203*2d0c3d6bSAndre Przywara};
204*2d0c3d6bSAndre Przywara
205*2d0c3d6bSAndre Przywara&uart2 {
206*2d0c3d6bSAndre Przywara	pinctrl-names = "default";
207*2d0c3d6bSAndre Przywara	pinctrl-0 = <&uart2_pins>;
208*2d0c3d6bSAndre Przywara	status = "disabled";
209*2d0c3d6bSAndre Przywara};
210*2d0c3d6bSAndre Przywara
211*2d0c3d6bSAndre Przywara&uart3 {
212*2d0c3d6bSAndre Przywara	pinctrl-names = "default";
213*2d0c3d6bSAndre Przywara	pinctrl-0 = <&uart3_pins>;
214*2d0c3d6bSAndre Przywara	status = "disabled";
215*2d0c3d6bSAndre Przywara};
216*2d0c3d6bSAndre Przywara
217*2d0c3d6bSAndre Przywara&usb_otg {
218*2d0c3d6bSAndre Przywara	dr_mode = "otg";
219*2d0c3d6bSAndre Przywara	status = "okay";
220*2d0c3d6bSAndre Przywara};
221*2d0c3d6bSAndre Przywara
222ec770dbaSHans de Goede&usbphy {
223*2d0c3d6bSAndre Przywara	/* USB Type-A port's VBUS is always on */
224*2d0c3d6bSAndre Przywara	usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */
225*2d0c3d6bSAndre Przywara	usb0_vbus-supply = <&reg_usb0_vbus>;
226ec770dbaSHans de Goede	status = "okay";
227ec770dbaSHans de Goede};
228