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