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&mmc1 {
101	pinctrl-names = "default";
102	pinctrl-0 = <&mmc1_pins>;
103	vmmc-supply = <&reg_dcdc1>;
104	/*
105	 * Schematic shows both dldo4 and eldo1 connected for vcc-io-wifi, but
106	 * dldo4 connection shows DNP(Do Not Populate) and eldo1 connected with
107	 * 0Ohm register to vcc-io-wifi so eldo1 is used.
108	 */
109	vqmmc-supply = <&reg_eldo1>;
110	mmc-pwrseq = <&wifi_pwrseq>;
111	bus-width = <4>;
112	non-removable;
113	status = "okay";
114
115	brcmf: wifi@1 {
116		reg = <1>;
117		compatible = "brcm,bcm4329-fmac";
118		interrupt-parent = <&r_pio>;
119		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>;	/* WL-WAKE-AP: PL3 */
120		interrupt-names = "host-wake";
121	};
122};
123
124&mmc2 {
125	pinctrl-names = "default";
126	pinctrl-0 = <&mmc2_pins>;
127	vmmc-supply = <&reg_dcdc1>;
128	bus-width = <8>;
129	non-removable;
130	cap-mmc-hw-reset;
131	status = "okay";
132};
133
134&ohci0 {
135	status = "okay";
136};
137
138&r_rsb {
139	status = "okay";
140
141	axp803: pmic@3a3 {
142		compatible = "x-powers,axp803";
143		reg = <0x3a3>;
144		interrupt-parent = <&r_intc>;
145		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
146		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
147	};
148};
149
150#include "axp803.dtsi"
151
152&reg_aldo1 {
153	regulator-always-on;
154	regulator-min-microvolt = <2800000>;
155	regulator-max-microvolt = <2800000>;
156	regulator-name = "avdd-csi";
157};
158
159&reg_aldo2 {
160	regulator-always-on;
161	regulator-min-microvolt = <1800000>;
162	regulator-max-microvolt = <3300000>;
163	regulator-name = "vcc-pl";
164};
165
166&reg_aldo3 {
167	regulator-always-on;
168	regulator-min-microvolt = <3000000>;
169	regulator-max-microvolt = <3000000>;
170	regulator-name = "vcc-pll-avcc";
171};
172
173&reg_dcdc1 {
174	regulator-always-on;
175	regulator-min-microvolt = <3300000>;
176	regulator-max-microvolt = <3300000>;
177	regulator-name = "vcc-3v3";
178};
179
180&reg_dcdc2 {
181	regulator-always-on;
182	regulator-min-microvolt = <1040000>;
183	regulator-max-microvolt = <1300000>;
184	regulator-name = "vdd-cpux";
185};
186
187/* DCDC3 is polyphased with DCDC2 */
188
189&reg_dcdc5 {
190	regulator-always-on;
191	regulator-min-microvolt = <1500000>;
192	regulator-max-microvolt = <1500000>;
193	regulator-name = "vcc-dram";
194};
195
196&reg_dcdc6 {
197	regulator-always-on;
198	regulator-min-microvolt = <1100000>;
199	regulator-max-microvolt = <1100000>;
200	regulator-name = "vdd-sys";
201};
202
203&reg_dldo1 {
204	regulator-min-microvolt = <3300000>;
205	regulator-max-microvolt = <3300000>;
206	regulator-name = "vcc-hdmi-dsi-sensor";
207};
208
209&reg_dldo2 {
210	regulator-min-microvolt = <3300000>;
211	regulator-max-microvolt = <3300000>;
212	regulator-name = "vcc-mipi";
213};
214
215&reg_dldo3 {
216	regulator-min-microvolt = <2800000>;
217	regulator-max-microvolt = <2800000>;
218	regulator-name = "dovdd-csi";
219};
220
221&reg_dldo4 {
222	regulator-min-microvolt = <3300000>;
223	regulator-max-microvolt = <3300000>;
224	regulator-name = "vcc-wifi-io";
225};
226
227&reg_drivevbus {
228	regulator-name = "usb0-vbus";
229	status = "okay";
230};
231
232&reg_eldo1 {
233	regulator-always-on;
234	regulator-min-microvolt = <1800000>;
235	regulator-max-microvolt = <1800000>;
236	regulator-name = "cpvdd";
237};
238
239&reg_eldo3 {
240	regulator-min-microvolt = <1800000>;
241	regulator-max-microvolt = <1800000>;
242	regulator-name = "dvdd-csi";
243};
244
245&reg_fldo1 {
246	regulator-min-microvolt = <1200000>;
247	regulator-max-microvolt = <1200000>;
248	regulator-name = "vcc-1v2-hsic";
249};
250
251/*
252 * The A64 chip cannot work without this regulator off, although
253 * it seems to be only driving the AR100 core.
254 * Maybe we don't still know well about CPUs domain.
255 */
256&reg_fldo2 {
257	regulator-always-on;
258	regulator-min-microvolt = <1100000>;
259	regulator-max-microvolt = <1100000>;
260	regulator-name = "vdd-cpus";
261};
262
263&reg_rtc_ldo {
264	regulator-name = "vcc-rtc";
265};
266
267&uart0 {
268	pinctrl-names = "default";
269	pinctrl-0 = <&uart0_pb_pins>;
270	status = "okay";
271};
272
273&usb_otg {
274	dr_mode = "otg";
275	status = "okay";
276};
277
278&usbphy {
279	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
280	usb0_vbus-supply = <&reg_drivevbus>;
281	status = "okay";
282};
283