1// SPDX-License-Identifier: (GPL-2.0+ or MIT)
2/*
3 * Copyright (C) 2020 Arm Ltd.
4 */
5
6/dts-v1/;
7
8#include "sun50i-h616.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/interrupt-controller/arm-gic.h>
12#include <dt-bindings/leds/common.h>
13
14/ {
15	model = "OrangePi Zero2";
16	compatible = "xunlong,orangepi-zero2", "allwinner,sun50i-h616";
17
18	aliases {
19		ethernet0 = &emac0;
20		serial0 = &uart0;
21	};
22
23	chosen {
24		stdout-path = "serial0:115200n8";
25	};
26
27	leds {
28		compatible = "gpio-leds";
29
30		led-0 {
31			function = LED_FUNCTION_POWER;
32			color = <LED_COLOR_ID_RED>;
33			gpios = <&pio 2 12 GPIO_ACTIVE_HIGH>; /* PC12 */
34			default-state = "on";
35		};
36
37		led-1 {
38			function = LED_FUNCTION_STATUS;
39			color = <LED_COLOR_ID_GREEN>;
40			gpios = <&pio 2 13 GPIO_ACTIVE_HIGH>; /* PC13 */
41		};
42	};
43
44	reg_vcc5v: vcc5v {
45		/* board wide 5V supply directly from the USB-C socket */
46		compatible = "regulator-fixed";
47		regulator-name = "vcc-5v";
48		regulator-min-microvolt = <5000000>;
49		regulator-max-microvolt = <5000000>;
50		regulator-always-on;
51	};
52
53	reg_usb1_vbus: usb1-vbus {
54		compatible = "regulator-fixed";
55		regulator-name = "usb1-vbus";
56		regulator-min-microvolt = <5000000>;
57		regulator-max-microvolt = <5000000>;
58		vin-supply = <&reg_vcc5v>;
59		enable-active-high;
60		gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>; /* PC16 */
61		status = "okay";
62	};
63};
64
65&ehci0 {
66	status = "okay";
67};
68
69&ehci1 {
70	status = "okay";
71};
72
73/* USB 2 & 3 are on headers only. */
74
75&emac0 {
76	pinctrl-names = "default";
77	pinctrl-0 = <&ext_rgmii_pins>;
78	phy-mode = "rgmii";
79	phy-handle = <&ext_rgmii_phy>;
80	phy-supply = <&reg_dcdce>;
81	allwinner,rx-delay-ps = <3100>;
82	allwinner,tx-delay-ps = <700>;
83	status = "okay";
84};
85
86&mdio0 {
87	ext_rgmii_phy: ethernet-phy@1 {
88		compatible = "ethernet-phy-ieee802.3-c22";
89		reg = <1>;
90	};
91};
92
93&mmc0 {
94	vmmc-supply = <&reg_dcdce>;
95	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;	/* PF6 */
96	bus-width = <4>;
97	status = "okay";
98};
99
100&ohci0 {
101	status = "okay";
102};
103
104&ohci1 {
105	status = "okay";
106};
107
108&r_rsb {
109	status = "okay";
110
111	axp305: pmic@745 {
112		compatible = "x-powers,axp305", "x-powers,axp805",
113			     "x-powers,axp806";
114		interrupt-controller;
115		#interrupt-cells = <1>;
116		reg = <0x745>;
117
118		x-powers,self-working-mode;
119		vina-supply = <&reg_vcc5v>;
120		vinb-supply = <&reg_vcc5v>;
121		vinc-supply = <&reg_vcc5v>;
122		vind-supply = <&reg_vcc5v>;
123		vine-supply = <&reg_vcc5v>;
124		aldoin-supply = <&reg_vcc5v>;
125		bldoin-supply = <&reg_vcc5v>;
126		cldoin-supply = <&reg_vcc5v>;
127
128		regulators {
129			reg_aldo1: aldo1 {
130				regulator-always-on;
131				regulator-min-microvolt = <3300000>;
132				regulator-max-microvolt = <3300000>;
133				regulator-name = "vcc-sys";
134			};
135
136			reg_aldo2: aldo2 {	/* 3.3V on headers */
137				regulator-always-on;
138				regulator-min-microvolt = <3300000>;
139				regulator-max-microvolt = <3300000>;
140				regulator-name = "vcc3v3-ext";
141			};
142
143			reg_aldo3: aldo3 {	/* 3.3V on headers */
144				regulator-always-on;
145				regulator-min-microvolt = <3300000>;
146				regulator-max-microvolt = <3300000>;
147				regulator-name = "vcc3v3-ext2";
148			};
149
150			reg_bldo1: bldo1 {
151				regulator-always-on;
152				regulator-min-microvolt = <1800000>;
153				regulator-max-microvolt = <1800000>;
154				regulator-name = "vcc1v8";
155			};
156
157			bldo2 {
158				/* unused */
159			};
160
161			bldo3 {
162				/* unused */
163			};
164
165			bldo4 {
166				/* unused */
167			};
168
169			cldo1 {
170				/* reserved */
171			};
172
173			cldo2 {
174				/* unused */
175			};
176
177			cldo3 {
178				/* unused */
179			};
180
181			reg_dcdca: dcdca {
182				regulator-always-on;
183				regulator-min-microvolt = <810000>;
184				regulator-max-microvolt = <1080000>;
185				regulator-name = "vdd-cpu";
186			};
187
188			reg_dcdcc: dcdcc {
189				regulator-always-on;
190				regulator-min-microvolt = <810000>;
191				regulator-max-microvolt = <1080000>;
192				regulator-name = "vdd-gpu-sys";
193			};
194
195			reg_dcdcd: dcdcd {
196				regulator-always-on;
197				regulator-min-microvolt = <1500000>;
198				regulator-max-microvolt = <1500000>;
199				regulator-name = "vdd-dram";
200			};
201
202			reg_dcdce: dcdce {
203				regulator-boot-on;
204				regulator-min-microvolt = <3300000>;
205				regulator-max-microvolt = <3300000>;
206				regulator-name = "vcc-eth-mmc";
207			};
208
209			sw {
210				/* unused */
211			};
212		};
213	};
214};
215
216&spi0  {
217	status = "okay";
218
219	flash@0 {
220		#address-cells = <1>;
221		#size-cells = <1>;
222		compatible = "jedec,spi-nor";
223		reg = <0>;
224		spi-max-frequency = <40000000>;
225	};
226};
227
228&uart0 {
229	pinctrl-names = "default";
230	pinctrl-0 = <&uart0_ph_pins>;
231	status = "okay";
232};
233
234&usbotg {
235	dr_mode = "peripheral";
236	status = "okay";
237};
238
239&usbphy {
240	usb1_vbus-supply = <&reg_usb1_vbus>;
241	status = "okay";
242};
243