1// SPDX-License-Identifier: GPL-2.0 OR MIT
2/*
3 * Copyright 2019 Ondrej Jirman <megous@megous.com>
4 */
5
6/dts-v1/;
7#include "sun5i-a13.dtsi"
8#include "sunxi-common-regulators.dtsi"
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/input.h>
11#include <dt-bindings/interrupt-controller/irq.h>
12#include <dt-bindings/pwm/pwm.h>
13
14/ {
15	model = "PocketBook Touch Lux 3";
16	compatible = "pocketbook,touch-lux-3", "allwinner,sun5i-a13";
17
18	aliases {
19		serial0 = &uart1;
20		i2c0 = &i2c0;
21		i2c1 = &i2c1;
22		i2c2 = &i2c2;
23	};
24
25	backlight {
26		compatible = "pwm-backlight";
27		pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>;
28		enable-gpios = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
29		brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>;
30		default-brightness-level = <8>;
31		power-supply = <&reg_vcc3v3>;
32	};
33
34	chosen {
35		stdout-path = "serial0:115200n8";
36	};
37
38	leds {
39		compatible = "gpio-leds";
40
41		led {
42			gpios = <&pio 4 8 GPIO_ACTIVE_LOW>; /* PE8 */
43			default-state = "on";
44		};
45	};
46
47	gpio-keys {
48		compatible = "gpio-keys";
49		autorepeat;
50		label = "GPIO Keys";
51
52		key-right {
53			label = "Right";
54			linux,code = <KEY_RIGHT>;
55			gpios = <&pio 6 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG9 */
56		};
57
58		key-left {
59			label = "Left";
60			linux,code = <KEY_LEFT>;
61			gpios = <&pio 6 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; /* PG10 */
62		};
63	};
64
65	reg_1v8: regulator-1v8 {
66		compatible = "regulator-fixed";
67		regulator-name = "vdd-1v8-nor-ctp";
68		regulator-min-microvolt = <1800000>;
69		regulator-max-microvolt = <1800000>;
70		gpio = <&pio 2 15 GPIO_ACTIVE_HIGH>;
71		enable-active-high;
72	};
73
74	reg_1v8_nor: regulator-nor {
75		compatible = "regulator-fixed";
76		regulator-name = "vdd-nor";
77		regulator-min-microvolt = <1800000>;
78		regulator-max-microvolt = <1800000>;
79		gpio = <&pio 2 14 GPIO_ACTIVE_HIGH>;
80		enable-active-high;
81		vin-supply = <&reg_1v8>;
82		regulator-always-on;
83	};
84
85	reg_1v8_ctp: regulator-ctp {
86		compatible = "regulator-fixed";
87		regulator-name = "vdd-ctp";
88		regulator-min-microvolt = <1800000>;
89		regulator-max-microvolt = <1800000>;
90		gpio = <&pio 2 13 GPIO_ACTIVE_HIGH>;
91		enable-active-high;
92		vin-supply = <&reg_1v8>;
93	};
94
95	reg_3v3_mmc0: regulator-mmc0 {
96		compatible = "regulator-fixed";
97		regulator-name = "vdd-mmc0";
98		regulator-min-microvolt = <3300000>;
99		regulator-max-microvolt = <3300000>;
100		gpio = <&pio 4 4 GPIO_ACTIVE_LOW>; /* PE4 */
101		vin-supply = <&reg_vcc3v3>;
102	};
103};
104
105&cpu0 {
106	cpu-supply = <&reg_dcdc2>;
107};
108
109&ehci0 {
110	status = "okay";
111};
112
113&i2c0 {
114	status = "okay";
115
116	axp209: pmic@34 {
117		reg = <0x34>;
118		interrupts = <0>;
119	};
120};
121
122#include "axp209.dtsi"
123
124&i2c1 {
125	status = "okay";
126
127	pcf8563: rtc@51 {
128		compatible = "nxp,pcf8563";
129		reg = <0x51>;
130	};
131};
132
133&i2c2 {
134	status = "okay";
135
136	/* Touchpanel is connected here. */
137};
138
139&lradc {
140	vref-supply = <&reg_ldo2>;
141	status = "okay";
142
143	button-200 {
144		label = "Home";
145		linux,code = <KEY_HOME>;
146		channel = <0>;
147		voltage = <200000>;
148	};
149
150	button-400 {
151		label = "Menu";
152		linux,code = <KEY_MENU>;
153		channel = <0>;
154		voltage = <400000>;
155	};
156};
157
158&mmc0 {
159	vmmc-supply = <&reg_3v3_mmc0>;
160	bus-width = <4>;
161	cd-gpios = <&pio 6 0 GPIO_ACTIVE_LOW>; /* PG0 */
162	status = "okay";
163};
164
165&mmc2 {
166	pinctrl-names = "default";
167	pinctrl-0 = <&mmc2_4bit_pc_pins>;
168	vmmc-supply = <&reg_vcc3v3>;
169	bus-width = <4>;
170	non-removable;
171	status = "okay";
172};
173
174&ohci0 {
175	status = "okay";
176};
177
178&otg_sram {
179	status = "okay";
180};
181
182&pwm {
183	pinctrl-names = "default";
184	pinctrl-0 = <&pwm0_pin>;
185	status = "okay";
186};
187
188&reg_dcdc2 {
189	regulator-always-on;
190	regulator-min-microvolt = <1000000>;
191	regulator-max-microvolt = <1400000>;
192	regulator-name = "vdd-cpu";
193};
194
195&reg_dcdc3 {
196	regulator-always-on;
197	regulator-min-microvolt = <1200000>;
198	regulator-max-microvolt = <1200000>;
199	regulator-name = "vdd-int-pll";
200};
201
202&reg_ldo1 {
203	regulator-name = "vdd-rtc";
204};
205
206&reg_ldo2 {
207	regulator-always-on;
208	regulator-min-microvolt = <3000000>;
209	regulator-max-microvolt = <3000000>;
210	regulator-name = "avcc";
211};
212
213&reg_ldo3 {
214	regulator-min-microvolt = <3300000>;
215	regulator-max-microvolt = <3300000>;
216	regulator-name = "vcc-wifi";
217	/* We need this otherwise the LDO3 would overload */
218	regulator-soft-start;
219	regulator-ramp-delay = <1600>;
220};
221
222&spi2 {
223	pinctrl-names = "default";
224	pinctrl-0 = <&spi2_pe_pins>, <&spi2_cs0_pe_pin>;
225	status = "okay";
226
227	epd_flash: flash@0 {
228		#address-cells = <1>;
229		#size-cells = <1>;
230		compatible = "macronix,mx25u4033", "jedec,spi-nor";
231		reg = <0>;
232		spi-max-frequency = <4000000>;
233	};
234};
235
236&uart1 {
237	pinctrl-names = "default";
238	pinctrl-0 = <&uart1_pg_pins>;
239	status = "okay";
240};
241
242&usb_otg {
243	dr_mode = "peripheral";
244	status = "okay";
245};
246
247&battery_power_supply {
248	status = "okay";
249};
250
251&usb_power_supply {
252	status = "okay";
253};
254
255&usbphy {
256	usb1_vbus-supply = <&reg_ldo3>;
257	status = "okay";
258};
259