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
61&cpu0 {
62	cpu-supply = <&reg_dcdca>;
63};
64
65&de {
66	status = "okay";
67};
68
69&ehci0 {
70	status = "okay";
71};
72
73&ehci3 {
74	status = "okay";
75};
76
77&hdmi {
78	status = "okay";
79};
80
81&hdmi_out {
82	hdmi_out_con: endpoint {
83		remote-endpoint = <&hdmi_con_in>;
84	};
85};
86
87&mmc0 {
88	vmmc-supply = <&reg_cldo1>;
89	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
90	bus-width = <4>;
91	status = "okay";
92};
93
94&ohci0 {
95	status = "okay";
96};
97
98&ohci3 {
99	status = "okay";
100};
101
102&pio {
103	vcc-pc-supply = <&reg_bldo2>;
104	vcc-pd-supply = <&reg_cldo1>;
105};
106
107&r_i2c {
108	status = "okay";
109
110	axp805: pmic@36 {
111		compatible = "x-powers,axp805", "x-powers,axp806";
112		reg = <0x36>;
113		interrupt-parent = <&r_intc>;
114		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
115		interrupt-controller;
116		#interrupt-cells = <1>;
117		x-powers,self-working-mode;
118		vina-supply = <&reg_vcc5v>;
119		vinb-supply = <&reg_vcc5v>;
120		vinc-supply = <&reg_vcc5v>;
121		vind-supply = <&reg_vcc5v>;
122		vine-supply = <&reg_vcc5v>;
123		aldoin-supply = <&reg_vcc5v>;
124		bldoin-supply = <&reg_vcc5v>;
125		cldoin-supply = <&reg_vcc5v>;
126
127		regulators {
128			reg_aldo1: aldo1 {
129				regulator-always-on;
130				regulator-min-microvolt = <3300000>;
131				regulator-max-microvolt = <3300000>;
132				regulator-name = "vcc-pl-led-ir";
133			};
134
135			reg_aldo2: aldo2 {
136				regulator-min-microvolt = <3300000>;
137				regulator-max-microvolt = <3300000>;
138				regulator-name = "vcc33-audio-tv-ephy-mac";
139			};
140
141			/* ALDO3 is shorted to CLDO1 */
142			reg_aldo3: aldo3 {
143				regulator-always-on;
144				regulator-min-microvolt = <3300000>;
145				regulator-max-microvolt = <3300000>;
146				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
147			};
148
149			reg_bldo1: bldo1 {
150				regulator-always-on;
151				regulator-min-microvolt = <1800000>;
152				regulator-max-microvolt = <1800000>;
153				regulator-name = "vcc18-dram-bias-pll";
154			};
155
156			reg_bldo2: bldo2 {
157				regulator-always-on;
158				regulator-min-microvolt = <1800000>;
159				regulator-max-microvolt = <1800000>;
160				regulator-name = "vcc-efuse-pcie-hdmi-pc";
161			};
162
163			bldo3 {
164				/* unused */
165			};
166
167			bldo4 {
168				/* unused */
169			};
170
171			reg_cldo1: cldo1 {
172				regulator-always-on;
173				regulator-min-microvolt = <3300000>;
174				regulator-max-microvolt = <3300000>;
175				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
176			};
177
178			cldo2 {
179				/* unused */
180			};
181
182			cldo3 {
183				/* unused */
184			};
185
186			reg_dcdca: dcdca {
187				regulator-always-on;
188				regulator-min-microvolt = <800000>;
189				regulator-max-microvolt = <1160000>;
190				regulator-name = "vdd-cpu";
191			};
192
193			reg_dcdcc: dcdcc {
194				regulator-min-microvolt = <810000>;
195				regulator-max-microvolt = <1080000>;
196				regulator-name = "vdd-gpu";
197			};
198
199			reg_dcdcd: dcdcd {
200				regulator-always-on;
201				regulator-min-microvolt = <960000>;
202				regulator-max-microvolt = <960000>;
203				regulator-name = "vdd-sys";
204			};
205
206			reg_dcdce: dcdce {
207				regulator-always-on;
208				regulator-min-microvolt = <1200000>;
209				regulator-max-microvolt = <1200000>;
210				regulator-name = "vcc-dram";
211			};
212
213			sw {
214				/* unused */
215			};
216		};
217	};
218};
219
220&uart0 {
221	pinctrl-names = "default";
222	pinctrl-0 = <&uart0_ph_pins>;
223	status = "okay";
224};
225
226&usb2otg {
227	/*
228	 * This board doesn't have a controllable VBUS even though it
229	 * does have an ID pin. Using it as anything but a USB host is
230	 * unsafe.
231	 */
232	dr_mode = "host";
233	status = "okay";
234};
235
236&usb2phy {
237	usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
238	usb0_vbus-supply = <&reg_vcc5v>;
239	usb3_vbus-supply = <&reg_vcc5v>;
240	status = "okay";
241};
242