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