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