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