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