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