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	};
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	leds {
37		compatible = "gpio-leds";
38
39		power {
40			label = "orangepi:red:power";
41			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
42			default-state = "on";
43		};
44
45		status {
46			label = "orangepi:green:status";
47			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
48		};
49	};
50
51	reg_vcc5v: vcc5v {
52		/* board wide 5V supply directly from the DC jack */
53		compatible = "regulator-fixed";
54		regulator-name = "vcc-5v";
55		regulator-min-microvolt = <5000000>;
56		regulator-max-microvolt = <5000000>;
57		regulator-always-on;
58	};
59
60	reg_vcc33_wifi: vcc33-wifi {
61		/* Always on 3.3V regulator for WiFi and BT */
62		compatible = "regulator-fixed";
63		regulator-name = "vcc33-wifi";
64		regulator-min-microvolt = <3300000>;
65		regulator-max-microvolt = <3300000>;
66		regulator-always-on;
67		vin-supply = <&reg_vcc5v>;
68	};
69
70	reg_vcc_wifi_io: vcc-wifi-io {
71		/* Always on 1.8V/300mA regulator for WiFi and BT IO */
72		compatible = "regulator-fixed";
73		regulator-name = "vcc-wifi-io";
74		regulator-min-microvolt = <1800000>;
75		regulator-max-microvolt = <1800000>;
76		regulator-always-on;
77		vin-supply = <&reg_vcc33_wifi>;
78	};
79
80	wifi_pwrseq: wifi-pwrseq {
81		compatible = "mmc-pwrseq-simple";
82		clocks = <&rtc 1>;
83		clock-names = "ext_clock";
84		reset-gpios = <&r_pio 1 3 GPIO_ACTIVE_LOW>; /* PM3 */
85		post-power-on-delay-ms = <200>;
86	};
87};
88
89&cpu0 {
90	cpu-supply = <&reg_dcdca>;
91};
92
93&de {
94	status = "okay";
95};
96
97&ehci0 {
98	status = "okay";
99};
100
101&ehci3 {
102	status = "okay";
103};
104
105&hdmi {
106	status = "okay";
107};
108
109&hdmi_out {
110	hdmi_out_con: endpoint {
111		remote-endpoint = <&hdmi_con_in>;
112	};
113};
114
115&mmc0 {
116	vmmc-supply = <&reg_cldo1>;
117	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
118	bus-width = <4>;
119	status = "okay";
120};
121
122&mmc1 {
123	vmmc-supply = <&reg_vcc33_wifi>;
124	vqmmc-supply = <&reg_vcc_wifi_io>;
125	mmc-pwrseq = <&wifi_pwrseq>;
126	bus-width = <4>;
127	non-removable;
128	status = "okay";
129
130	brcm: sdio-wifi@1 {
131		reg = <1>;
132		compatible = "brcm,bcm4329-fmac";
133		interrupt-parent = <&r_pio>;
134		interrupts = <1 0 IRQ_TYPE_LEVEL_LOW>; /* PM0 */
135		interrupt-names = "host-wake";
136	};
137};
138
139&ohci0 {
140	status = "okay";
141};
142
143&ohci3 {
144	status = "okay";
145};
146
147&pio {
148	vcc-pc-supply = <&reg_bldo2>;
149	vcc-pd-supply = <&reg_cldo1>;
150	vcc-pg-supply = <&reg_vcc_wifi_io>;
151};
152
153&r_i2c {
154	status = "okay";
155
156	axp805: pmic@36 {
157		compatible = "x-powers,axp805", "x-powers,axp806";
158		reg = <0x36>;
159		interrupt-parent = <&r_intc>;
160		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
161		interrupt-controller;
162		#interrupt-cells = <1>;
163		x-powers,self-working-mode;
164		vina-supply = <&reg_vcc5v>;
165		vinb-supply = <&reg_vcc5v>;
166		vinc-supply = <&reg_vcc5v>;
167		vind-supply = <&reg_vcc5v>;
168		vine-supply = <&reg_vcc5v>;
169		aldoin-supply = <&reg_vcc5v>;
170		bldoin-supply = <&reg_vcc5v>;
171		cldoin-supply = <&reg_vcc5v>;
172
173		regulators {
174			reg_aldo1: aldo1 {
175				regulator-always-on;
176				regulator-min-microvolt = <3300000>;
177				regulator-max-microvolt = <3300000>;
178				regulator-name = "vcc-pl-led-ir";
179			};
180
181			reg_aldo2: aldo2 {
182				regulator-min-microvolt = <3300000>;
183				regulator-max-microvolt = <3300000>;
184				regulator-name = "vcc33-audio-tv-ephy-mac";
185			};
186
187			/* ALDO3 is shorted to CLDO1 */
188			reg_aldo3: aldo3 {
189				regulator-always-on;
190				regulator-min-microvolt = <3300000>;
191				regulator-max-microvolt = <3300000>;
192				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
193			};
194
195			reg_bldo1: bldo1 {
196				regulator-always-on;
197				regulator-min-microvolt = <1800000>;
198				regulator-max-microvolt = <1800000>;
199				regulator-name = "vcc18-dram-bias-pll";
200			};
201
202			reg_bldo2: bldo2 {
203				regulator-always-on;
204				regulator-min-microvolt = <1800000>;
205				regulator-max-microvolt = <1800000>;
206				regulator-name = "vcc-efuse-pcie-hdmi-pc";
207			};
208
209			bldo3 {
210				/* unused */
211			};
212
213			bldo4 {
214				/* unused */
215			};
216
217			reg_cldo1: cldo1 {
218				regulator-always-on;
219				regulator-min-microvolt = <3300000>;
220				regulator-max-microvolt = <3300000>;
221				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
222			};
223
224			cldo2 {
225				/* unused */
226			};
227
228			cldo3 {
229				/* unused */
230			};
231
232			reg_dcdca: dcdca {
233				regulator-always-on;
234				regulator-min-microvolt = <800000>;
235				regulator-max-microvolt = <1160000>;
236				regulator-name = "vdd-cpu";
237			};
238
239			reg_dcdcc: dcdcc {
240				regulator-min-microvolt = <810000>;
241				regulator-max-microvolt = <1080000>;
242				regulator-name = "vdd-gpu";
243			};
244
245			reg_dcdcd: dcdcd {
246				regulator-always-on;
247				regulator-min-microvolt = <960000>;
248				regulator-max-microvolt = <960000>;
249				regulator-name = "vdd-sys";
250			};
251
252			reg_dcdce: dcdce {
253				regulator-always-on;
254				regulator-min-microvolt = <1200000>;
255				regulator-max-microvolt = <1200000>;
256				regulator-name = "vcc-dram";
257			};
258
259			sw {
260				/* unused */
261			};
262		};
263	};
264};
265
266&uart0 {
267	pinctrl-names = "default";
268	pinctrl-0 = <&uart0_ph_pins>;
269	status = "okay";
270};
271
272&usb2otg {
273	/*
274	 * This board doesn't have a controllable VBUS even though it
275	 * does have an ID pin. Using it as anything but a USB host is
276	 * unsafe.
277	 */
278	dr_mode = "host";
279	status = "okay";
280};
281
282&usb2phy {
283	usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
284	usb0_vbus-supply = <&reg_vcc5v>;
285	usb3_vbus-supply = <&reg_vcc5v>;
286	status = "okay";
287};
288