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&ehci1 {
104	status = "okay";
105};
106
107
108/* The ANX6345 eDP-bridge is on i2c0. There is no linux (mainline)
109 * driver for this chip at the moment, the bootloader initializes it.
110 * However it can be accessed with the i2c-dev driver from user space.
111 */
112&i2c0 {
113	clock-frequency = <100000>;
114	status = "okay";
115};
116
117&mmc0 {
118	pinctrl-names = "default";
119	pinctrl-0 = <&mmc0_pins>;
120	vmmc-supply = <&reg_dcdc1>;
121	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
122	disable-wp;
123	bus-width = <4>;
124	status = "okay";
125};
126
127&mmc1 {
128	pinctrl-names = "default";
129	pinctrl-0 = <&mmc1_pins>;
130	vmmc-supply = <&reg_aldo2>;
131	vqmmc-supply = <&reg_dldo4>;
132	mmc-pwrseq = <&wifi_pwrseq>;
133	bus-width = <4>;
134	non-removable;
135	status = "okay";
136
137	rtl8723bs: wifi@1 {
138		reg = <1>;
139		interrupt-parent = <&r_pio>;
140		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
141		interrupt-names = "host-wake";
142	};
143};
144
145&mmc2 {
146	pinctrl-names = "default";
147	pinctrl-0 = <&mmc2_pins>;
148	vmmc-supply = <&reg_dcdc1>;
149	vqmmc-supply = <&reg_dcdc1>;
150	bus-width = <8>;
151	non-removable;
152	cap-mmc-hw-reset;
153	status = "okay";
154};
155
156&ohci1 {
157	status = "okay";
158};
159
160&pwm {
161	status = "okay";
162};
163
164&r_rsb {
165	status = "okay";
166
167	axp803: pmic@3a3 {
168		compatible = "x-powers,axp803";
169		reg = <0x3a3>;
170		interrupt-parent = <&r_intc>;
171		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
172		wakeup-source;
173	};
174};
175
176#include "axp803.dtsi"
177
178&ac_power_supply {
179	status = "okay";
180};
181
182&battery_power_supply {
183	status = "okay";
184};
185
186&reg_aldo1 {
187	regulator-always-on;
188	regulator-min-microvolt = <2800000>;
189	regulator-max-microvolt = <2800000>;
190	regulator-name = "vcc-pe";
191};
192
193&reg_aldo2 {
194	regulator-always-on;
195	regulator-min-microvolt = <3300000>;
196	regulator-max-microvolt = <3300000>;
197	regulator-name = "vcc-pl";
198};
199
200&reg_aldo3 {
201	regulator-always-on;
202	regulator-min-microvolt = <3000000>;
203	regulator-max-microvolt = <3000000>;
204	regulator-name = "vcc-pll-avcc";
205};
206
207&reg_dcdc1 {
208	regulator-always-on;
209	regulator-min-microvolt = <3300000>;
210	regulator-max-microvolt = <3300000>;
211	regulator-name = "vcc-3v3";
212};
213
214&reg_dcdc2 {
215	regulator-always-on;
216	regulator-min-microvolt = <1040000>;
217	regulator-max-microvolt = <1300000>;
218	regulator-name = "vdd-cpux";
219};
220
221/* DCDC3 is polyphased with DCDC2 */
222
223&reg_dcdc5 {
224	regulator-always-on;
225	regulator-min-microvolt = <1500000>;
226	regulator-max-microvolt = <1500000>;
227	regulator-name = "vcc-ddr3";
228};
229
230&reg_dcdc6 {
231	regulator-always-on;
232	regulator-min-microvolt = <1100000>;
233	regulator-max-microvolt = <1100000>;
234	regulator-name = "vdd-sys";
235};
236
237&reg_dldo1 {
238	regulator-min-microvolt = <3300000>;
239	regulator-max-microvolt = <3300000>;
240	regulator-name = "vcc-hdmi";
241};
242
243&reg_dldo2 {
244	regulator-min-microvolt = <2500000>;
245	regulator-max-microvolt = <2500000>;
246	regulator-name = "vcc-pd";
247};
248
249&reg_dldo3 {
250	regulator-min-microvolt = <1200000>;
251	regulator-max-microvolt = <1200000>;
252	regulator-name = "vdd-edp";
253};
254
255&reg_dldo4 {
256	regulator-min-microvolt = <3300000>;
257	regulator-max-microvolt = <3300000>;
258	regulator-name = "vcc-wifi-io";
259};
260
261&reg_eldo1 {
262	regulator-min-microvolt = <1800000>;
263	regulator-max-microvolt = <1800000>;
264	regulator-name = "cpvdd";
265};
266
267&reg_eldo2 {
268	regulator-min-microvolt = <1800000>;
269	regulator-max-microvolt = <1800000>;
270	regulator-name = "vcc-dvdd-csi";
271};
272
273&reg_fldo1 {
274	regulator-min-microvolt = <1200000>;
275	regulator-max-microvolt = <1200000>;
276	regulator-name = "vcc-1v2-hsic";
277};
278
279/*
280 * The A64 chip cannot work with this regulator off, although
281 * it seems to be only driving the AR100 core.
282 * Maybe we don't still know well about CPUs domain.
283 */
284&reg_fldo2 {
285	regulator-always-on;
286	regulator-min-microvolt = <1100000>;
287	regulator-max-microvolt = <1100000>;
288	regulator-name = "vdd-cpus";
289};
290
291&reg_rtc_ldo {
292	regulator-name = "vcc-rtc";
293};
294
295&simplefb_hdmi {
296	vcc-hdmi-supply = <&reg_dldo1>;
297};
298
299&sound {
300	simple-audio-card,aux-devs = <&codec_analog>, <&speaker_amp>;
301	simple-audio-card,widgets = "Headphone", "Headphone Jack",
302				    "Microphone", "Headset Microphone",
303				    "Microphone", "Internal Microphone",
304				    "Speaker", "Internal Speaker";
305	simple-audio-card,routing =
306			"Left DAC", "AIF1 Slot 0 Left",
307			"Right DAC", "AIF1 Slot 0 Right",
308			"AIF1 Slot 0 Left ADC", "Left ADC",
309			"AIF1 Slot 0 Right ADC", "Right ADC",
310			"Headphone Jack", "HP",
311			"Speaker Amp INL", "LINEOUT",
312			"Speaker Amp INR", "LINEOUT",
313			"Internal Speaker", "Speaker Amp OUTL",
314			"Internal Speaker", "Speaker Amp OUTR",
315			"Internal Microphone", "MBIAS",
316			"MIC1", "Internal Microphone",
317			"Headset Microphone", "HBIAS",
318			"MIC2", "Headset Microphone";
319	status = "okay";
320};
321
322&uart0 {
323	pinctrl-names = "default";
324	pinctrl-0 = <&uart0_pb_pins>;
325	status = "okay";
326};
327
328&usbphy {
329	usb1_vbus-supply = <&reg_usb1_vbus>;
330	status = "okay";
331};
332