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&mmc2 {
148	vmmc-supply = <&reg_cldo1>;
149	vqmmc-supply = <&reg_bldo2>;
150	cap-mmc-hw-reset;
151	non-removable;
152	bus-width = <8>;
153	status = "okay";
154};
155
156&ohci0 {
157	status = "okay";
158};
159
160&ohci3 {
161	status = "okay";
162};
163
164&pio {
165	vcc-pc-supply = <&reg_bldo2>;
166	vcc-pd-supply = <&reg_cldo1>;
167	vcc-pg-supply = <&reg_vcc_wifi_io>;
168};
169
170&r_i2c {
171	status = "okay";
172
173	axp805: pmic@36 {
174		compatible = "x-powers,axp805", "x-powers,axp806";
175		reg = <0x36>;
176		interrupt-parent = <&r_intc>;
177		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
178		interrupt-controller;
179		#interrupt-cells = <1>;
180		x-powers,self-working-mode;
181		vina-supply = <&reg_vcc5v>;
182		vinb-supply = <&reg_vcc5v>;
183		vinc-supply = <&reg_vcc5v>;
184		vind-supply = <&reg_vcc5v>;
185		vine-supply = <&reg_vcc5v>;
186		aldoin-supply = <&reg_vcc5v>;
187		bldoin-supply = <&reg_vcc5v>;
188		cldoin-supply = <&reg_vcc5v>;
189
190		regulators {
191			reg_aldo1: aldo1 {
192				regulator-always-on;
193				regulator-min-microvolt = <3300000>;
194				regulator-max-microvolt = <3300000>;
195				regulator-name = "vcc-pl-led-ir";
196			};
197
198			reg_aldo2: aldo2 {
199				regulator-min-microvolt = <3300000>;
200				regulator-max-microvolt = <3300000>;
201				regulator-name = "vcc33-audio-tv-ephy-mac";
202			};
203
204			/* ALDO3 is shorted to CLDO1 */
205			reg_aldo3: aldo3 {
206				regulator-always-on;
207				regulator-min-microvolt = <3300000>;
208				regulator-max-microvolt = <3300000>;
209				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
210			};
211
212			reg_bldo1: bldo1 {
213				regulator-always-on;
214				regulator-min-microvolt = <1800000>;
215				regulator-max-microvolt = <1800000>;
216				regulator-name = "vcc18-dram-bias-pll";
217			};
218
219			reg_bldo2: bldo2 {
220				regulator-always-on;
221				regulator-min-microvolt = <1800000>;
222				regulator-max-microvolt = <1800000>;
223				regulator-name = "vcc-efuse-pcie-hdmi-pc";
224			};
225
226			bldo3 {
227				/* unused */
228			};
229
230			bldo4 {
231				/* unused */
232			};
233
234			reg_cldo1: cldo1 {
235				regulator-always-on;
236				regulator-min-microvolt = <3300000>;
237				regulator-max-microvolt = <3300000>;
238				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
239			};
240
241			cldo2 {
242				/* unused */
243			};
244
245			cldo3 {
246				/* unused */
247			};
248
249			reg_dcdca: dcdca {
250				regulator-always-on;
251				regulator-min-microvolt = <800000>;
252				regulator-max-microvolt = <1160000>;
253				regulator-name = "vdd-cpu";
254			};
255
256			reg_dcdcc: dcdcc {
257				regulator-enable-ramp-delay = <32000>;
258				regulator-min-microvolt = <810000>;
259				regulator-max-microvolt = <1080000>;
260				regulator-name = "vdd-gpu";
261			};
262
263			reg_dcdcd: dcdcd {
264				regulator-always-on;
265				regulator-min-microvolt = <960000>;
266				regulator-max-microvolt = <960000>;
267				regulator-name = "vdd-sys";
268			};
269
270			reg_dcdce: dcdce {
271				regulator-always-on;
272				regulator-min-microvolt = <1200000>;
273				regulator-max-microvolt = <1200000>;
274				regulator-name = "vcc-dram";
275			};
276
277			sw {
278				/* unused */
279			};
280		};
281	};
282};
283
284&r_ir {
285	status = "okay";
286};
287
288&uart0 {
289	pinctrl-names = "default";
290	pinctrl-0 = <&uart0_ph_pins>;
291	status = "okay";
292};
293
294/* There's the BT part of the AP6256 connected to that UART */
295&uart1 {
296	pinctrl-names = "default";
297	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
298	uart-has-rtscts;
299	status = "okay";
300
301	bluetooth {
302		compatible = "brcm,bcm4345c5";
303		clocks = <&rtc 1>;
304		clock-names = "lpo";
305		device-wakeup-gpios = <&r_pio 1 2 GPIO_ACTIVE_HIGH>; /* PM2 */
306		host-wakeup-gpios = <&r_pio 1 1 GPIO_ACTIVE_HIGH>; /* PM1 */
307		shutdown-gpios = <&r_pio 1 4 GPIO_ACTIVE_HIGH>; /* PM4 */
308		max-speed = <1500000>;
309	};
310};
311
312&usb2otg {
313	/*
314	 * This board doesn't have a controllable VBUS even though it
315	 * does have an ID pin. Using it as anything but a USB host is
316	 * unsafe.
317	 */
318	dr_mode = "host";
319	status = "okay";
320};
321
322&usb2phy {
323	usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
324	usb0_vbus-supply = <&reg_vcc5v>;
325	usb3_vbus-supply = <&reg_vcc5v>;
326	status = "okay";
327};
328
329&usb3phy {
330	status = "okay";
331};
332