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