1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2019 Ondřej Jirman <megous@megous.com>
3
4/dts-v1/;
5
6#include "sun50i-h6.dtsi"
7
8#include <dt-bindings/gpio/gpio.h>
9
10/ {
11	model = "OrangePi 3";
12	compatible = "xunlong,orangepi-3", "allwinner,sun50i-h6";
13
14	aliases {
15		serial0 = &uart0;
16		serial1 = &uart1;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	connector {
24		compatible = "hdmi-connector";
25		ddc-en-gpios = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
26		type = "a";
27
28		port {
29			hdmi_con_in: endpoint {
30				remote-endpoint = <&hdmi_out_con>;
31			};
32		};
33	};
34
35	leds {
36		compatible = "gpio-leds";
37
38		power {
39			label = "orangepi:red:power";
40			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
41			default-state = "on";
42		};
43
44		status {
45			label = "orangepi:green:status";
46			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
47		};
48	};
49
50	reg_vcc5v: vcc5v {
51		/* board wide 5V supply directly from the DC jack */
52		compatible = "regulator-fixed";
53		regulator-name = "vcc-5v";
54		regulator-min-microvolt = <5000000>;
55		regulator-max-microvolt = <5000000>;
56		regulator-always-on;
57	};
58
59	reg_vcc33_wifi: vcc33-wifi {
60		/* Always on 3.3V regulator for WiFi and BT */
61		compatible = "regulator-fixed";
62		regulator-name = "vcc33-wifi";
63		regulator-min-microvolt = <3300000>;
64		regulator-max-microvolt = <3300000>;
65		regulator-always-on;
66		vin-supply = <&reg_vcc5v>;
67	};
68
69	reg_vcc_wifi_io: vcc-wifi-io {
70		/* Always on 1.8V/300mA regulator for WiFi and BT IO */
71		compatible = "regulator-fixed";
72		regulator-name = "vcc-wifi-io";
73		regulator-min-microvolt = <1800000>;
74		regulator-max-microvolt = <1800000>;
75		regulator-always-on;
76		vin-supply = <&reg_vcc33_wifi>;
77	};
78
79	wifi_pwrseq: wifi-pwrseq {
80		compatible = "mmc-pwrseq-simple";
81		clocks = <&rtc 1>;
82		clock-names = "ext_clock";
83		reset-gpios = <&r_pio 1 3 GPIO_ACTIVE_LOW>; /* PM3 */
84		post-power-on-delay-ms = <200>;
85	};
86};
87
88&cpu0 {
89	cpu-supply = <&reg_dcdca>;
90};
91
92&de {
93	status = "okay";
94};
95
96&dwc3 {
97	status = "okay";
98};
99
100&ehci0 {
101	status = "okay";
102};
103
104&ehci3 {
105	status = "okay";
106};
107
108&gpu {
109	mali-supply = <&reg_dcdcc>;
110	status = "okay";
111};
112
113&hdmi {
114	status = "okay";
115};
116
117&hdmi_out {
118	hdmi_out_con: endpoint {
119		remote-endpoint = <&hdmi_con_in>;
120	};
121};
122
123&mmc0 {
124	vmmc-supply = <&reg_cldo1>;
125	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
126	bus-width = <4>;
127	status = "okay";
128};
129
130&mmc1 {
131	vmmc-supply = <&reg_vcc33_wifi>;
132	vqmmc-supply = <&reg_vcc_wifi_io>;
133	mmc-pwrseq = <&wifi_pwrseq>;
134	bus-width = <4>;
135	non-removable;
136	status = "okay";
137
138	brcm: sdio-wifi@1 {
139		reg = <1>;
140		compatible = "brcm,bcm4329-fmac";
141		interrupt-parent = <&r_pio>;
142		interrupts = <1 0 IRQ_TYPE_LEVEL_LOW>; /* PM0 */
143		interrupt-names = "host-wake";
144	};
145};
146
147&ohci0 {
148	status = "okay";
149};
150
151&ohci3 {
152	status = "okay";
153};
154
155&pio {
156	vcc-pc-supply = <&reg_bldo2>;
157	vcc-pd-supply = <&reg_cldo1>;
158	vcc-pg-supply = <&reg_vcc_wifi_io>;
159};
160
161&r_i2c {
162	status = "okay";
163
164	axp805: pmic@36 {
165		compatible = "x-powers,axp805", "x-powers,axp806";
166		reg = <0x36>;
167		interrupt-parent = <&r_intc>;
168		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
169		interrupt-controller;
170		#interrupt-cells = <1>;
171		x-powers,self-working-mode;
172		vina-supply = <&reg_vcc5v>;
173		vinb-supply = <&reg_vcc5v>;
174		vinc-supply = <&reg_vcc5v>;
175		vind-supply = <&reg_vcc5v>;
176		vine-supply = <&reg_vcc5v>;
177		aldoin-supply = <&reg_vcc5v>;
178		bldoin-supply = <&reg_vcc5v>;
179		cldoin-supply = <&reg_vcc5v>;
180
181		regulators {
182			reg_aldo1: aldo1 {
183				regulator-always-on;
184				regulator-min-microvolt = <3300000>;
185				regulator-max-microvolt = <3300000>;
186				regulator-name = "vcc-pl-led-ir";
187			};
188
189			reg_aldo2: aldo2 {
190				regulator-min-microvolt = <3300000>;
191				regulator-max-microvolt = <3300000>;
192				regulator-name = "vcc33-audio-tv-ephy-mac";
193			};
194
195			/* ALDO3 is shorted to CLDO1 */
196			reg_aldo3: aldo3 {
197				regulator-always-on;
198				regulator-min-microvolt = <3300000>;
199				regulator-max-microvolt = <3300000>;
200				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
201			};
202
203			reg_bldo1: bldo1 {
204				regulator-always-on;
205				regulator-min-microvolt = <1800000>;
206				regulator-max-microvolt = <1800000>;
207				regulator-name = "vcc18-dram-bias-pll";
208			};
209
210			reg_bldo2: bldo2 {
211				regulator-always-on;
212				regulator-min-microvolt = <1800000>;
213				regulator-max-microvolt = <1800000>;
214				regulator-name = "vcc-efuse-pcie-hdmi-pc";
215			};
216
217			bldo3 {
218				/* unused */
219			};
220
221			bldo4 {
222				/* unused */
223			};
224
225			reg_cldo1: cldo1 {
226				regulator-always-on;
227				regulator-min-microvolt = <3300000>;
228				regulator-max-microvolt = <3300000>;
229				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
230			};
231
232			cldo2 {
233				/* unused */
234			};
235
236			cldo3 {
237				/* unused */
238			};
239
240			reg_dcdca: dcdca {
241				regulator-always-on;
242				regulator-min-microvolt = <800000>;
243				regulator-max-microvolt = <1160000>;
244				regulator-name = "vdd-cpu";
245			};
246
247			reg_dcdcc: dcdcc {
248				regulator-enable-ramp-delay = <32000>;
249				regulator-min-microvolt = <810000>;
250				regulator-max-microvolt = <1080000>;
251				regulator-name = "vdd-gpu";
252			};
253
254			reg_dcdcd: dcdcd {
255				regulator-always-on;
256				regulator-min-microvolt = <960000>;
257				regulator-max-microvolt = <960000>;
258				regulator-name = "vdd-sys";
259			};
260
261			reg_dcdce: dcdce {
262				regulator-always-on;
263				regulator-min-microvolt = <1200000>;
264				regulator-max-microvolt = <1200000>;
265				regulator-name = "vcc-dram";
266			};
267
268			sw {
269				/* unused */
270			};
271		};
272	};
273};
274
275&r_ir {
276	status = "okay";
277};
278
279&uart0 {
280	pinctrl-names = "default";
281	pinctrl-0 = <&uart0_ph_pins>;
282	status = "okay";
283};
284
285/* There's the BT part of the AP6256 connected to that UART */
286&uart1 {
287	pinctrl-names = "default";
288	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
289	uart-has-rtscts;
290	status = "okay";
291
292	bluetooth {
293		compatible = "brcm,bcm4345c5";
294		clocks = <&rtc 1>;
295		clock-names = "lpo";
296		device-wakeup-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
297		host-wakeup-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */
298		shutdown-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
299		max-speed = <1500000>;
300	};
301};
302
303&usb2otg {
304	/*
305	 * This board doesn't have a controllable VBUS even though it
306	 * does have an ID pin. Using it as anything but a USB host is
307	 * unsafe.
308	 */
309	dr_mode = "host";
310	status = "okay";
311};
312
313&usb2phy {
314	usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
315	usb0_vbus-supply = <&reg_vcc5v>;
316	usb3_vbus-supply = <&reg_vcc5v>;
317	status = "okay";
318};
319
320&usb3phy {
321	status = "okay";
322};
323