1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2017 Jagan Teki <jteki@openedev.com>
3
4/dts-v1/;
5
6#include "sun50i-a64.dtsi"
7#include "sun50i-a64-cpu-opp.dtsi"
8
9#include <dt-bindings/gpio/gpio.h>
10
11/ {
12	model = "Olimex A64-Olinuxino";
13	compatible = "olimex,a64-olinuxino", "allwinner,sun50i-a64";
14
15	aliases {
16		ethernet0 = &emac;
17		serial0 = &uart0;
18	};
19
20	chosen {
21		stdout-path = "serial0:115200n8";
22	};
23
24	hdmi-connector {
25		compatible = "hdmi-connector";
26		type = "a";
27
28		port {
29			hdmi_con_in: endpoint {
30				remote-endpoint = <&hdmi_out_con>;
31			};
32		};
33	};
34
35	leds {
36		compatible = "gpio-leds";
37
38		led-0 {
39			label = "a64-olinuxino:red:user";
40			gpios = <&pio 4 17 GPIO_ACTIVE_HIGH>; /* PE17 */
41		};
42	};
43
44	reg_usb1_vbus: usb1-vbus {
45		compatible = "regulator-fixed";
46		regulator-name = "usb1-vbus";
47		regulator-min-microvolt = <5000000>;
48		regulator-max-microvolt = <5000000>;
49		regulator-boot-on;
50		enable-active-high;
51		gpio = <&pio 6 9 GPIO_ACTIVE_HIGH>; /* PG9 */
52		status = "okay";
53	};
54
55	wifi_pwrseq: wifi_pwrseq {
56		compatible = "mmc-pwrseq-simple";
57		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
58	};
59};
60
61&codec {
62	status = "okay";
63};
64
65&codec_analog {
66	cpvdd-supply = <&reg_eldo1>;
67	status = "okay";
68};
69
70&cpu0 {
71	cpu-supply = <&reg_dcdc2>;
72};
73
74&cpu1 {
75	cpu-supply = <&reg_dcdc2>;
76};
77
78&cpu2 {
79	cpu-supply = <&reg_dcdc2>;
80};
81
82&cpu3 {
83	cpu-supply = <&reg_dcdc2>;
84};
85
86&dai {
87	status = "okay";
88};
89
90&de {
91	status = "okay";
92};
93
94&ehci0 {
95	status = "okay";
96};
97
98&ehci1 {
99	status = "okay";
100};
101
102&emac {
103	pinctrl-names = "default";
104	pinctrl-0 = <&rgmii_pins>;
105	phy-mode = "rgmii";
106	phy-handle = <&ext_rgmii_phy>;
107	phy-supply = <&reg_dcdc1>;
108	allwinner,tx-delay-ps = <600>;
109	status = "okay";
110};
111
112&hdmi {
113	hvcc-supply = <&reg_dldo1>;
114	status = "okay";
115};
116
117&hdmi_out {
118	hdmi_out_con: endpoint {
119		remote-endpoint = <&hdmi_con_in>;
120	};
121};
122
123&mdio {
124	ext_rgmii_phy: ethernet-phy@1 {
125		compatible = "ethernet-phy-ieee802.3-c22";
126		reg = <1>;
127	};
128};
129
130&mmc0 {
131	pinctrl-names = "default";
132	pinctrl-0 = <&mmc0_pins>;
133	vmmc-supply = <&reg_dcdc1>;
134	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
135	disable-wp;
136	bus-width = <4>;
137	status = "okay";
138};
139
140&mmc1 {
141	pinctrl-names = "default";
142	pinctrl-0 = <&mmc1_pins>;
143	vmmc-supply = <&reg_dcdc1>;
144	vqmmc-supply = <&reg_dldo4>;
145	mmc-pwrseq = <&wifi_pwrseq>;
146	bus-width = <4>;
147	non-removable;
148	status = "okay";
149
150	rtl8723bs: wifi@1 {
151		reg = <1>;
152		interrupt-parent = <&r_pio>;
153		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
154		interrupt-names = "host-wake";
155	};
156};
157
158&ohci0 {
159	status = "okay";
160};
161
162&ohci1 {
163	status = "okay";
164};
165
166&pio {
167	vcc-pc-supply = <&reg_dcdc1>;
168	vcc-pd-supply = <&reg_dcdc1>;
169	vcc-pe-supply = <&reg_aldo1>;
170	vcc-pg-supply = <&reg_dldo4>;
171};
172
173&r_pio {
174	/*
175	 * FIXME: We can't add that supply for now since it would
176	 * create a circular dependency between pinctrl, the regulator
177	 * and the RSB Bus.
178	 *
179	 * vcc-pl-supply = <&reg_aldo2>;
180	 */
181};
182
183&pio {
184	vcc-pa-supply = <&reg_dcdc1>;
185	vcc-pb-supply = <&reg_dcdc1>;
186	vcc-pc-supply = <&reg_dcdc1>;
187	vcc-pd-supply = <&reg_dcdc1>;
188	vcc-pe-supply = <&reg_aldo1>;
189	vcc-pf-supply = <&reg_dcdc1>;
190	vcc-pg-supply = <&reg_dldo4>;
191	vcc-ph-supply = <&reg_dcdc1>;
192};
193
194&r_rsb {
195	status = "okay";
196
197	axp803: pmic@3a3 {
198		compatible = "x-powers,axp803";
199		reg = <0x3a3>;
200		interrupt-parent = <&r_intc>;
201		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
202		x-powers,drive-vbus-en;	/* set N_VBUSEN as output pin */
203	};
204};
205
206/* VCC-PL is powered by aldo2 but we cannot add it as the RSB */
207/* interface used to talk to the PMIC in on the PL pins */
208/* &r_pio { */
209/*	vcc-pl-supply = <&reg_aldo2>; */
210/* }; */
211
212#include "axp803.dtsi"
213
214&ac_power_supply {
215	status = "okay";
216};
217
218&battery_power_supply {
219	status = "okay";
220};
221
222&reg_aldo1 {
223	regulator-always-on;
224	regulator-min-microvolt = <2800000>;
225	regulator-max-microvolt = <2800000>;
226	regulator-name = "vcc-pe";
227};
228
229&reg_aldo2 {
230	regulator-always-on;
231	regulator-min-microvolt = <3300000>;
232	regulator-max-microvolt = <3300000>;
233	regulator-name = "vcc-pl";
234};
235
236&reg_aldo3 {
237	regulator-always-on;
238	regulator-min-microvolt = <3000000>;
239	regulator-max-microvolt = <3000000>;
240	regulator-name = "vcc-pll-avcc";
241};
242
243&reg_dcdc1 {
244	regulator-always-on;
245	regulator-min-microvolt = <3300000>;
246	regulator-max-microvolt = <3300000>;
247	regulator-name = "vcc-3v3";
248};
249
250&reg_dcdc2 {
251	regulator-always-on;
252	regulator-min-microvolt = <1040000>;
253	regulator-max-microvolt = <1300000>;
254	regulator-name = "vdd-cpux";
255};
256
257/* DCDC3 is polyphased with DCDC2 */
258
259/*
260 * The board uses DDR3L DRAM chips. 1.36V is the closest to the nominal
261 * 1.35V that the PMIC can drive.
262 */
263&reg_dcdc5 {
264	regulator-always-on;
265	regulator-min-microvolt = <1360000>;
266	regulator-max-microvolt = <1360000>;
267	regulator-name = "vcc-ddr3";
268};
269
270&reg_dcdc6 {
271	regulator-always-on;
272	regulator-min-microvolt = <1100000>;
273	regulator-max-microvolt = <1100000>;
274	regulator-name = "vdd-sys";
275};
276
277&reg_dldo1 {
278	regulator-min-microvolt = <3300000>;
279	regulator-max-microvolt = <3300000>;
280	regulator-name = "vcc-hdmi";
281};
282
283&reg_dldo2 {
284	regulator-min-microvolt = <3300000>;
285	regulator-max-microvolt = <3300000>;
286	regulator-name = "vcc-mipi";
287};
288
289&reg_dldo3 {
290	regulator-min-microvolt = <2800000>;
291	regulator-max-microvolt = <2800000>;
292	regulator-name = "vcc-avdd-csi";
293};
294
295&reg_dldo4 {
296	regulator-min-microvolt = <3300000>;
297	regulator-max-microvolt = <3300000>;
298	regulator-name = "vcc-wifi-io";
299};
300
301&reg_drivevbus {
302	regulator-name = "usb0-vbus";
303	status = "okay";
304};
305
306&reg_eldo1 {
307	regulator-min-microvolt = <1800000>;
308	regulator-max-microvolt = <1800000>;
309	regulator-name = "cpvdd";
310};
311
312&reg_eldo2 {
313	regulator-min-microvolt = <1800000>;
314	regulator-max-microvolt = <1800000>;
315	regulator-name = "vcc-dvdd-csi";
316};
317
318&reg_fldo1 {
319	regulator-min-microvolt = <1200000>;
320	regulator-max-microvolt = <1200000>;
321	regulator-name = "vcc-1v2-hsic";
322};
323
324/*
325 * The A64 chip cannot work without this regulator off, although
326 * it seems to be only driving the AR100 core.
327 * Maybe we don't still know well about CPUs domain.
328 */
329&reg_fldo2 {
330	regulator-always-on;
331	regulator-min-microvolt = <1100000>;
332	regulator-max-microvolt = <1100000>;
333	regulator-name = "vdd-cpus";
334};
335
336&reg_rtc_ldo {
337	regulator-name = "vcc-rtc";
338};
339
340&simplefb_hdmi {
341	vcc-hdmi-supply = <&reg_dldo1>;
342};
343
344&sound {
345	simple-audio-card,aux-devs = <&codec_analog>;
346	simple-audio-card,widgets = "Microphone", "Microphone Jack Left",
347		    "Microphone", "Microphone Jack Right",
348		    "Headphone", "Headphone Jack";
349	simple-audio-card,routing = "Left DAC", "DACL",
350		    "Right DAC", "DACR",
351		    "Headphone Jack", "HP",
352		    "ADCL", "Left ADC",
353		    "ADCR", "Right ADC",
354		    "Microphone Jack Left", "MBIAS",
355		    "MIC1", "Microphone Jack Left",
356		    "Microphone Jack Right", "MBIAS",
357		    "MIC2", "Microphone Jack Right";
358	status = "okay";
359};
360
361&uart0 {
362	pinctrl-names = "default";
363	pinctrl-0 = <&uart0_pb_pins>;
364	status = "okay";
365};
366
367&usb_otg {
368	dr_mode = "otg";
369	status = "okay";
370};
371
372&usbphy {
373	status = "okay";
374	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
375	usb0_vbus-supply = <&reg_drivevbus>;
376	usb1_vbus-supply = <&reg_usb1_vbus>;
377};
378