1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (C) 2018 Amarula Solutions B.V.
3// Author: Jagan Teki <jagan@amarulasolutions.com>
4
5/dts-v1/;
6
7#include "sun50i-a64.dtsi"
8
9#include <dt-bindings/gpio/gpio.h>
10
11/ {
12	model = "Amarula A64-Relic";
13	compatible = "amarula,a64-relic", "allwinner,sun50i-a64";
14
15	aliases {
16		serial0 = &uart0;
17	};
18
19	chosen {
20		stdout-path = "serial0:115200n8";
21	};
22
23	i2c {
24		compatible = "i2c-gpio";
25		sda-gpios = <&pio 4 13 GPIO_ACTIVE_HIGH>;
26		scl-gpios = <&pio 4 12 GPIO_ACTIVE_HIGH>;
27		i2c-gpio,delay-us = <5>;
28		#address-cells = <1>;
29		#size-cells = <0>;
30
31		ov5640: camera@3c {
32			compatible = "ovti,ov5640";
33			reg = <0x3c>;
34			pinctrl-names = "default";
35			pinctrl-0 = <&csi_mclk_pin>;
36			clocks = <&ccu CLK_CSI_MCLK>;
37			clock-names = "xclk";
38
39			AVDD-supply = <&reg_aldo1>;
40			DOVDD-supply = <&reg_dldo3>;
41			DVDD-supply = <&reg_eldo3>;
42			reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* CSI-RST-R: PE14 */
43			powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* CSI-STBY-R: PE15 */
44
45			port {
46				ov5640_ep: endpoint {
47					remote-endpoint = <&csi_ep>;
48					bus-width = <8>;
49					hsync-active = <1>; /* Active high */
50					vsync-active = <0>; /* Active low */
51					data-active = <1>;  /* Active high */
52					pclk-sample = <1>;  /* Rising */
53				};
54			};
55		};
56	};
57
58	wifi_pwrseq: wifi-pwrseq {
59		compatible = "mmc-pwrseq-simple";
60		clocks = <&rtc 1>;
61		clock-names = "ext_clock";
62		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* WL-PMU-EN: PL2 */
63	};
64};
65
66&csi {
67	status = "okay";
68
69	port {
70		csi_ep: endpoint {
71			remote-endpoint = <&ov5640_ep>;
72			bus-width = <8>;
73			hsync-active = <1>; /* Active high */
74			vsync-active = <0>; /* Active low */
75			data-active = <1>;  /* Active high */
76			pclk-sample = <1>;  /* Rising */
77		};
78	};
79};
80
81&ehci0 {
82	status = "okay";
83};
84
85&i2c0 {
86	status = "okay";
87
88	sensor@48 {
89		compatible = "st,stlm75";
90		reg = <0x48>;
91	};
92};
93
94&i2c0_pins {
95	bias-pull-up;
96};
97
98&i2c1 {
99	status = "okay";
100
101	touchscreen@5d {
102		compatible = "goodix,gt5663";
103		reg = <0x5d>;
104		AVDD28-supply = <&reg_ldo_io0>;			/* VCC-CTP: GPIO0-LDO */
105		interrupt-parent = <&pio>;
106		interrupts = <7 4 IRQ_TYPE_EDGE_FALLING>;
107		irq-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>;	/* CTP-INT: PH4 */
108		reset-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>;	/* CTP-RST: PH8 */
109		touchscreen-inverted-x;
110		touchscreen-inverted-y;
111	};
112};
113
114&mmc1 {
115	pinctrl-names = "default";
116	pinctrl-0 = <&mmc1_pins>;
117	vmmc-supply = <&reg_dcdc1>;
118	/*
119	 * Schematic shows both dldo4 and eldo1 connected for vcc-io-wifi, but
120	 * dldo4 connection shows DNP(Do Not Populate) and eldo1 connected with
121	 * 0Ohm register to vcc-io-wifi so eldo1 is used.
122	 */
123	vqmmc-supply = <&reg_eldo1>;
124	mmc-pwrseq = <&wifi_pwrseq>;
125	bus-width = <4>;
126	non-removable;
127	status = "okay";
128
129	brcmf: wifi@1 {
130		reg = <1>;
131		compatible = "brcm,bcm4329-fmac";
132		interrupt-parent = <&r_pio>;
133		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>;	/* WL-WAKE-AP: PL3 */
134		interrupt-names = "host-wake";
135	};
136};
137
138&mmc2 {
139	pinctrl-names = "default";
140	pinctrl-0 = <&mmc2_pins>;
141	vmmc-supply = <&reg_dcdc1>;
142	bus-width = <8>;
143	non-removable;
144	cap-mmc-hw-reset;
145	status = "okay";
146};
147
148&ohci0 {
149	status = "okay";
150};
151
152&r_rsb {
153	status = "okay";
154
155	axp803: pmic@3a3 {
156		compatible = "x-powers,axp803";
157		reg = <0x3a3>;
158		interrupt-parent = <&r_intc>;
159		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
160		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
161	};
162};
163
164#include "axp803.dtsi"
165
166&reg_aldo1 {
167	regulator-always-on;
168	regulator-min-microvolt = <2800000>;
169	regulator-max-microvolt = <2800000>;
170	regulator-name = "avdd-csi";
171};
172
173&reg_aldo2 {
174	regulator-always-on;
175	regulator-min-microvolt = <1800000>;
176	regulator-max-microvolt = <3300000>;
177	regulator-name = "vcc-pl";
178};
179
180&reg_aldo3 {
181	regulator-always-on;
182	regulator-min-microvolt = <3000000>;
183	regulator-max-microvolt = <3000000>;
184	regulator-name = "vcc-pll-avcc";
185};
186
187&reg_dcdc1 {
188	regulator-always-on;
189	regulator-min-microvolt = <3300000>;
190	regulator-max-microvolt = <3300000>;
191	regulator-name = "vcc-3v3";
192};
193
194&reg_dcdc2 {
195	regulator-always-on;
196	regulator-min-microvolt = <1040000>;
197	regulator-max-microvolt = <1300000>;
198	regulator-name = "vdd-cpux";
199};
200
201/* DCDC3 is polyphased with DCDC2 */
202
203&reg_dcdc5 {
204	regulator-always-on;
205	regulator-min-microvolt = <1500000>;
206	regulator-max-microvolt = <1500000>;
207	regulator-name = "vcc-dram";
208};
209
210&reg_dcdc6 {
211	regulator-always-on;
212	regulator-min-microvolt = <1100000>;
213	regulator-max-microvolt = <1100000>;
214	regulator-name = "vdd-sys";
215};
216
217&reg_dldo1 {
218	regulator-min-microvolt = <3300000>;
219	regulator-max-microvolt = <3300000>;
220	regulator-name = "vcc-hdmi-dsi-sensor";
221};
222
223&reg_dldo2 {
224	regulator-min-microvolt = <3300000>;
225	regulator-max-microvolt = <3300000>;
226	regulator-name = "vcc-mipi";
227};
228
229&reg_dldo3 {
230	regulator-min-microvolt = <2800000>;
231	regulator-max-microvolt = <2800000>;
232	regulator-name = "dovdd-csi";
233};
234
235&reg_dldo4 {
236	regulator-min-microvolt = <3300000>;
237	regulator-max-microvolt = <3300000>;
238	regulator-name = "vcc-wifi-io";
239};
240
241&reg_drivevbus {
242	regulator-name = "usb0-vbus";
243	status = "okay";
244};
245
246&reg_eldo1 {
247	regulator-always-on;
248	regulator-min-microvolt = <1800000>;
249	regulator-max-microvolt = <1800000>;
250	regulator-name = "cpvdd";
251};
252
253&reg_eldo3 {
254	regulator-min-microvolt = <1800000>;
255	regulator-max-microvolt = <1800000>;
256	regulator-name = "dvdd-csi";
257};
258
259&reg_fldo1 {
260	regulator-min-microvolt = <1200000>;
261	regulator-max-microvolt = <1200000>;
262	regulator-name = "vcc-1v2-hsic";
263};
264
265/*
266 * The A64 chip cannot work without this regulator off, although
267 * it seems to be only driving the AR100 core.
268 * Maybe we don't still know well about CPUs domain.
269 */
270&reg_fldo2 {
271	regulator-always-on;
272	regulator-min-microvolt = <1100000>;
273	regulator-max-microvolt = <1100000>;
274	regulator-name = "vdd-cpus";
275};
276
277&reg_ldo_io0 {
278	regulator-min-microvolt = <2800000>;
279	regulator-max-microvolt = <2800000>;
280	regulator-name = "vcc-ctp";
281	status = "okay";
282};
283
284&reg_rtc_ldo {
285	regulator-name = "vcc-rtc";
286};
287
288&uart0 {
289	pinctrl-names = "default";
290	pinctrl-0 = <&uart0_pb_pins>;
291	status = "okay";
292};
293
294&usb_otg {
295	dr_mode = "otg";
296	status = "okay";
297};
298
299&usbphy {
300	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
301	usb0_vbus-supply = <&reg_drivevbus>;
302	status = "okay";
303};
304