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