1/*
2 * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.xyz>
3 *
4 * Based on sun50i-h5-orangepi-pc2.dts, which is:
5 *   Copyright (C) 2016 ARM Ltd.
6 *
7 * This file is dual-licensed: you can use it either under the terms
8 * of the GPL or the X11 license, at your option. Note that this dual
9 * licensing only applies to this file, and not this project as a
10 * whole.
11 *
12 *  a) This file is free software; you can redistribute it and/or
13 *     modify it under the terms of the GNU General Public License as
14 *     published by the Free Software Foundation; either version 2 of the
15 *     License, or (at your option) any later version.
16 *
17 *     This file is distributed in the hope that it will be useful,
18 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
19 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 *     GNU General Public License for more details.
21 *
22 * Or, alternatively,
23 *
24 *  b) Permission is hereby granted, free of charge, to any person
25 *     obtaining a copy of this software and associated documentation
26 *     files (the "Software"), to deal in the Software without
27 *     restriction, including without limitation the rights to use,
28 *     copy, modify, merge, publish, distribute, sublicense, and/or
29 *     sell copies of the Software, and to permit persons to whom the
30 *     Software is furnished to do so, subject to the following
31 *     conditions:
32 *
33 *     The above copyright notice and this permission notice shall be
34 *     included in all copies or substantial portions of the Software.
35 *
36 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43 *     OTHER DEALINGS IN THE SOFTWARE.
44 */
45
46/dts-v1/;
47#include "sun50i-h5.dtsi"
48
49#include <dt-bindings/gpio/gpio.h>
50#include <dt-bindings/input/input.h>
51
52/ {
53	model = "Xunlong Orange Pi Prime";
54	compatible = "xunlong,orangepi-prime", "allwinner,sun50i-h5";
55
56	reg_vcc3v3: vcc3v3 {
57		compatible = "regulator-fixed";
58		regulator-name = "vcc3v3";
59		regulator-min-microvolt = <3300000>;
60		regulator-max-microvolt = <3300000>;
61	};
62
63	aliases {
64		serial0 = &uart0;
65	};
66
67	chosen {
68		stdout-path = "serial0:115200n8";
69	};
70
71	leds {
72		compatible = "gpio-leds";
73
74		pwr {
75			label = "orangepi:green:pwr";
76			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
77			default-state = "on";
78		};
79
80		status {
81			label = "orangepi:red:status";
82			gpios = <&pio 0 20 GPIO_ACTIVE_HIGH>;
83		};
84	};
85
86	r-gpio-keys {
87		compatible = "gpio-keys";
88
89		sw4 {
90			label = "sw4";
91			linux,code = <BTN_0>;
92			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
93		};
94	};
95
96	reg_usb0_vbus: usb0-vbus {
97		compatible = "regulator-fixed";
98		regulator-name = "usb0-vbus";
99		regulator-min-microvolt = <5000000>;
100		regulator-max-microvolt = <5000000>;
101		enable-active-high;
102		gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
103		status = "okay";
104	};
105
106	wifi_pwrseq: wifi_pwrseq {
107		compatible = "mmc-pwrseq-simple";
108		reset-gpios = <&pio 2 14 GPIO_ACTIVE_LOW>; /* PC14 */
109	};
110};
111
112&codec {
113	allwinner,audio-routing =
114		"Line Out", "LINEOUT",
115		"MIC1", "Mic",
116		"Mic",  "MBIAS";
117	status = "okay";
118};
119
120&ehci0 {
121	status = "okay";
122};
123
124&ehci1 {
125	status = "okay";
126};
127
128&ehci2 {
129	status = "okay";
130};
131
132&ehci3 {
133	status = "okay";
134};
135
136&ir {
137	pinctrl-names = "default";
138	pinctrl-0 = <&ir_pins_a>;
139	status = "okay";
140};
141
142&mmc0 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
145	vmmc-supply = <&reg_vcc3v3>;
146	bus-width = <4>;
147	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
148	status = "okay";
149};
150
151&mmc1 {
152	pinctrl-names = "default";
153	pinctrl-0 = <&mmc1_pins_a>;
154	vmmc-supply = <&reg_vcc3v3>;
155	mmc-pwrseq = <&wifi_pwrseq>;
156	bus-width = <4>;
157	non-removable;
158	status = "okay";
159};
160
161&ohci0 {
162	status = "okay";
163};
164
165&ohci1 {
166	status = "okay";
167};
168
169&ohci2 {
170	status = "okay";
171};
172
173&ohci3 {
174	status = "okay";
175};
176
177&uart0 {
178	pinctrl-names = "default";
179	pinctrl-0 = <&uart0_pins_a>;
180	status = "okay";
181};
182
183&uart1 {
184	pinctrl-names = "default";
185	pinctrl-0 = <&uart1_pins>;
186	status = "disabled";
187};
188
189&uart2 {
190	pinctrl-names = "default";
191	pinctrl-0 = <&uart2_pins>;
192	status = "disabled";
193};
194
195&usb_otg {
196	dr_mode = "otg";
197	status = "okay";
198};
199
200&usbphy {
201	/* USB Type-A ports' VBUS is always on */
202	usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
203	usb0_vbus-supply = <&reg_usb0_vbus>;
204	status = "okay";
205};
206