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