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