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	aliases {
57		serial0 = &uart0;
58	};
59
60	chosen {
61		stdout-path = "serial0:115200n8";
62	};
63
64	leds {
65		compatible = "gpio-leds";
66
67		pwr {
68			label = "orangepi:green:pwr";
69			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
70			default-state = "on";
71		};
72
73		status {
74			label = "orangepi:red:status";
75			gpios = <&pio 0 20 GPIO_ACTIVE_HIGH>;
76		};
77	};
78
79	r-gpio-keys {
80		compatible = "gpio-keys";
81
82		sw4 {
83			label = "sw4";
84			linux,code = <BTN_0>;
85			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
86		};
87	};
88
89	reg_gmac_3v3: gmac-3v3 {
90		compatible = "regulator-fixed";
91		regulator-name = "gmac-3v3";
92		regulator-min-microvolt = <3300000>;
93		regulator-max-microvolt = <3300000>;
94		startup-delay-us = <100000>;
95		enable-active-high;
96		gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
97	};
98
99	reg_vcc3v3: vcc3v3 {
100		compatible = "regulator-fixed";
101		regulator-name = "vcc3v3";
102		regulator-min-microvolt = <3300000>;
103		regulator-max-microvolt = <3300000>;
104	};
105
106	reg_usb0_vbus: usb0-vbus {
107		compatible = "regulator-fixed";
108		regulator-name = "usb0-vbus";
109		regulator-min-microvolt = <5000000>;
110		regulator-max-microvolt = <5000000>;
111		enable-active-high;
112		gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */
113		status = "okay";
114	};
115
116	wifi_pwrseq: wifi_pwrseq {
117		compatible = "mmc-pwrseq-simple";
118		reset-gpios = <&pio 2 14 GPIO_ACTIVE_LOW>; /* PC14 */
119	};
120};
121
122&codec {
123	allwinner,audio-routing =
124		"Line Out", "LINEOUT",
125		"MIC1", "Mic",
126		"Mic",  "MBIAS";
127	status = "okay";
128};
129
130&ehci0 {
131	status = "okay";
132};
133
134&ehci1 {
135	status = "okay";
136};
137
138&ehci2 {
139	status = "okay";
140};
141
142&ehci3 {
143	status = "okay";
144};
145
146&ir {
147	pinctrl-names = "default";
148	pinctrl-0 = <&ir_pins_a>;
149	status = "okay";
150};
151
152&mmc0 {
153	pinctrl-names = "default";
154	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
155	vmmc-supply = <&reg_vcc3v3>;
156	bus-width = <4>;
157	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
158	status = "okay";
159};
160
161&mmc1 {
162	pinctrl-names = "default";
163	pinctrl-0 = <&mmc1_pins_a>;
164	vmmc-supply = <&reg_vcc3v3>;
165	mmc-pwrseq = <&wifi_pwrseq>;
166	bus-width = <4>;
167	non-removable;
168	status = "okay";
169};
170
171&ohci0 {
172	status = "okay";
173};
174
175&ohci1 {
176	status = "okay";
177};
178
179&ohci2 {
180	status = "okay";
181};
182
183&ohci3 {
184	status = "okay";
185};
186
187&uart0 {
188	pinctrl-names = "default";
189	pinctrl-0 = <&uart0_pins_a>;
190	status = "okay";
191};
192
193&uart1 {
194	pinctrl-names = "default";
195	pinctrl-0 = <&uart1_pins>;
196	status = "disabled";
197};
198
199&uart2 {
200	pinctrl-names = "default";
201	pinctrl-0 = <&uart2_pins>;
202	status = "disabled";
203};
204
205&usb_otg {
206	dr_mode = "otg";
207	status = "okay";
208};
209
210&usbphy {
211	/* USB Type-A ports' VBUS is always on */
212	usb0_id_det-gpios = <&pio 0 21 GPIO_ACTIVE_HIGH>; /* PA21 */
213	usb0_vbus-supply = <&reg_usb0_vbus>;
214	status = "okay";
215};
216