1cabbaed7SClément Péron// SPDX-License-Identifier: (GPL-2.0 OR MIT)
2cabbaed7SClément Péron// Copyright (C) Harald Geyer <harald@ccbib.org>
3cabbaed7SClément Péron// based on sun50i-a64-olinuxino.dts by Jagan Teki <jteki@openedev.com>
4c916eb95SHarald Geyer
5c916eb95SHarald Geyer/dts-v1/;
6c916eb95SHarald Geyer
7c916eb95SHarald Geyer#include "sun50i-a64.dtsi"
8c916eb95SHarald Geyer
9c916eb95SHarald Geyer#include <dt-bindings/gpio/gpio.h>
10c916eb95SHarald Geyer#include <dt-bindings/input/input.h>
11c916eb95SHarald Geyer#include <dt-bindings/pwm/pwm.h>
12c916eb95SHarald Geyer
13c916eb95SHarald Geyer/ {
14c916eb95SHarald Geyer	model = "Olimex A64 Teres-I";
15c916eb95SHarald Geyer	compatible = "olimex,a64-teres-i", "allwinner,sun50i-a64";
16c916eb95SHarald Geyer
17c916eb95SHarald Geyer	aliases {
18c916eb95SHarald Geyer		serial0 = &uart0;
19c916eb95SHarald Geyer	};
20c916eb95SHarald Geyer
2124bd5d2cSHarald Geyer	backlight: backlight {
2224bd5d2cSHarald Geyer		compatible = "pwm-backlight";
2324bd5d2cSHarald Geyer		pwms = <&pwm 0 50000 0>;
2424bd5d2cSHarald Geyer		power-supply = <&reg_dcdc1>;
2524bd5d2cSHarald Geyer		brightness-levels = <0 5 7 10 14 20 28 40 56 80 112>;
2624bd5d2cSHarald Geyer		default-brightness-level = <5>;
2724bd5d2cSHarald Geyer		enable-gpios = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD23 */
2824bd5d2cSHarald Geyer	};
2924bd5d2cSHarald Geyer
30c916eb95SHarald Geyer	chosen {
31c916eb95SHarald Geyer		stdout-path = "serial0:115200n8";
32c916eb95SHarald Geyer
33c916eb95SHarald Geyer		framebuffer-lcd {
34c916eb95SHarald Geyer			eDP25-supply = <&reg_dldo2>;
35c916eb95SHarald Geyer			eDP12-supply = <&reg_dldo3>;
36c916eb95SHarald Geyer		};
37c916eb95SHarald Geyer	};
38c916eb95SHarald Geyer
39c916eb95SHarald Geyer	gpio-keys {
40c916eb95SHarald Geyer		compatible = "gpio-keys";
41c916eb95SHarald Geyer
42c916eb95SHarald Geyer		lid-switch {
43c916eb95SHarald Geyer			label = "Lid Switch";
44c916eb95SHarald Geyer			gpios = <&r_pio 0 8 GPIO_ACTIVE_LOW>; /* PL8 */
45c916eb95SHarald Geyer			linux,input-type = <EV_SW>;
46c916eb95SHarald Geyer			linux,code = <SW_LID>;
4748f3e7bfSIcenowy Zheng			wakeup-source;
48c916eb95SHarald Geyer		};
49c916eb95SHarald Geyer	};
50c916eb95SHarald Geyer
51c916eb95SHarald Geyer	leds {
52c916eb95SHarald Geyer		compatible = "gpio-leds";
53c916eb95SHarald Geyer
54c916eb95SHarald Geyer		capslock {
55c916eb95SHarald Geyer			label = "teres-i:green:capslock";
56c916eb95SHarald Geyer			gpios = <&pio 2 7 GPIO_ACTIVE_HIGH>; /* PC7 */
57c916eb95SHarald Geyer		};
58c916eb95SHarald Geyer
59c916eb95SHarald Geyer		numlock {
60c916eb95SHarald Geyer			label = "teres-i:green:numlock";
61c916eb95SHarald Geyer			gpios = <&pio 2 4 GPIO_ACTIVE_HIGH>; /* PC4 */
62c916eb95SHarald Geyer		};
63c916eb95SHarald Geyer	};
64c916eb95SHarald Geyer
65c916eb95SHarald Geyer	reg_usb1_vbus: usb1-vbus {
66c916eb95SHarald Geyer		compatible = "regulator-fixed";
67c916eb95SHarald Geyer		regulator-name = "usb1-vbus";
68c916eb95SHarald Geyer		regulator-min-microvolt = <5000000>;
69c916eb95SHarald Geyer		regulator-max-microvolt = <5000000>;
70c916eb95SHarald Geyer		enable-active-high;
71c916eb95SHarald Geyer		gpio = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
72c916eb95SHarald Geyer		status = "okay";
73c916eb95SHarald Geyer	};
74c916eb95SHarald Geyer
75c916eb95SHarald Geyer	wifi_pwrseq: wifi_pwrseq {
76c916eb95SHarald Geyer		compatible = "mmc-pwrseq-simple";
77c916eb95SHarald Geyer		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
78c916eb95SHarald Geyer	};
79439152aeSHarald Geyer
80439152aeSHarald Geyer	speaker_amp: audio-amplifier {
81439152aeSHarald Geyer		compatible = "simple-audio-amplifier";
82439152aeSHarald Geyer		enable-gpios = <&r_pio 0 12 GPIO_ACTIVE_HIGH>; /* PL12 */
83439152aeSHarald Geyer		sound-name-prefix = "Speaker Amp";
84439152aeSHarald Geyer	};
85439152aeSHarald Geyer};
86439152aeSHarald Geyer
87439152aeSHarald Geyer&codec {
88439152aeSHarald Geyer	status = "okay";
89439152aeSHarald Geyer};
90439152aeSHarald Geyer
91439152aeSHarald Geyer&codec_analog {
92439152aeSHarald Geyer	cpvdd-supply = <&reg_eldo1>;
93439152aeSHarald Geyer	status = "okay";
94439152aeSHarald Geyer};
95439152aeSHarald Geyer
96439152aeSHarald Geyer&dai {
97439152aeSHarald Geyer	status = "okay";
98c916eb95SHarald Geyer};
99c916eb95SHarald Geyer
10079bc02f1STorsten Duwe&de {
10179bc02f1STorsten Duwe	status = "okay";
10279bc02f1STorsten Duwe};
10379bc02f1STorsten Duwe
104c916eb95SHarald Geyer&ehci1 {
105c916eb95SHarald Geyer	status = "okay";
106c916eb95SHarald Geyer};
107c916eb95SHarald Geyer
108c916eb95SHarald Geyer
109c916eb95SHarald Geyer&i2c0 {
110c916eb95SHarald Geyer	clock-frequency = <100000>;
111c916eb95SHarald Geyer	status = "okay";
11279bc02f1STorsten Duwe
11379bc02f1STorsten Duwe	anx6345: anx6345@38 {
11479bc02f1STorsten Duwe		compatible = "analogix,anx6345";
11579bc02f1STorsten Duwe		reg = <0x38>;
11679bc02f1STorsten Duwe		reset-gpios = <&pio 3 24 GPIO_ACTIVE_LOW>; /* PD24 */
11779bc02f1STorsten Duwe		dvdd25-supply = <&reg_dldo2>;
11879bc02f1STorsten Duwe		dvdd12-supply = <&reg_dldo3>;
11979bc02f1STorsten Duwe
12079bc02f1STorsten Duwe		ports {
12179bc02f1STorsten Duwe			#address-cells = <1>;
12279bc02f1STorsten Duwe			#size-cells = <0>;
12379bc02f1STorsten Duwe
12479bc02f1STorsten Duwe			port@0 {
12579bc02f1STorsten Duwe				anx6345_in: endpoint {
12679bc02f1STorsten Duwe					remote-endpoint = <&tcon0_out_anx6345>;
12779bc02f1STorsten Duwe				};
12879bc02f1STorsten Duwe			};
12979bc02f1STorsten Duwe		};
13079bc02f1STorsten Duwe	};
13179bc02f1STorsten Duwe};
13279bc02f1STorsten Duwe
13379bc02f1STorsten Duwe&mixer0 {
13479bc02f1STorsten Duwe	status = "okay";
135c916eb95SHarald Geyer};
136c916eb95SHarald Geyer
137c916eb95SHarald Geyer&mmc0 {
138c916eb95SHarald Geyer	pinctrl-names = "default";
139c916eb95SHarald Geyer	pinctrl-0 = <&mmc0_pins>;
140c916eb95SHarald Geyer	vmmc-supply = <&reg_dcdc1>;
141c916eb95SHarald Geyer	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
142c916eb95SHarald Geyer	disable-wp;
143c916eb95SHarald Geyer	bus-width = <4>;
144c916eb95SHarald Geyer	status = "okay";
145c916eb95SHarald Geyer};
146c916eb95SHarald Geyer
147c916eb95SHarald Geyer&mmc1 {
148c916eb95SHarald Geyer	pinctrl-names = "default";
149c916eb95SHarald Geyer	pinctrl-0 = <&mmc1_pins>;
150c916eb95SHarald Geyer	vmmc-supply = <&reg_aldo2>;
151c916eb95SHarald Geyer	vqmmc-supply = <&reg_dldo4>;
152c916eb95SHarald Geyer	mmc-pwrseq = <&wifi_pwrseq>;
153c916eb95SHarald Geyer	bus-width = <4>;
154c916eb95SHarald Geyer	non-removable;
155c916eb95SHarald Geyer	status = "okay";
156c916eb95SHarald Geyer
157c916eb95SHarald Geyer	rtl8723bs: wifi@1 {
158c916eb95SHarald Geyer		reg = <1>;
159c916eb95SHarald Geyer		interrupt-parent = <&r_pio>;
160c916eb95SHarald Geyer		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
161c916eb95SHarald Geyer		interrupt-names = "host-wake";
162c916eb95SHarald Geyer	};
163c916eb95SHarald Geyer};
164c916eb95SHarald Geyer
165c916eb95SHarald Geyer&mmc2 {
166c916eb95SHarald Geyer	pinctrl-names = "default";
167c916eb95SHarald Geyer	pinctrl-0 = <&mmc2_pins>;
168c916eb95SHarald Geyer	vmmc-supply = <&reg_dcdc1>;
169c916eb95SHarald Geyer	vqmmc-supply = <&reg_dcdc1>;
170c916eb95SHarald Geyer	bus-width = <8>;
171c916eb95SHarald Geyer	non-removable;
172c916eb95SHarald Geyer	cap-mmc-hw-reset;
173c916eb95SHarald Geyer	status = "okay";
174c916eb95SHarald Geyer};
175c916eb95SHarald Geyer
176c916eb95SHarald Geyer&ohci1 {
177c916eb95SHarald Geyer	status = "okay";
178c916eb95SHarald Geyer};
179c916eb95SHarald Geyer
18024bd5d2cSHarald Geyer&pwm {
18124bd5d2cSHarald Geyer	status = "okay";
18224bd5d2cSHarald Geyer};
18324bd5d2cSHarald Geyer
184c916eb95SHarald Geyer&r_rsb {
185c916eb95SHarald Geyer	status = "okay";
186c916eb95SHarald Geyer
187c916eb95SHarald Geyer	axp803: pmic@3a3 {
188c916eb95SHarald Geyer		compatible = "x-powers,axp803";
189c916eb95SHarald Geyer		reg = <0x3a3>;
190c916eb95SHarald Geyer		interrupt-parent = <&r_intc>;
191c916eb95SHarald Geyer		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
192c916eb95SHarald Geyer		wakeup-source;
193c916eb95SHarald Geyer	};
194c916eb95SHarald Geyer};
195c916eb95SHarald Geyer
196c916eb95SHarald Geyer#include "axp803.dtsi"
197c916eb95SHarald Geyer
19825f6f54fSHarald Geyer&ac_power_supply {
19925f6f54fSHarald Geyer	status = "okay";
20025f6f54fSHarald Geyer};
20125f6f54fSHarald Geyer
20225f6f54fSHarald Geyer&battery_power_supply {
20325f6f54fSHarald Geyer	status = "okay";
20425f6f54fSHarald Geyer};
20525f6f54fSHarald Geyer
206c916eb95SHarald Geyer&reg_aldo1 {
207c916eb95SHarald Geyer	regulator-always-on;
208c916eb95SHarald Geyer	regulator-min-microvolt = <2800000>;
209c916eb95SHarald Geyer	regulator-max-microvolt = <2800000>;
210c916eb95SHarald Geyer	regulator-name = "vcc-pe";
211c916eb95SHarald Geyer};
212c916eb95SHarald Geyer
213c916eb95SHarald Geyer&reg_aldo2 {
214c916eb95SHarald Geyer	regulator-always-on;
215c916eb95SHarald Geyer	regulator-min-microvolt = <3300000>;
216c916eb95SHarald Geyer	regulator-max-microvolt = <3300000>;
217c916eb95SHarald Geyer	regulator-name = "vcc-pl";
218c916eb95SHarald Geyer};
219c916eb95SHarald Geyer
220c916eb95SHarald Geyer&reg_aldo3 {
221c916eb95SHarald Geyer	regulator-always-on;
222c916eb95SHarald Geyer	regulator-min-microvolt = <3000000>;
223c916eb95SHarald Geyer	regulator-max-microvolt = <3000000>;
224c916eb95SHarald Geyer	regulator-name = "vcc-pll-avcc";
225c916eb95SHarald Geyer};
226c916eb95SHarald Geyer
227c916eb95SHarald Geyer&reg_dcdc1 {
228c916eb95SHarald Geyer	regulator-always-on;
229c916eb95SHarald Geyer	regulator-min-microvolt = <3300000>;
230c916eb95SHarald Geyer	regulator-max-microvolt = <3300000>;
231c916eb95SHarald Geyer	regulator-name = "vcc-3v3";
232c916eb95SHarald Geyer};
233c916eb95SHarald Geyer
234c916eb95SHarald Geyer&reg_dcdc2 {
235c916eb95SHarald Geyer	regulator-always-on;
236c916eb95SHarald Geyer	regulator-min-microvolt = <1040000>;
237c916eb95SHarald Geyer	regulator-max-microvolt = <1300000>;
238c916eb95SHarald Geyer	regulator-name = "vdd-cpux";
239c916eb95SHarald Geyer};
240c916eb95SHarald Geyer
241c916eb95SHarald Geyer/* DCDC3 is polyphased with DCDC2 */
242c916eb95SHarald Geyer
243c916eb95SHarald Geyer&reg_dcdc5 {
244c916eb95SHarald Geyer	regulator-always-on;
245c916eb95SHarald Geyer	regulator-min-microvolt = <1500000>;
246c916eb95SHarald Geyer	regulator-max-microvolt = <1500000>;
247c916eb95SHarald Geyer	regulator-name = "vcc-ddr3";
248c916eb95SHarald Geyer};
249c916eb95SHarald Geyer
250c916eb95SHarald Geyer&reg_dcdc6 {
251c916eb95SHarald Geyer	regulator-always-on;
252c916eb95SHarald Geyer	regulator-min-microvolt = <1100000>;
253c916eb95SHarald Geyer	regulator-max-microvolt = <1100000>;
254c916eb95SHarald Geyer	regulator-name = "vdd-sys";
255c916eb95SHarald Geyer};
256c916eb95SHarald Geyer
257c916eb95SHarald Geyer&reg_dldo1 {
258c916eb95SHarald Geyer	regulator-min-microvolt = <3300000>;
259c916eb95SHarald Geyer	regulator-max-microvolt = <3300000>;
260c916eb95SHarald Geyer	regulator-name = "vcc-hdmi";
261c916eb95SHarald Geyer};
262c916eb95SHarald Geyer
263c916eb95SHarald Geyer&reg_dldo2 {
264c916eb95SHarald Geyer	regulator-min-microvolt = <2500000>;
265c916eb95SHarald Geyer	regulator-max-microvolt = <2500000>;
266c916eb95SHarald Geyer	regulator-name = "vcc-pd";
267c916eb95SHarald Geyer};
268c916eb95SHarald Geyer
269c916eb95SHarald Geyer&reg_dldo3 {
270c916eb95SHarald Geyer	regulator-min-microvolt = <1200000>;
271c916eb95SHarald Geyer	regulator-max-microvolt = <1200000>;
272e4357c82SIcenowy Zheng	regulator-name = "vdd-edp";
273c916eb95SHarald Geyer};
274c916eb95SHarald Geyer
275c916eb95SHarald Geyer&reg_dldo4 {
276c916eb95SHarald Geyer	regulator-min-microvolt = <3300000>;
277c916eb95SHarald Geyer	regulator-max-microvolt = <3300000>;
278c916eb95SHarald Geyer	regulator-name = "vcc-wifi-io";
279c916eb95SHarald Geyer};
280c916eb95SHarald Geyer
281c916eb95SHarald Geyer&reg_eldo1 {
282c916eb95SHarald Geyer	regulator-min-microvolt = <1800000>;
283c916eb95SHarald Geyer	regulator-max-microvolt = <1800000>;
284c916eb95SHarald Geyer	regulator-name = "cpvdd";
285c916eb95SHarald Geyer};
286c916eb95SHarald Geyer
287c916eb95SHarald Geyer&reg_eldo2 {
288c916eb95SHarald Geyer	regulator-min-microvolt = <1800000>;
289c916eb95SHarald Geyer	regulator-max-microvolt = <1800000>;
290c916eb95SHarald Geyer	regulator-name = "vcc-dvdd-csi";
291c916eb95SHarald Geyer};
292c916eb95SHarald Geyer
293c916eb95SHarald Geyer&reg_fldo1 {
294c916eb95SHarald Geyer	regulator-min-microvolt = <1200000>;
295c916eb95SHarald Geyer	regulator-max-microvolt = <1200000>;
296c916eb95SHarald Geyer	regulator-name = "vcc-1v2-hsic";
297c916eb95SHarald Geyer};
298c916eb95SHarald Geyer
299c916eb95SHarald Geyer/*
300062904f2SJonathan Neuschäfer * The A64 chip cannot work with this regulator off, although
301c916eb95SHarald Geyer * it seems to be only driving the AR100 core.
302c916eb95SHarald Geyer * Maybe we don't still know well about CPUs domain.
303c916eb95SHarald Geyer */
304c916eb95SHarald Geyer&reg_fldo2 {
305c916eb95SHarald Geyer	regulator-always-on;
306c916eb95SHarald Geyer	regulator-min-microvolt = <1100000>;
307c916eb95SHarald Geyer	regulator-max-microvolt = <1100000>;
308c916eb95SHarald Geyer	regulator-name = "vdd-cpus";
309c916eb95SHarald Geyer};
310c916eb95SHarald Geyer
311c916eb95SHarald Geyer&reg_rtc_ldo {
312c916eb95SHarald Geyer	regulator-name = "vcc-rtc";
313c916eb95SHarald Geyer};
314c916eb95SHarald Geyer
3155cbef9f9SIcenowy Zheng&simplefb_hdmi {
3165cbef9f9SIcenowy Zheng	vcc-hdmi-supply = <&reg_dldo1>;
3175cbef9f9SIcenowy Zheng};
3185cbef9f9SIcenowy Zheng
319439152aeSHarald Geyer&sound {
320439152aeSHarald Geyer	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
321439152aeSHarald Geyer	simple-audio-card,widgets = "Headphone", "Headphone Jack",
322439152aeSHarald Geyer				    "Microphone", "Headset Microphone",
323439152aeSHarald Geyer				    "Microphone", "Internal Microphone",
324439152aeSHarald Geyer				    "Speaker", "Internal Speaker";
325439152aeSHarald Geyer	simple-audio-card,routing =
326439152aeSHarald Geyer			"Left DAC", "AIF1 Slot 0 Left",
327439152aeSHarald Geyer			"Right DAC", "AIF1 Slot 0 Right",
328439152aeSHarald Geyer			"AIF1 Slot 0 Left ADC", "Left ADC",
329439152aeSHarald Geyer			"AIF1 Slot 0 Right ADC", "Right ADC",
330439152aeSHarald Geyer			"Headphone Jack", "HP",
331439152aeSHarald Geyer			"Speaker Amp INL", "LINEOUT",
332439152aeSHarald Geyer			"Speaker Amp INR", "LINEOUT",
333439152aeSHarald Geyer			"Internal Speaker", "Speaker Amp OUTL",
334439152aeSHarald Geyer			"Internal Speaker", "Speaker Amp OUTR",
335439152aeSHarald Geyer			"Internal Microphone", "MBIAS",
336439152aeSHarald Geyer			"MIC1", "Internal Microphone",
337439152aeSHarald Geyer			"Headset Microphone", "HBIAS",
338439152aeSHarald Geyer			"MIC2", "Headset Microphone";
339439152aeSHarald Geyer	status = "okay";
340439152aeSHarald Geyer};
341439152aeSHarald Geyer
34279bc02f1STorsten Duwe&tcon0 {
34379bc02f1STorsten Duwe	pinctrl-names = "default";
34479bc02f1STorsten Duwe	pinctrl-0 = <&lcd_rgb666_pins>;
34579bc02f1STorsten Duwe
34679bc02f1STorsten Duwe	status = "okay";
34779bc02f1STorsten Duwe};
34879bc02f1STorsten Duwe
34979bc02f1STorsten Duwe&tcon0_out {
35079bc02f1STorsten Duwe	tcon0_out_anx6345: endpoint@0 {
35179bc02f1STorsten Duwe		reg = <0>;
35279bc02f1STorsten Duwe		remote-endpoint = <&anx6345_in>;
35379bc02f1STorsten Duwe	};
35479bc02f1STorsten Duwe};
35579bc02f1STorsten Duwe
356c916eb95SHarald Geyer&uart0 {
357c916eb95SHarald Geyer	pinctrl-names = "default";
358d91ebb95SChen-Yu Tsai	pinctrl-0 = <&uart0_pb_pins>;
359c916eb95SHarald Geyer	status = "okay";
360c916eb95SHarald Geyer};
361c916eb95SHarald Geyer
362c916eb95SHarald Geyer&usbphy {
363c916eb95SHarald Geyer	usb1_vbus-supply = <&reg_usb1_vbus>;
364c916eb95SHarald Geyer	status = "okay";
365c916eb95SHarald Geyer};
366