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	hdmi-connector {
68		compatible = "hdmi-connector";
69		type = "a";
70
71		port {
72			hdmi_con_in: endpoint {
73				remote-endpoint = <&hdmi_out_con>;
74			};
75		};
76	};
77
78	leds {
79		compatible = "gpio-leds";
80
81		status {
82			label = "orangepi:green:status";
83			gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
84		};
85	};
86
87	reg_gmac_3v3: gmac-3v3 {
88		compatible = "regulator-fixed";
89		regulator-name = "gmac-3v3";
90		regulator-min-microvolt = <3300000>;
91		regulator-max-microvolt = <3300000>;
92		regulator-boot-on;
93		enable-active-high;
94		gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
95		status = "okay";
96	};
97
98	reg_usb1_vbus: usb1-vbus {
99		compatible = "regulator-fixed";
100		regulator-name = "usb1-vbus";
101		regulator-min-microvolt = <5000000>;
102		regulator-max-microvolt = <5000000>;
103		regulator-boot-on;
104		enable-active-high;
105		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
106		status = "okay";
107	};
108
109	wifi_pwrseq: wifi_pwrseq {
110		compatible = "mmc-pwrseq-simple";
111		reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
112	};
113};
114
115&de {
116	status = "okay";
117};
118
119&ehci0 {
120	status = "okay";
121};
122
123&ehci1 {
124	status = "okay";
125};
126
127&emac {
128	pinctrl-names = "default";
129	pinctrl-0 = <&rgmii_pins>;
130	phy-mode = "rgmii";
131	phy-handle = <&ext_rgmii_phy>;
132	phy-supply = <&reg_gmac_3v3>;
133	status = "okay";
134};
135
136&hdmi {
137	hvcc-supply = <&reg_dldo1>;
138	status = "okay";
139};
140
141&hdmi_out {
142	hdmi_out_con: endpoint {
143		remote-endpoint = <&hdmi_con_in>;
144	};
145};
146
147&mdio {
148	ext_rgmii_phy: ethernet-phy@1 {
149		compatible = "ethernet-phy-ieee802.3-c22";
150		reg = <1>;
151	};
152};
153
154&mmc0 {
155	pinctrl-names = "default";
156	pinctrl-0 = <&mmc0_pins>;
157	vmmc-supply = <&reg_dcdc1>;
158	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
159	disable-wp;
160	bus-width = <4>;
161	status = "okay";
162};
163
164&mmc1 {
165	pinctrl-names = "default";
166	pinctrl-0 = <&mmc1_pins>;
167	vmmc-supply = <&reg_dldo2>;
168	vqmmc-supply = <&reg_dldo4>;
169	mmc-pwrseq = <&wifi_pwrseq>;
170	bus-width = <4>;
171	non-removable;
172	status = "okay";
173};
174
175&ohci0 {
176	status = "okay";
177};
178
179&ohci1 {
180	status = "okay";
181};
182
183&r_rsb {
184	status = "okay";
185
186	axp803: pmic@3a3 {
187		compatible = "x-powers,axp803";
188		reg = <0x3a3>;
189		interrupt-parent = <&r_intc>;
190		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
191	};
192};
193
194#include "axp803.dtsi"
195
196&ac_power_supply {
197	status = "okay";
198};
199
200&battery_power_supply {
201	status = "okay";
202};
203
204&reg_aldo1 {
205	regulator-min-microvolt = <2800000>;
206	regulator-max-microvolt = <2800000>;
207	regulator-name = "afvcc-csi";
208};
209
210&reg_aldo2 {
211	regulator-always-on;
212	regulator-min-microvolt = <1800000>;
213	regulator-max-microvolt = <3300000>;
214	regulator-name = "vcc-pl";
215};
216
217&reg_aldo3 {
218	regulator-always-on;
219	regulator-min-microvolt = <3000000>;
220	regulator-max-microvolt = <3000000>;
221	regulator-name = "vcc-pll-avcc";
222};
223
224&reg_dcdc1 {
225	regulator-always-on;
226	regulator-min-microvolt = <3300000>;
227	regulator-max-microvolt = <3300000>;
228	regulator-name = "vcc-3v3";
229};
230
231&reg_dcdc2 {
232	regulator-always-on;
233	regulator-min-microvolt = <1040000>;
234	regulator-max-microvolt = <1300000>;
235	regulator-name = "vdd-cpux";
236};
237
238/* DCDC3 is polyphased with DCDC2 */
239
240&reg_dcdc5 {
241	regulator-always-on;
242	regulator-min-microvolt = <1500000>;
243	regulator-max-microvolt = <1500000>;
244	regulator-name = "vcc-dram";
245};
246
247&reg_dcdc6 {
248	regulator-always-on;
249	regulator-min-microvolt = <1100000>;
250	regulator-max-microvolt = <1100000>;
251	regulator-name = "vdd-sys";
252};
253
254&reg_dldo1 {
255	regulator-min-microvolt = <3300000>;
256	regulator-max-microvolt = <3300000>;
257	regulator-name = "vcc-hdmi-dsi";
258};
259
260&reg_dldo2 {
261	regulator-min-microvolt = <3300000>;
262	regulator-max-microvolt = <3300000>;
263	regulator-name = "vcc-wifi";
264};
265
266&reg_dldo3 {
267	regulator-min-microvolt = <3300000>;
268	regulator-max-microvolt = <3300000>;
269	regulator-name = "avdd-csi";
270};
271
272&reg_dldo4 {
273	regulator-min-microvolt = <3300000>;
274	regulator-max-microvolt = <3300000>;
275	regulator-name = "vcc-wifi-io";
276};
277
278&reg_drivevbus {
279	regulator-name = "usb0-vbus";
280	status = "okay";
281};
282
283&reg_eldo1 {
284	regulator-min-microvolt = <1800000>;
285	regulator-max-microvolt = <1800000>;
286	regulator-name = "cpvdd";
287};
288
289&reg_eldo3 {
290	regulator-min-microvolt = <1500000>;
291	regulator-max-microvolt = <1800000>;
292	regulator-name = "dvdd-csi";
293};
294
295&reg_fldo1 {
296	regulator-min-microvolt = <1200000>;
297	regulator-max-microvolt = <1200000>;
298	regulator-name = "vcc-1v2-hsic";
299};
300
301/*
302 * The A64 chip cannot work without this regulator off, although
303 * it seems to be only driving the AR100 core.
304 * Maybe we don't still know well about CPUs domain.
305 */
306&reg_fldo2 {
307	regulator-always-on;
308	regulator-min-microvolt = <1100000>;
309	regulator-max-microvolt = <1100000>;
310	regulator-name = "vdd-cpus";
311};
312
313&reg_rtc_ldo {
314	regulator-name = "vcc-rtc";
315};
316
317&simplefb_hdmi {
318	vcc-hdmi-supply = <&reg_dldo1>;
319};
320
321&spi0 {
322	status = "okay";
323
324	spi-flash@0 {
325		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
326		reg = <0>;
327		spi-max-frequency = <80000000>;
328		m25p,fast-read;
329		status = "okay";
330	};
331};
332
333/* On debug connector */
334&uart0 {
335	pinctrl-names = "default";
336	pinctrl-0 = <&uart0_pb_pins>;
337	status = "okay";
338};
339
340/* Bluetooth */
341&uart1 {
342	pinctrl-names = "default";
343	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
344	status = "okay";
345};
346
347/* On Pi-2 connector, RTS/CTS optional */
348&uart2 {
349	pinctrl-names = "default";
350	pinctrl-0 = <&uart2_pins>;
351	status = "disabled";
352};
353
354/* On Pi-2 connector, RTS/CTS optional */
355&uart3 {
356	pinctrl-names = "default";
357	pinctrl-0 = <&uart3_pins>;
358	status = "disabled";
359};
360
361/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
362&uart4 {
363	pinctrl-names = "default";
364	pinctrl-0 = <&uart4_pins>;
365	status = "disabled";
366};
367
368&usb_otg {
369	dr_mode = "otg";
370	status = "okay";
371};
372
373&usbphy {
374	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
375	usb0_vbus-supply = <&reg_drivevbus>;
376	usb1_vbus-supply = <&reg_usb1_vbus>;
377	status = "okay";
378};
379