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