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		led-0 {
47			label = "orangepi:red:power";
48			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
49			default-state = "on";
50		};
51
52		led-1 {
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 CLK_OSC32K_FANOUT>;
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_ir {
179	status = "okay";
180};
181
182&r_rsb {
183	status = "okay";
184
185	axp805: pmic@745 {
186		compatible = "x-powers,axp805", "x-powers,axp806";
187		reg = <0x745>;
188		interrupt-parent = <&r_intc>;
189		interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
190		interrupt-controller;
191		#interrupt-cells = <1>;
192		x-powers,self-working-mode;
193		vina-supply = <&reg_vcc5v>;
194		vinb-supply = <&reg_vcc5v>;
195		vinc-supply = <&reg_vcc5v>;
196		vind-supply = <&reg_vcc5v>;
197		vine-supply = <&reg_vcc5v>;
198		aldoin-supply = <&reg_vcc5v>;
199		bldoin-supply = <&reg_vcc5v>;
200		cldoin-supply = <&reg_vcc5v>;
201
202		regulators {
203			reg_aldo1: aldo1 {
204				regulator-always-on;
205				regulator-min-microvolt = <3300000>;
206				regulator-max-microvolt = <3300000>;
207				regulator-name = "vcc-pl-led-ir";
208			};
209
210			reg_aldo2: aldo2 {
211				regulator-min-microvolt = <3300000>;
212				regulator-max-microvolt = <3300000>;
213				regulator-name = "vcc33-audio-tv-ephy-mac";
214			};
215
216			/* ALDO3 is shorted to CLDO1 */
217			reg_aldo3: aldo3 {
218				regulator-always-on;
219				regulator-min-microvolt = <3300000>;
220				regulator-max-microvolt = <3300000>;
221				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
222			};
223
224			reg_bldo1: bldo1 {
225				regulator-always-on;
226				regulator-min-microvolt = <1800000>;
227				regulator-max-microvolt = <1800000>;
228				regulator-name = "vcc18-dram-bias-pll";
229			};
230
231			reg_bldo2: bldo2 {
232				regulator-always-on;
233				regulator-min-microvolt = <1800000>;
234				regulator-max-microvolt = <1800000>;
235				regulator-name = "vcc-efuse-pcie-hdmi-pc";
236			};
237
238			bldo3 {
239				/* unused */
240			};
241
242			bldo4 {
243				/* unused */
244			};
245
246			reg_cldo1: cldo1 {
247				regulator-always-on;
248				regulator-min-microvolt = <3300000>;
249				regulator-max-microvolt = <3300000>;
250				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
251			};
252
253			cldo2 {
254				/* unused */
255			};
256
257			cldo3 {
258				/* unused */
259			};
260
261			reg_dcdca: dcdca {
262				regulator-always-on;
263				regulator-min-microvolt = <800000>;
264				regulator-max-microvolt = <1160000>;
265				regulator-ramp-delay = <2500>;
266				regulator-name = "vdd-cpu";
267			};
268
269			reg_dcdcc: dcdcc {
270				regulator-enable-ramp-delay = <32000>;
271				regulator-min-microvolt = <810000>;
272				regulator-max-microvolt = <1080000>;
273				regulator-ramp-delay = <2500>;
274				regulator-name = "vdd-gpu";
275			};
276
277			reg_dcdcd: dcdcd {
278				regulator-always-on;
279				regulator-min-microvolt = <960000>;
280				regulator-max-microvolt = <960000>;
281				regulator-name = "vdd-sys";
282			};
283
284			reg_dcdce: dcdce {
285				regulator-always-on;
286				regulator-min-microvolt = <1200000>;
287				regulator-max-microvolt = <1200000>;
288				regulator-name = "vcc-dram";
289			};
290
291			sw {
292				/* unused */
293			};
294		};
295	};
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 CLK_OSC32K_FANOUT>;
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