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