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