1// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2// Copyright (C) Harald Geyer <harald@ccbib.org>
3// based on sun50i-a64-olinuxino.dts by Jagan Teki <jteki@openedev.com>
4
5/dts-v1/;
6
7#include "sun50i-a64.dtsi"
8#include "sun50i-a64-cpu-opp.dtsi"
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/pwm/pwm.h>
13
14/ {
15	model = "Olimex A64 Teres-I";
16	compatible = "olimex,a64-teres-i", "allwinner,sun50i-a64";
17
18	aliases {
19		serial0 = &uart0;
20	};
21
22	backlight: backlight {
23		compatible = "pwm-backlight";
24		pwms = <&pwm 0 50000 0>;
25		power-supply = <&reg_dcdc1>;
26		brightness-levels = <0 5 7 10 14 20 28 40 56 80 112>;
27		default-brightness-level = <5>;
28		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
29	};
30
31	chosen {
32		stdout-path = "serial0:115200n8";
33
34		framebuffer-lcd {
35			eDP25-supply = <&reg_dldo2>;
36			eDP12-supply = <&reg_dldo3>;
37		};
38	};
39
40	gpio-keys {
41		compatible = "gpio-keys";
42
43		lid-switch {
44			label = "Lid Switch";
45			gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
46			linux,input-type = <EV_SW>;
47			linux,code = <SW_LID>;
48			wakeup-source;
49		};
50	};
51
52	leds {
53		compatible = "gpio-leds";
54
55		led-0 {
56			label = "teres-i:green:capslock";
57			gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */
58		};
59
60		led-1 {
61			label = "teres-i:green:numlock";
62			gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
63		};
64	};
65
66	reg_usb1_vbus: usb1-vbus {
67		compatible = "regulator-fixed";
68		regulator-name = "usb1-vbus";
69		regulator-min-microvolt = <5000000>;
70		regulator-max-microvolt = <5000000>;
71		enable-active-high;
72		gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
73		status = "okay";
74	};
75
76	wifi_pwrseq: wifi_pwrseq {
77		compatible = "mmc-pwrseq-simple";
78		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
79	};
80
81	speaker_amp: audio-amplifier {
82		compatible = "simple-audio-amplifier";
83		enable-gpios = <&r_pio 0 12 GPIO_ACTIVE_HIGH>; /* PL12 */
84		sound-name-prefix = "Speaker Amp";
85	};
86};
87
88&codec {
89	status = "okay";
90};
91
92&codec_analog {
93	cpvdd-supply = <&reg_eldo1>;
94	status = "okay";
95};
96
97&dai {
98	status = "okay";
99};
100
101&de {
102	status = "okay";
103};
104
105&cpu0 {
106	cpu-supply = <&reg_dcdc2>;
107};
108
109&cpu1 {
110	cpu-supply = <&reg_dcdc2>;
111};
112
113&cpu2 {
114	cpu-supply = <&reg_dcdc2>;
115};
116
117&cpu3 {
118	cpu-supply = <&reg_dcdc2>;
119};
120
121&ehci1 {
122	status = "okay";
123};
124
125
126&i2c0 {
127	clock-frequency = <100000>;
128	status = "okay";
129
130	anx6345: anx6345@38 {
131		compatible = "analogix,anx6345";
132		reg = <0x38>;
133		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
134		dvdd25-supply = <&reg_dldo2>;
135		dvdd12-supply = <&reg_dldo3>;
136
137		ports {
138			#address-cells = <1>;
139			#size-cells = <0>;
140
141			port@0 {
142				anx6345_in: endpoint {
143					remote-endpoint = <&tcon0_out_anx6345>;
144				};
145			};
146		};
147	};
148};
149
150&mixer0 {
151	status = "okay";
152};
153
154&mmc0 {
155	pinctrl-names = "default";
156	pinctrl-0 = <&mmc0_pins>;
157	vmmc-supply = <&reg_dcdc1>;
158	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
159	disable-wp;
160	bus-width = <4>;
161	status = "okay";
162};
163
164&mmc1 {
165	pinctrl-names = "default";
166	pinctrl-0 = <&mmc1_pins>;
167	vmmc-supply = <&reg_aldo2>;
168	vqmmc-supply = <&reg_dldo4>;
169	mmc-pwrseq = <&wifi_pwrseq>;
170	bus-width = <4>;
171	non-removable;
172	status = "okay";
173
174	rtl8723bs: wifi@1 {
175		reg = <1>;
176		interrupt-parent = <&r_pio>;
177		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
178		interrupt-names = "host-wake";
179	};
180};
181
182&mmc2 {
183	pinctrl-names = "default";
184	pinctrl-0 = <&mmc2_pins>;
185	vmmc-supply = <&reg_dcdc1>;
186	vqmmc-supply = <&reg_dcdc1>;
187	bus-width = <8>;
188	non-removable;
189	cap-mmc-hw-reset;
190	status = "okay";
191};
192
193&ohci1 {
194	status = "okay";
195};
196
197&pwm {
198	status = "okay";
199};
200
201&r_rsb {
202	status = "okay";
203
204	axp803: pmic@3a3 {
205		compatible = "x-powers,axp803";
206		reg = <0x3a3>;
207		interrupt-parent = <&r_intc>;
208		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
209		wakeup-source;
210	};
211};
212
213#include "axp803.dtsi"
214
215&ac_power_supply {
216	status = "okay";
217};
218
219&battery_power_supply {
220	status = "okay";
221};
222
223&reg_aldo1 {
224	regulator-always-on;
225	regulator-min-microvolt = <2800000>;
226	regulator-max-microvolt = <2800000>;
227	regulator-name = "vcc-pe";
228};
229
230&reg_aldo2 {
231	regulator-always-on;
232	regulator-min-microvolt = <3300000>;
233	regulator-max-microvolt = <3300000>;
234	regulator-name = "vcc-pl";
235};
236
237&reg_aldo3 {
238	regulator-always-on;
239	regulator-min-microvolt = <3000000>;
240	regulator-max-microvolt = <3000000>;
241	regulator-name = "vcc-pll-avcc";
242};
243
244&reg_dcdc1 {
245	regulator-always-on;
246	regulator-min-microvolt = <3300000>;
247	regulator-max-microvolt = <3300000>;
248	regulator-name = "vcc-3v3";
249};
250
251&reg_dcdc2 {
252	regulator-always-on;
253	regulator-min-microvolt = <1040000>;
254	regulator-max-microvolt = <1300000>;
255	regulator-name = "vdd-cpux";
256};
257
258/* DCDC3 is polyphased with DCDC2 */
259
260&reg_dcdc5 {
261	regulator-always-on;
262	regulator-min-microvolt = <1500000>;
263	regulator-max-microvolt = <1500000>;
264	regulator-name = "vcc-ddr3";
265};
266
267&reg_dcdc6 {
268	regulator-always-on;
269	regulator-min-microvolt = <1100000>;
270	regulator-max-microvolt = <1100000>;
271	regulator-name = "vdd-sys";
272};
273
274&reg_dldo1 {
275	regulator-min-microvolt = <3300000>;
276	regulator-max-microvolt = <3300000>;
277	regulator-name = "vcc-hdmi";
278};
279
280&reg_dldo2 {
281	regulator-min-microvolt = <2500000>;
282	regulator-max-microvolt = <2500000>;
283	regulator-name = "vcc-pd";
284};
285
286&reg_dldo3 {
287	regulator-min-microvolt = <1200000>;
288	regulator-max-microvolt = <1200000>;
289	regulator-name = "vdd-edp";
290};
291
292&reg_dldo4 {
293	regulator-min-microvolt = <3300000>;
294	regulator-max-microvolt = <3300000>;
295	regulator-name = "vcc-wifi-io";
296};
297
298&reg_eldo1 {
299	regulator-min-microvolt = <1800000>;
300	regulator-max-microvolt = <1800000>;
301	regulator-name = "cpvdd";
302};
303
304&reg_eldo2 {
305	regulator-min-microvolt = <1800000>;
306	regulator-max-microvolt = <1800000>;
307	regulator-name = "vcc-dvdd-csi";
308};
309
310&reg_fldo1 {
311	regulator-min-microvolt = <1200000>;
312	regulator-max-microvolt = <1200000>;
313	regulator-name = "vcc-1v2-hsic";
314};
315
316/*
317 * The A64 chip cannot work with this regulator off, although
318 * it seems to be only driving the AR100 core.
319 * Maybe we don't still know well about CPUs domain.
320 */
321&reg_fldo2 {
322	regulator-always-on;
323	regulator-min-microvolt = <1100000>;
324	regulator-max-microvolt = <1100000>;
325	regulator-name = "vdd-cpus";
326};
327
328&reg_rtc_ldo {
329	regulator-name = "vcc-rtc";
330};
331
332&simplefb_hdmi {
333	vcc-hdmi-supply = <&reg_dldo1>;
334};
335
336&sound {
337	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
338	simple-audio-card,widgets = "Headphone", "Headphone Jack",
339				    "Microphone", "Headset Microphone",
340				    "Microphone", "Internal Microphone",
341				    "Speaker", "Internal Speaker";
342	simple-audio-card,routing =
343			"Left DAC", "DACL",
344			"Right DAC", "DACR",
345			"ADCL", "Left ADC",
346			"ADCR", "Right ADC",
347			"Headphone Jack", "HP",
348			"Speaker Amp INL", "LINEOUT",
349			"Speaker Amp INR", "LINEOUT",
350			"Internal Speaker", "Speaker Amp OUTL",
351			"Internal Speaker", "Speaker Amp OUTR",
352			"Internal Microphone", "MBIAS",
353			"MIC1", "Internal Microphone",
354			"Headset Microphone", "HBIAS",
355			"MIC2", "Headset Microphone";
356	status = "okay";
357};
358
359&tcon0 {
360	pinctrl-names = "default";
361	pinctrl-0 = <&lcd_rgb666_pins>;
362
363	status = "okay";
364};
365
366&tcon0_out {
367	tcon0_out_anx6345: endpoint@0 {
368		reg = <0>;
369		remote-endpoint = <&anx6345_in>;
370	};
371};
372
373&uart0 {
374	pinctrl-names = "default";
375	pinctrl-0 = <&uart0_pb_pins>;
376	status = "okay";
377};
378
379&usbphy {
380	usb1_vbus-supply = <&reg_usb1_vbus>;
381	status = "okay";
382};
383