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				reg = <0>;
143
144				anx6345_in: endpoint {
145					remote-endpoint = <&tcon0_out_anx6345>;
146				};
147			};
148		};
149	};
150};
151
152&mixer0 {
153	status = "okay";
154};
155
156&mmc0 {
157	pinctrl-names = "default";
158	pinctrl-0 = <&mmc0_pins>;
159	vmmc-supply = <&reg_dcdc1>;
160	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
161	disable-wp;
162	bus-width = <4>;
163	status = "okay";
164};
165
166&mmc1 {
167	pinctrl-names = "default";
168	pinctrl-0 = <&mmc1_pins>;
169	vmmc-supply = <&reg_aldo2>;
170	vqmmc-supply = <&reg_dldo4>;
171	mmc-pwrseq = <&wifi_pwrseq>;
172	bus-width = <4>;
173	non-removable;
174	status = "okay";
175
176	rtl8723bs: wifi@1 {
177		reg = <1>;
178		interrupt-parent = <&r_pio>;
179		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
180		interrupt-names = "host-wake";
181	};
182};
183
184&mmc2 {
185	pinctrl-names = "default";
186	pinctrl-0 = <&mmc2_pins>;
187	vmmc-supply = <&reg_dcdc1>;
188	vqmmc-supply = <&reg_dcdc1>;
189	bus-width = <8>;
190	non-removable;
191	cap-mmc-hw-reset;
192	status = "okay";
193};
194
195&ohci1 {
196	status = "okay";
197};
198
199&pwm {
200	status = "okay";
201};
202
203&r_rsb {
204	status = "okay";
205
206	axp803: pmic@3a3 {
207		compatible = "x-powers,axp803";
208		reg = <0x3a3>;
209		interrupt-parent = <&r_intc>;
210		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
211	};
212};
213
214#include "axp803.dtsi"
215
216&ac_power_supply {
217	status = "okay";
218};
219
220&battery_power_supply {
221	status = "okay";
222};
223
224&reg_aldo1 {
225	regulator-always-on;
226	regulator-min-microvolt = <2800000>;
227	regulator-max-microvolt = <2800000>;
228	regulator-name = "vcc-pe";
229};
230
231&reg_aldo2 {
232	regulator-always-on;
233	regulator-min-microvolt = <3300000>;
234	regulator-max-microvolt = <3300000>;
235	regulator-name = "vcc-pl";
236};
237
238&reg_aldo3 {
239	regulator-always-on;
240	regulator-min-microvolt = <3000000>;
241	regulator-max-microvolt = <3000000>;
242	regulator-name = "vcc-pll-avcc";
243};
244
245&reg_dcdc1 {
246	regulator-always-on;
247	regulator-min-microvolt = <3300000>;
248	regulator-max-microvolt = <3300000>;
249	regulator-name = "vcc-3v3";
250};
251
252&reg_dcdc2 {
253	regulator-always-on;
254	regulator-min-microvolt = <1040000>;
255	regulator-max-microvolt = <1300000>;
256	regulator-name = "vdd-cpux";
257};
258
259/* DCDC3 is polyphased with DCDC2 */
260
261&reg_dcdc5 {
262	regulator-always-on;
263	regulator-min-microvolt = <1500000>;
264	regulator-max-microvolt = <1500000>;
265	regulator-name = "vcc-ddr3";
266};
267
268&reg_dcdc6 {
269	regulator-always-on;
270	regulator-min-microvolt = <1100000>;
271	regulator-max-microvolt = <1100000>;
272	regulator-name = "vdd-sys";
273};
274
275&reg_dldo1 {
276	regulator-min-microvolt = <3300000>;
277	regulator-max-microvolt = <3300000>;
278	regulator-name = "vcc-hdmi";
279};
280
281&reg_dldo2 {
282	regulator-min-microvolt = <2500000>;
283	regulator-max-microvolt = <2500000>;
284	regulator-name = "vcc-pd";
285};
286
287&reg_dldo3 {
288	regulator-min-microvolt = <1200000>;
289	regulator-max-microvolt = <1200000>;
290	regulator-name = "vdd-edp";
291};
292
293&reg_dldo4 {
294	regulator-min-microvolt = <3300000>;
295	regulator-max-microvolt = <3300000>;
296	regulator-name = "vcc-wifi-io";
297};
298
299&reg_eldo1 {
300	regulator-min-microvolt = <1800000>;
301	regulator-max-microvolt = <1800000>;
302	regulator-name = "cpvdd";
303};
304
305&reg_eldo2 {
306	regulator-min-microvolt = <1800000>;
307	regulator-max-microvolt = <1800000>;
308	regulator-name = "vcc-dvdd-csi";
309};
310
311&reg_fldo1 {
312	regulator-min-microvolt = <1200000>;
313	regulator-max-microvolt = <1200000>;
314	regulator-name = "vcc-1v2-hsic";
315};
316
317/*
318 * The A64 chip cannot work with this regulator off, although
319 * it seems to be only driving the AR100 core.
320 * Maybe we don't still know well about CPUs domain.
321 */
322&reg_fldo2 {
323	regulator-always-on;
324	regulator-min-microvolt = <1100000>;
325	regulator-max-microvolt = <1100000>;
326	regulator-name = "vdd-cpus";
327};
328
329&reg_rtc_ldo {
330	regulator-name = "vcc-rtc";
331};
332
333&simplefb_hdmi {
334	vcc-hdmi-supply = <&reg_dldo1>;
335};
336
337&sound {
338	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
339	simple-audio-card,widgets = "Headphone", "Headphone Jack",
340				    "Microphone", "Headset Microphone",
341				    "Microphone", "Internal Microphone",
342				    "Speaker", "Internal Speaker";
343	simple-audio-card,routing =
344			"Left DAC", "DACL",
345			"Right DAC", "DACR",
346			"ADCL", "Left ADC",
347			"ADCR", "Right ADC",
348			"Headphone Jack", "HP",
349			"Speaker Amp INL", "LINEOUT",
350			"Speaker Amp INR", "LINEOUT",
351			"Internal Speaker", "Speaker Amp OUTL",
352			"Internal Speaker", "Speaker Amp OUTR",
353			"Internal Microphone", "MBIAS",
354			"MIC1", "Internal Microphone",
355			"Headset Microphone", "HBIAS",
356			"MIC2", "Headset Microphone";
357	status = "okay";
358};
359
360&tcon0 {
361	pinctrl-names = "default";
362	pinctrl-0 = <&lcd_rgb666_pins>;
363
364	status = "okay";
365};
366
367&tcon0_out {
368	tcon0_out_anx6345: endpoint@0 {
369		reg = <0>;
370		remote-endpoint = <&anx6345_in>;
371	};
372};
373
374&uart0 {
375	pinctrl-names = "default";
376	pinctrl-0 = <&uart0_pb_pins>;
377	status = "okay";
378};
379
380&usbphy {
381	usb1_vbus-supply = <&reg_usb1_vbus>;
382	status = "okay";
383};
384