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