1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
3// Copyright (C) 2017-2018 Samuel Holland <samuel@sholland.org>
4
5/dts-v1/;
6
7#include "sun50i-a64.dtsi"
8
9#include <dt-bindings/gpio/gpio.h>
10
11/ {
12	model = "OrangePi Win/Win Plus";
13	compatible = "xunlong,orangepi-win", "allwinner,sun50i-a64";
14
15	aliases {
16		ethernet0 = &emac;
17		serial0 = &uart0;
18		serial1 = &uart1;
19		serial2 = &uart2;
20		serial3 = &uart3;
21		serial4 = &uart4;
22	};
23
24	chosen {
25		stdout-path = "serial0:115200n8";
26	};
27
28	hdmi-connector {
29		compatible = "hdmi-connector";
30		type = "a";
31
32		port {
33			hdmi_con_in: endpoint {
34				remote-endpoint = <&hdmi_out_con>;
35			};
36		};
37	};
38
39	leds {
40		compatible = "gpio-leds";
41
42		status {
43			label = "orangepi:green:status";
44			gpios = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
45		};
46	};
47
48	reg_gmac_3v3: gmac-3v3 {
49		compatible = "regulator-fixed";
50		regulator-name = "gmac-3v3";
51		regulator-min-microvolt = <3300000>;
52		regulator-max-microvolt = <3300000>;
53		regulator-boot-on;
54		enable-active-high;
55		gpio = <&pio 3 14 GPIO_ACTIVE_HIGH>; /* PD14 */
56		status = "okay";
57	};
58
59	reg_usb1_vbus: usb1-vbus {
60		compatible = "regulator-fixed";
61		regulator-name = "usb1-vbus";
62		regulator-min-microvolt = <5000000>;
63		regulator-max-microvolt = <5000000>;
64		regulator-boot-on;
65		enable-active-high;
66		gpio = <&pio 3 7 GPIO_ACTIVE_HIGH>; /* PD7 */
67		status = "okay";
68	};
69
70	wifi_pwrseq: wifi_pwrseq {
71		compatible = "mmc-pwrseq-simple";
72		reset-gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
73		clocks = <&rtc 1>;
74		clock-names = "ext_clock";
75	};
76};
77
78&codec {
79	status = "okay";
80};
81
82&codec_analog {
83	cpvdd-supply = <&reg_eldo1>;
84	status = "okay";
85};
86
87&dai {
88	status = "okay";
89};
90
91&de {
92	status = "okay";
93};
94
95&ehci0 {
96	status = "okay";
97};
98
99&ehci1 {
100	status = "okay";
101};
102
103&emac {
104	pinctrl-names = "default";
105	pinctrl-0 = <&rgmii_pins>;
106	phy-mode = "rgmii";
107	phy-handle = <&ext_rgmii_phy>;
108	phy-supply = <&reg_gmac_3v3>;
109	status = "okay";
110};
111
112&hdmi {
113	hvcc-supply = <&reg_dldo1>;
114	status = "okay";
115};
116
117&hdmi_out {
118	hdmi_out_con: endpoint {
119		remote-endpoint = <&hdmi_con_in>;
120	};
121};
122
123&mdio {
124	ext_rgmii_phy: ethernet-phy@1 {
125		compatible = "ethernet-phy-ieee802.3-c22";
126		reg = <1>;
127	};
128};
129
130&mmc0 {
131	pinctrl-names = "default";
132	pinctrl-0 = <&mmc0_pins>;
133	vmmc-supply = <&reg_dcdc1>;
134	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
135	disable-wp;
136	bus-width = <4>;
137	status = "okay";
138};
139
140&mmc1 {
141	pinctrl-names = "default";
142	pinctrl-0 = <&mmc1_pins>;
143	vmmc-supply = <&reg_dldo2>;
144	vqmmc-supply = <&reg_dldo4>;
145	mmc-pwrseq = <&wifi_pwrseq>;
146	bus-width = <4>;
147	non-removable;
148	status = "okay";
149
150	brcmf: wifi@1 {
151		reg = <1>;
152		compatible = "brcm,bcm4329-fmac";
153		interrupt-parent = <&r_pio>;
154		interrupts = <0 7 IRQ_TYPE_LEVEL_LOW>; /* PL7 */
155		interrupt-names = "host-wake";
156	};
157};
158
159&ohci0 {
160	status = "okay";
161};
162
163&ohci1 {
164	status = "okay";
165};
166
167&r_ir {
168	status = "okay";
169};
170
171&r_rsb {
172	status = "okay";
173
174	axp803: pmic@3a3 {
175		compatible = "x-powers,axp803";
176		reg = <0x3a3>;
177		interrupt-parent = <&r_intc>;
178		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
179		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
180	};
181};
182
183#include "axp803.dtsi"
184
185&ac_power_supply {
186	status = "okay";
187};
188
189&battery_power_supply {
190	status = "okay";
191};
192
193&reg_aldo1 {
194	regulator-min-microvolt = <2800000>;
195	regulator-max-microvolt = <2800000>;
196	regulator-name = "afvcc-csi";
197};
198
199&reg_aldo2 {
200	regulator-always-on;
201	regulator-min-microvolt = <1800000>;
202	regulator-max-microvolt = <3300000>;
203	regulator-name = "vcc-pl";
204};
205
206&reg_aldo3 {
207	regulator-always-on;
208	regulator-min-microvolt = <3000000>;
209	regulator-max-microvolt = <3000000>;
210	regulator-name = "vcc-pll-avcc";
211};
212
213&reg_dcdc1 {
214	regulator-always-on;
215	regulator-min-microvolt = <3300000>;
216	regulator-max-microvolt = <3300000>;
217	regulator-name = "vcc-3v3";
218};
219
220&reg_dcdc2 {
221	regulator-always-on;
222	regulator-min-microvolt = <1040000>;
223	regulator-max-microvolt = <1300000>;
224	regulator-name = "vdd-cpux";
225};
226
227/* DCDC3 is polyphased with DCDC2 */
228
229&reg_dcdc5 {
230	regulator-always-on;
231	regulator-min-microvolt = <1500000>;
232	regulator-max-microvolt = <1500000>;
233	regulator-name = "vcc-dram";
234};
235
236&reg_dcdc6 {
237	regulator-always-on;
238	regulator-min-microvolt = <1100000>;
239	regulator-max-microvolt = <1100000>;
240	regulator-name = "vdd-sys";
241};
242
243&reg_dldo1 {
244	regulator-min-microvolt = <3300000>;
245	regulator-max-microvolt = <3300000>;
246	regulator-name = "vcc-hdmi-dsi";
247};
248
249&reg_dldo2 {
250	regulator-min-microvolt = <3300000>;
251	regulator-max-microvolt = <3300000>;
252	regulator-name = "vcc-wifi";
253};
254
255&reg_dldo3 {
256	regulator-min-microvolt = <3300000>;
257	regulator-max-microvolt = <3300000>;
258	regulator-name = "avdd-csi";
259};
260
261&reg_dldo4 {
262	regulator-min-microvolt = <3300000>;
263	regulator-max-microvolt = <3300000>;
264	regulator-name = "vcc-wifi-io";
265};
266
267&reg_drivevbus {
268	regulator-name = "usb0-vbus";
269	status = "okay";
270};
271
272&reg_eldo1 {
273	regulator-min-microvolt = <1800000>;
274	regulator-max-microvolt = <1800000>;
275	regulator-name = "cpvdd";
276};
277
278&reg_eldo3 {
279	regulator-min-microvolt = <1500000>;
280	regulator-max-microvolt = <1800000>;
281	regulator-name = "dvdd-csi";
282};
283
284&reg_fldo1 {
285	regulator-min-microvolt = <1200000>;
286	regulator-max-microvolt = <1200000>;
287	regulator-name = "vcc-1v2-hsic";
288};
289
290/*
291 * The A64 chip cannot work without this regulator off, although
292 * it seems to be only driving the AR100 core.
293 * Maybe we don't still know well about CPUs domain.
294 */
295&reg_fldo2 {
296	regulator-always-on;
297	regulator-min-microvolt = <1100000>;
298	regulator-max-microvolt = <1100000>;
299	regulator-name = "vdd-cpus";
300};
301
302&reg_rtc_ldo {
303	regulator-name = "vcc-rtc";
304};
305
306&simplefb_hdmi {
307	vcc-hdmi-supply = <&reg_dldo1>;
308};
309
310&sound {
311	status = "okay";
312	simple-audio-card,widgets = "Headphone", "Headphone Jack",
313				    "Microphone", "Microphone Jack",
314				    "Microphone", "Onboard Microphone";
315	simple-audio-card,routing =
316			"Left DAC", "AIF1 Slot 0 Left",
317			"Right DAC", "AIF1 Slot 0 Right",
318			"AIF1 Slot 0 Left ADC", "Left ADC",
319			"AIF1 Slot 0 Right ADC", "Right ADC",
320			"Headphone Jack", "HP",
321			"MIC2", "Microphone Jack",
322			"Onboard Microphone", "MBIAS",
323			"MIC1", "Onboard Microphone";
324};
325
326&spi0 {
327	status = "okay";
328
329	spi-flash@0 {
330		compatible = "mxicy,mx25l1606e", "jedec,spi-nor";
331		reg = <0>;
332		spi-max-frequency = <80000000>;
333		m25p,fast-read;
334		status = "okay";
335	};
336};
337
338/* On debug connector */
339&uart0 {
340	pinctrl-names = "default";
341	pinctrl-0 = <&uart0_pb_pins>;
342	status = "okay";
343};
344
345/* Bluetooth */
346&uart1 {
347	pinctrl-names = "default";
348	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
349	uart-has-rtscts;
350	status = "okay";
351
352	bluetooth {
353		compatible = "brcm,bcm43438-bt";
354		max-speed = <1500000>;
355		clocks = <&rtc 1>;
356		clock-names = "lpo";
357		vbat-supply = <&reg_dldo2>;
358		vddio-supply = <&reg_dldo4>;
359		device-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
360		host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
361		shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
362	};
363};
364
365/* On Pi-2 connector, RTS/CTS optional */
366&uart2 {
367	pinctrl-names = "default";
368	pinctrl-0 = <&uart2_pins>;
369	status = "disabled";
370};
371
372/* On Pi-2 connector, RTS/CTS optional */
373&uart3 {
374	pinctrl-names = "default";
375	pinctrl-0 = <&uart3_pins>;
376	status = "disabled";
377};
378
379/* On Pi-2 connector (labeled for SPI1), RTS/CTS optional */
380&uart4 {
381	pinctrl-names = "default";
382	pinctrl-0 = <&uart4_pins>;
383	status = "disabled";
384};
385
386&usb_otg {
387	dr_mode = "otg";
388	status = "okay";
389};
390
391&usbphy {
392	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
393	usb0_vbus-supply = <&reg_drivevbus>;
394	usb1_vbus-supply = <&reg_usb1_vbus>;
395	status = "okay";
396};
397