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