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
99&ehci0 {
100	status = "okay";
101};
102
103&ehci1 {
104	status = "okay";
105};
106
107&emac {
108	pinctrl-names = "default";
109	pinctrl-0 = <&rgmii_pins>;
110	phy-mode = "rgmii";
111	phy-handle = <&ext_rgmii_phy>;
112	phy-supply = <&reg_gmac_3v3>;
113	status = "okay";
114};
115
116&mdio {
117	ext_rgmii_phy: ethernet-phy@1 {
118		compatible = "ethernet-phy-ieee802.3-c22";
119		reg = <1>;
120	};
121};
122
123&mmc0 {
124	pinctrl-names = "default";
125	pinctrl-0 = <&mmc0_pins>;
126	vmmc-supply = <&reg_dcdc1>;
127	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
128	disable-wp;
129	bus-width = <4>;
130	status = "okay";
131};
132
133&ohci0 {
134	status = "okay";
135};
136
137&ohci1 {
138	status = "okay";
139};
140
141&r_rsb {
142	status = "okay";
143
144	axp803: pmic@3a3 {
145		compatible = "x-powers,axp803";
146		reg = <0x3a3>;
147		interrupt-parent = <&r_intc>;
148		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
149	};
150};
151
152#include "axp803.dtsi"
153
154&reg_aldo1 {
155	regulator-always-on;
156	regulator-min-microvolt = <1800000>;
157	regulator-max-microvolt = <3300000>;
158	regulator-name = "afvcc-csi";
159};
160
161&reg_aldo2 {
162	regulator-always-on;
163	regulator-min-microvolt = <1800000>;
164	regulator-max-microvolt = <3300000>;
165	regulator-name = "vcc-pl";
166};
167
168&reg_aldo3 {
169	regulator-always-on;
170	regulator-min-microvolt = <3000000>;
171	regulator-max-microvolt = <3000000>;
172	regulator-name = "vcc-pll-avcc";
173};
174
175&reg_dcdc1 {
176	regulator-always-on;
177	regulator-min-microvolt = <3300000>;
178	regulator-max-microvolt = <3300000>;
179	regulator-name = "vcc-3v3";
180};
181
182&reg_dcdc2 {
183	regulator-always-on;
184	regulator-min-microvolt = <1040000>;
185	regulator-max-microvolt = <1300000>;
186	regulator-name = "vdd-cpux";
187};
188
189/* DCDC3 is polyphased with DCDC2 */
190
191&reg_dcdc5 {
192	regulator-always-on;
193	regulator-min-microvolt = <1500000>;
194	regulator-max-microvolt = <1500000>;
195	regulator-name = "vcc-dram";
196};
197
198&reg_dcdc6 {
199	regulator-always-on;
200	regulator-min-microvolt = <1100000>;
201	regulator-max-microvolt = <1100000>;
202	regulator-name = "vdd-sys";
203};
204
205&reg_dldo1 {
206	regulator-min-microvolt = <3300000>;
207	regulator-max-microvolt = <3300000>;
208	regulator-name = "vcc-hdmi-dsi";
209};
210
211&reg_dldo2 {
212	regulator-min-microvolt = <3300000>;
213	regulator-max-microvolt = <3300000>;
214	regulator-name = "vcc-wifi";
215};
216
217&reg_dldo3 {
218	regulator-min-microvolt = <3300000>;
219	regulator-max-microvolt = <3300000>;
220	regulator-name = "avdd-csi";
221};
222
223&reg_dldo4 {
224	regulator-min-microvolt = <3300000>;
225	regulator-max-microvolt = <3300000>;
226	regulator-name = "vcc-wifi-io";
227};
228
229&reg_drivevbus {
230	regulator-name = "usb0-vbus";
231	status = "okay";
232};
233
234&reg_eldo1 {
235	regulator-min-microvolt = <1800000>;
236	regulator-max-microvolt = <1800000>;
237	regulator-name = "cpvdd";
238};
239
240&reg_fldo1 {
241	regulator-min-microvolt = <1200000>;
242	regulator-max-microvolt = <1200000>;
243	regulator-name = "vcc-1v2-hsic";
244};
245
246/*
247 * The A64 chip cannot work without this regulator off, although
248 * it seems to be only driving the AR100 core.
249 * Maybe we don't still know well about CPUs domain.
250 */
251&reg_fldo2 {
252	regulator-always-on;
253	regulator-min-microvolt = <1100000>;
254	regulator-max-microvolt = <1100000>;
255	regulator-name = "vdd-cpus";
256};
257
258&reg_rtc_ldo {
259	regulator-name = "vcc-rtc";
260};
261
262&simplefb_hdmi {
263	vcc-hdmi-supply = <&reg_dldo1>;
264};
265
266/* On debug connector */
267&uart0 {
268	pinctrl-names = "default";
269	pinctrl-0 = <&uart0_pins_a>;
270	status = "okay";
271};
272
273/* Bluetooth */
274&uart1 {
275	pinctrl-names = "default";
276	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
277	status = "okay";
278};
279
280/* On Pi-2 connector, RTS/CTS optional */
281&uart2 {
282	pinctrl-names = "default";
283	pinctrl-0 = <&uart2_pins>;
284	status = "disabled";
285};
286
287/* On Pi-2 connector, RTS/CTS optional */
288&uart3 {
289	pinctrl-names = "default";
290	pinctrl-0 = <&uart3_pins>;
291	status = "disabled";
292};
293
294/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
295&uart4 {
296	pinctrl-names = "default";
297	pinctrl-0 = <&uart4_pins>;
298	status = "disabled";
299};
300
301&usb_otg {
302	dr_mode = "otg";
303	status = "okay";
304};
305
306&usbphy {
307	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
308	usb0_vbus-supply = <&reg_drivevbus>;
309	usb1_vbus-supply = <&reg_usb1_vbus>;
310	status = "okay";
311};
312