1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (c) 2017 Icenowy Zheng <icenowy@aosc.io>
3
4/dts-v1/;
5
6#include "sun50i-h6.dtsi"
7#include "sun50i-h6-cpu-opp.dtsi"
8
9#include <dt-bindings/gpio/gpio.h>
10
11/ {
12	model = "Pine H64 model A";
13	compatible = "pine64,pine-h64", "allwinner,sun50i-h6";
14
15	aliases {
16		ethernet0 = &emac;
17		serial0 = &uart0;
18		spi0 = &spi0;
19	};
20
21	chosen {
22		stdout-path = "serial0:115200n8";
23	};
24
25	ext_osc32k: ext_osc32k_clk {
26		#clock-cells = <0>;
27		compatible = "fixed-clock";
28		clock-frequency = <32768>;
29		clock-output-names = "ext_osc32k";
30	};
31
32	hdmi_connector: connector {
33		compatible = "hdmi-connector";
34		type = "a";
35		ddc-en-gpios = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
36
37		port {
38			hdmi_con_in: endpoint {
39				remote-endpoint = <&hdmi_out_con>;
40			};
41		};
42	};
43
44	leds {
45		compatible = "gpio-leds";
46
47		led-0 {
48			label = "pine-h64:green:heartbeat";
49			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
50		};
51
52		led-1 {
53			label = "pine-h64:white:link";
54			gpios = <&r_pio 0 3 GPIO_ACTIVE_HIGH>; /* PL3 */
55		};
56
57		led-2 {
58			label = "pine-h64:blue:status";
59			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
60		};
61	};
62
63	reg_gmac_3v3: gmac-3v3 {
64		compatible = "regulator-fixed";
65		regulator-name = "vcc-gmac-3v3";
66		regulator-min-microvolt = <3300000>;
67		regulator-max-microvolt = <3300000>;
68		startup-delay-us = <100000>;
69		gpio = <&pio 2 16 GPIO_ACTIVE_HIGH>;
70		enable-active-high;
71	};
72
73	reg_usb_vbus: vbus {
74		compatible = "regulator-fixed";
75		regulator-name = "usb-vbus";
76		regulator-min-microvolt = <5000000>;
77		regulator-max-microvolt = <5000000>;
78		startup-delay-us = <100000>;
79		gpio = <&r_pio 0 5 GPIO_ACTIVE_HIGH>;
80		enable-active-high;
81	};
82};
83
84&cpu0 {
85	cpu-supply = <&reg_dcdca>;
86};
87
88&de {
89	status = "okay";
90};
91
92&ehci0 {
93	status = "okay";
94};
95
96&ehci3 {
97	status = "okay";
98};
99
100&emac {
101	pinctrl-names = "default";
102	pinctrl-0 = <&ext_rgmii_pins>;
103	phy-mode = "rgmii-id";
104	phy-handle = <&ext_rgmii_phy>;
105	phy-supply = <&reg_gmac_3v3>;
106	allwinner,rx-delay-ps = <200>;
107	allwinner,tx-delay-ps = <200>;
108	status = "okay";
109};
110
111&gpu {
112	mali-supply = <&reg_dcdcc>;
113	status = "okay";
114};
115
116&hdmi {
117	status = "okay";
118};
119
120&hdmi_out {
121	hdmi_out_con: endpoint {
122		remote-endpoint = <&hdmi_con_in>;
123	};
124};
125
126&mdio {
127	ext_rgmii_phy: ethernet-phy@1 {
128		compatible = "ethernet-phy-ieee802.3-c22";
129		reg = <1>;
130	};
131};
132
133&mmc0 {
134	vmmc-supply = <&reg_cldo1>;
135	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
136	bus-width = <4>;
137	status = "okay";
138};
139
140&mmc2 {
141	vmmc-supply = <&reg_cldo1>;
142	vqmmc-supply = <&reg_bldo2>;
143	non-removable;
144	cap-mmc-hw-reset;
145	mmc-hs200-1_8v;
146	bus-width = <8>;
147	status = "okay";
148};
149
150&ohci0 {
151	status = "okay";
152};
153
154&ohci3 {
155	status = "okay";
156};
157
158&pio {
159	vcc-pc-supply = <&reg_bldo2>;
160	vcc-pd-supply = <&reg_cldo1>;
161	vcc-pg-supply = <&reg_aldo1>;
162};
163
164&r_i2c {
165	status = "okay";
166
167	axp805: pmic@36 {
168		compatible = "x-powers,axp805", "x-powers,axp806";
169		reg = <0x36>;
170		interrupt-parent = <&r_intc>;
171		interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
172		interrupt-controller;
173		#interrupt-cells = <1>;
174		x-powers,self-working-mode;
175
176		regulators {
177			reg_aldo1: aldo1 {
178				regulator-always-on;
179				regulator-min-microvolt = <3300000>;
180				regulator-max-microvolt = <3300000>;
181				regulator-name = "vcc-pl";
182			};
183
184			reg_aldo2: aldo2 {
185				regulator-min-microvolt = <3300000>;
186				regulator-max-microvolt = <3300000>;
187				regulator-name = "vcc-ac200";
188				regulator-enable-ramp-delay = <100000>;
189			};
190
191			reg_aldo3: aldo3 {
192				/* This regulator is connected with CLDO1 */
193				regulator-always-on;
194				regulator-min-microvolt = <3300000>;
195				regulator-max-microvolt = <3300000>;
196				regulator-name = "vcc-3v3-1";
197			};
198
199			reg_bldo1: bldo1 {
200				regulator-always-on;
201				regulator-min-microvolt = <1800000>;
202				regulator-max-microvolt = <1800000>;
203				regulator-name = "vcc-bias-pll";
204			};
205
206			reg_bldo2: bldo2 {
207				regulator-always-on;
208				regulator-min-microvolt = <1800000>;
209				regulator-max-microvolt = <1800000>;
210				regulator-name = "vcc-efuse-pcie-hdmi-io";
211			};
212
213			reg_bldo3: bldo3 {
214				regulator-always-on;
215				regulator-min-microvolt = <1800000>;
216				regulator-max-microvolt = <1800000>;
217				regulator-name = "vcc-dcxoio";
218			};
219
220			bldo4 {
221				/* unused */
222			};
223
224			reg_cldo1: cldo1 {
225				/* This regulator is connected with ALDO3 */
226				regulator-always-on;
227				regulator-min-microvolt = <3300000>;
228				regulator-max-microvolt = <3300000>;
229				regulator-name = "vcc-3v3-2";
230			};
231
232			reg_cldo2: cldo2 {
233				regulator-min-microvolt = <3300000>;
234				regulator-max-microvolt = <3300000>;
235				regulator-name = "vcc-wifi-1";
236			};
237
238			reg_cldo3: cldo3 {
239				regulator-min-microvolt = <3300000>;
240				regulator-max-microvolt = <3300000>;
241				regulator-name = "vcc-wifi-2";
242			};
243
244			reg_dcdca: dcdca {
245				regulator-always-on;
246				regulator-min-microvolt = <810000>;
247				regulator-max-microvolt = <1160000>;
248				regulator-ramp-delay = <2500>;
249				regulator-name = "vdd-cpu";
250			};
251
252			reg_dcdcc: dcdcc {
253				regulator-enable-ramp-delay = <32000>;
254				regulator-min-microvolt = <810000>;
255				regulator-max-microvolt = <1080000>;
256				regulator-ramp-delay = <2500>;
257				regulator-name = "vdd-gpu";
258			};
259
260			reg_dcdcd: dcdcd {
261				regulator-always-on;
262				regulator-min-microvolt = <960000>;
263				regulator-max-microvolt = <960000>;
264				regulator-name = "vdd-sys";
265			};
266
267			reg_dcdce: dcdce {
268				regulator-always-on;
269				regulator-min-microvolt = <1200000>;
270				regulator-max-microvolt = <1200000>;
271				regulator-name = "vcc-dram";
272			};
273
274			sw {
275				/* unused */
276			};
277		};
278	};
279
280	pcf8563: rtc@51 {
281		compatible = "nxp,pcf8563";
282		reg = <0x51>;
283		interrupt-parent = <&r_intc>;
284		interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
285		#clock-cells = <0>;
286	};
287};
288
289&r_ir {
290	status = "okay";
291};
292
293&r_pio {
294	vcc-pm-supply = <&reg_aldo1>;
295};
296
297&rtc {
298	clocks = <&ext_osc32k>;
299};
300
301/*
302 * The CS pin is shared with the MMC2 CMD pin, so we cannot have the SPI
303 * flash and eMMC at the same time, as one of them would fail probing.
304 * Disable SPI0 in here, to prefer the more useful eMMC. U-Boot can
305 * fix this up in no eMMC is connected.
306 */
307&spi0 {
308	pinctrl-0 = <&spi0_pins>, <&spi0_cs_pin>;
309	pinctrl-names = "default";
310	status = "disabled";
311
312	flash@0 {
313		compatible = "winbond,w25q128", "jedec,spi-nor";
314		reg = <0>;
315		spi-max-frequency = <4000000>;
316	};
317};
318
319&uart0 {
320	pinctrl-names = "default";
321	pinctrl-0 = <&uart0_ph_pins>;
322	status = "okay";
323};
324
325&usb2otg {
326	dr_mode = "host";
327	status = "okay";
328};
329
330&usb2phy {
331	usb0_vbus-supply = <&reg_usb_vbus>;
332	usb3_vbus-supply = <&reg_usb_vbus>;
333	status = "okay";
334};
335