1/*
2 * Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
3 * Copyright (C) 2017-2018 Samuel Holland <samuel@sholland.org>
4 *
5 * This file is dual-licensed: you can use it either under the terms
6 * of the GPL or the X11 license, at your option. Note that this dual
7 * licensing only applies to this file, and not this project as a
8 * whole.
9 *
10 *  a) This library is free software; you can redistribute it and/or
11 *     modify it under the terms of the GNU General Public License as
12 *     published by the Free Software Foundation; either version 2 of the
13 *     License, or (at your option) any later version.
14 *
15 *     This library is distributed in the hope that it will be useful,
16 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *     GNU General Public License for more details.
19 *
20 * Or, alternatively,
21 *
22 *  b) Permission is hereby granted, free of charge, to any person
23 *     obtaining a copy of this software and associated documentation
24 *     files (the "Software"), to deal in the Software without
25 *     restriction, including without limitation the rights to use,
26 *     copy, modify, merge, publish, distribute, sublicense, and/or
27 *     sell copies of the Software, and to permit persons to whom the
28 *     Software is furnished to do so, subject to the following
29 *     conditions:
30 *
31 *     The above copyright notice and this permission notice shall be
32 *     included in all copies or substantial portions of the Software.
33 *
34 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
36 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
38 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
39 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
41 *     OTHER DEALINGS IN THE SOFTWARE.
42 */
43
44/dts-v1/;
45
46#include "sun50i-a64.dtsi"
47
48#include <dt-bindings/gpio/gpio.h>
49
50/ {
51	model = "OrangePi Win/Win Plus";
52	compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";
53
54	aliases {
55		ethernet0 = &emac;
56		serial0 = &uart0;
57		serial1 = &uart1;
58		serial2 = &uart2;
59		serial3 = &uart3;
60		serial4 = &uart4;
61	};
62
63	chosen {
64		stdout-path = "serial0:115200n8";
65	};
66
67	leds {
68		compatible = "gpio-leds";
69
70		status {
71			label = "orangepi:green:status";
72			gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
73		};
74	};
75
76	reg_gmac_3v3: gmac-3v3 {
77		compatible = "regulator-fixed";
78		regulator-name = "gmac-3v3";
79		regulator-min-microvolt = <3300000>;
80		regulator-max-microvolt = <3300000>;
81		regulator-boot-on;
82		enable-active-high;
83		gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
84		status = "okay";
85	};
86
87	reg_usb1_vbus: usb1-vbus {
88		compatible = "regulator-fixed";
89		regulator-name = "usb1-vbus";
90		regulator-min-microvolt = <5000000>;
91		regulator-max-microvolt = <5000000>;
92		regulator-boot-on;
93		enable-active-high;
94		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
95		status = "okay";
96	};
97
98	wifi_pwrseq: wifi_pwrseq {
99		compatible = "mmc-pwrseq-simple";
100		reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
101	};
102};
103
104&ehci0 {
105	status = "okay";
106};
107
108&ehci1 {
109	status = "okay";
110};
111
112&emac {
113	pinctrl-names = "default";
114	pinctrl-0 = <&rgmii_pins>;
115	phy-mode = "rgmii";
116	phy-handle = <&ext_rgmii_phy>;
117	phy-supply = <&reg_gmac_3v3>;
118	status = "okay";
119};
120
121&mdio {
122	ext_rgmii_phy: ethernet-phy@1 {
123		compatible = "ethernet-phy-ieee802.3-c22";
124		reg = <1>;
125	};
126};
127
128&mmc0 {
129	pinctrl-names = "default";
130	pinctrl-0 = <&mmc0_pins>;
131	vmmc-supply = <&reg_dcdc1>;
132	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
133	disable-wp;
134	bus-width = <4>;
135	status = "okay";
136};
137
138&mmc1 {
139	pinctrl-names = "default";
140	pinctrl-0 = <&mmc1_pins>;
141	vmmc-supply = <&reg_dldo2>;
142	vqmmc-supply = <&reg_dldo4>;
143	mmc-pwrseq = <&wifi_pwrseq>;
144	bus-width = <4>;
145	non-removable;
146	status = "okay";
147};
148
149&ohci0 {
150	status = "okay";
151};
152
153&ohci1 {
154	status = "okay";
155};
156
157&r_rsb {
158	status = "okay";
159
160	axp803: pmic@3a3 {
161		compatible = "x-powers,axp803";
162		reg = <0x3a3>;
163		interrupt-parent = <&r_intc>;
164		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
165	};
166};
167
168#include "axp803.dtsi"
169
170&reg_aldo1 {
171	regulator-min-microvolt = <2800000>;
172	regulator-max-microvolt = <2800000>;
173	regulator-name = "afvcc-csi";
174};
175
176&reg_aldo2 {
177	regulator-always-on;
178	regulator-min-microvolt = <1800000>;
179	regulator-max-microvolt = <3300000>;
180	regulator-name = "vcc-pl";
181};
182
183&reg_aldo3 {
184	regulator-always-on;
185	regulator-min-microvolt = <3000000>;
186	regulator-max-microvolt = <3000000>;
187	regulator-name = "vcc-pll-avcc";
188};
189
190&reg_dcdc1 {
191	regulator-always-on;
192	regulator-min-microvolt = <3300000>;
193	regulator-max-microvolt = <3300000>;
194	regulator-name = "vcc-3v3";
195};
196
197&reg_dcdc2 {
198	regulator-always-on;
199	regulator-min-microvolt = <1040000>;
200	regulator-max-microvolt = <1300000>;
201	regulator-name = "vdd-cpux";
202};
203
204/* DCDC3 is polyphased with DCDC2 */
205
206&reg_dcdc5 {
207	regulator-always-on;
208	regulator-min-microvolt = <1500000>;
209	regulator-max-microvolt = <1500000>;
210	regulator-name = "vcc-dram";
211};
212
213&reg_dcdc6 {
214	regulator-always-on;
215	regulator-min-microvolt = <1100000>;
216	regulator-max-microvolt = <1100000>;
217	regulator-name = "vdd-sys";
218};
219
220&reg_dldo1 {
221	regulator-min-microvolt = <3300000>;
222	regulator-max-microvolt = <3300000>;
223	regulator-name = "vcc-hdmi-dsi";
224};
225
226&reg_dldo2 {
227	regulator-min-microvolt = <3300000>;
228	regulator-max-microvolt = <3300000>;
229	regulator-name = "vcc-wifi";
230};
231
232&reg_dldo3 {
233	regulator-min-microvolt = <3300000>;
234	regulator-max-microvolt = <3300000>;
235	regulator-name = "avdd-csi";
236};
237
238&reg_dldo4 {
239	regulator-min-microvolt = <3300000>;
240	regulator-max-microvolt = <3300000>;
241	regulator-name = "vcc-wifi-io";
242};
243
244&reg_drivevbus {
245	regulator-name = "usb0-vbus";
246	status = "okay";
247};
248
249&reg_eldo1 {
250	regulator-min-microvolt = <1800000>;
251	regulator-max-microvolt = <1800000>;
252	regulator-name = "cpvdd";
253};
254
255&reg_eldo3 {
256	regulator-min-microvolt = <1500000>;
257	regulator-max-microvolt = <1800000>;
258	regulator-name = "dvdd-csi";
259};
260
261&reg_fldo1 {
262	regulator-min-microvolt = <1200000>;
263	regulator-max-microvolt = <1200000>;
264	regulator-name = "vcc-1v2-hsic";
265};
266
267/*
268 * The A64 chip cannot work without this regulator off, although
269 * it seems to be only driving the AR100 core.
270 * Maybe we don't still know well about CPUs domain.
271 */
272&reg_fldo2 {
273	regulator-always-on;
274	regulator-min-microvolt = <1100000>;
275	regulator-max-microvolt = <1100000>;
276	regulator-name = "vdd-cpus";
277};
278
279&reg_rtc_ldo {
280	regulator-name = "vcc-rtc";
281};
282
283&simplefb_hdmi {
284	vcc-hdmi-supply = <&reg_dldo1>;
285};
286
287&spi0 {
288	status = "okay";
289
290	spi-flash@0 {
291		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
292		reg = <0>;
293		spi-max-frequency = <80000000>;
294		m25p,fast-read;
295		status = "okay";
296	};
297};
298
299/* On debug connector */
300&uart0 {
301	pinctrl-names = "default";
302	pinctrl-0 = <&uart0_pins_a>;
303	status = "okay";
304};
305
306/* Bluetooth */
307&uart1 {
308	pinctrl-names = "default";
309	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
310	status = "okay";
311};
312
313/* On Pi-2 connector, RTS/CTS optional */
314&uart2 {
315	pinctrl-names = "default";
316	pinctrl-0 = <&uart2_pins>;
317	status = "disabled";
318};
319
320/* On Pi-2 connector, RTS/CTS optional */
321&uart3 {
322	pinctrl-names = "default";
323	pinctrl-0 = <&uart3_pins>;
324	status = "disabled";
325};
326
327/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
328&uart4 {
329	pinctrl-names = "default";
330	pinctrl-0 = <&uart4_pins>;
331	status = "disabled";
332};
333
334&usb_otg {
335	dr_mode = "otg";
336	status = "okay";
337};
338
339&usbphy {
340	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
341	usb0_vbus-supply = <&reg_drivevbus>;
342	usb1_vbus-supply = <&reg_usb1_vbus>;
343	status = "okay";
344};
345