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