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	leds {
25		compatible = "gpio-leds";
26
27		power {
28			label = "orangepi:red:power";
29			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
30			default-state = "on";
31		};
32
33		status {
34			label = "orangepi:green:status";
35			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
36		};
37	};
38
39	reg_vcc5v: vcc5v {
40		/* board wide 5V supply directly from the DC jack */
41		compatible = "regulator-fixed";
42		regulator-name = "vcc-5v";
43		regulator-min-microvolt = <5000000>;
44		regulator-max-microvolt = <5000000>;
45		regulator-always-on;
46	};
47};
48
49&cpu0 {
50	cpu-supply = <&reg_dcdca>;
51};
52
53&ehci0 {
54	status = "okay";
55};
56
57&ehci3 {
58	status = "okay";
59};
60
61&mmc0 {
62	vmmc-supply = <&reg_cldo1>;
63	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */
64	bus-width = <4>;
65	status = "okay";
66};
67
68&ohci0 {
69	status = "okay";
70};
71
72&ohci3 {
73	status = "okay";
74};
75
76&pio {
77	vcc-pc-supply = <&reg_bldo2>;
78	vcc-pd-supply = <&reg_cldo1>;
79};
80
81&r_i2c {
82	status = "okay";
83
84	axp805: pmic@36 {
85		compatible = "x-powers,axp805", "x-powers,axp806";
86		reg = <0x36>;
87		interrupt-parent = <&r_intc>;
88		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
89		interrupt-controller;
90		#interrupt-cells = <1>;
91		x-powers,self-working-mode;
92		vina-supply = <&reg_vcc5v>;
93		vinb-supply = <&reg_vcc5v>;
94		vinc-supply = <&reg_vcc5v>;
95		vind-supply = <&reg_vcc5v>;
96		vine-supply = <&reg_vcc5v>;
97		aldoin-supply = <&reg_vcc5v>;
98		bldoin-supply = <&reg_vcc5v>;
99		cldoin-supply = <&reg_vcc5v>;
100
101		regulators {
102			reg_aldo1: aldo1 {
103				regulator-always-on;
104				regulator-min-microvolt = <3300000>;
105				regulator-max-microvolt = <3300000>;
106				regulator-name = "vcc-pl-led-ir";
107			};
108
109			reg_aldo2: aldo2 {
110				regulator-min-microvolt = <3300000>;
111				regulator-max-microvolt = <3300000>;
112				regulator-name = "vcc33-audio-tv-ephy-mac";
113			};
114
115			/* ALDO3 is shorted to CLDO1 */
116			reg_aldo3: aldo3 {
117				regulator-always-on;
118				regulator-min-microvolt = <3300000>;
119				regulator-max-microvolt = <3300000>;
120				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-1";
121			};
122
123			reg_bldo1: bldo1 {
124				regulator-always-on;
125				regulator-min-microvolt = <1800000>;
126				regulator-max-microvolt = <1800000>;
127				regulator-name = "vcc18-dram-bias-pll";
128			};
129
130			reg_bldo2: bldo2 {
131				regulator-always-on;
132				regulator-min-microvolt = <1800000>;
133				regulator-max-microvolt = <1800000>;
134				regulator-name = "vcc-efuse-pcie-hdmi-pc";
135			};
136
137			bldo3 {
138				/* unused */
139			};
140
141			bldo4 {
142				/* unused */
143			};
144
145			reg_cldo1: cldo1 {
146				regulator-always-on;
147				regulator-min-microvolt = <3300000>;
148				regulator-max-microvolt = <3300000>;
149				regulator-name = "vcc33-io-pd-emmc-sd-usb-uart-2";
150			};
151
152			cldo2 {
153				/* unused */
154			};
155
156			cldo3 {
157				/* unused */
158			};
159
160			reg_dcdca: dcdca {
161				regulator-always-on;
162				regulator-min-microvolt = <800000>;
163				regulator-max-microvolt = <1160000>;
164				regulator-name = "vdd-cpu";
165			};
166
167			reg_dcdcc: dcdcc {
168				regulator-min-microvolt = <810000>;
169				regulator-max-microvolt = <1080000>;
170				regulator-name = "vdd-gpu";
171			};
172
173			reg_dcdcd: dcdcd {
174				regulator-always-on;
175				regulator-min-microvolt = <960000>;
176				regulator-max-microvolt = <960000>;
177				regulator-name = "vdd-sys";
178			};
179
180			reg_dcdce: dcdce {
181				regulator-always-on;
182				regulator-min-microvolt = <1200000>;
183				regulator-max-microvolt = <1200000>;
184				regulator-name = "vcc-dram";
185			};
186
187			sw {
188				/* unused */
189			};
190		};
191	};
192};
193
194&uart0 {
195	pinctrl-names = "default";
196	pinctrl-0 = <&uart0_ph_pins>;
197	status = "okay";
198};
199
200&usb2otg {
201	/*
202	 * This board doesn't have a controllable VBUS even though it
203	 * does have an ID pin. Using it as anything but a USB host is
204	 * unsafe.
205	 */
206	dr_mode = "host";
207	status = "okay";
208};
209
210&usb2phy {
211	usb0_id_det-gpios = <&pio 2 15 GPIO_ACTIVE_HIGH>; /* PC15 */
212	usb0_vbus-supply = <&reg_vcc5v>;
213	usb3_vbus-supply = <&reg_vcc5v>;
214	status = "okay";
215};
216