1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright 2020 Pascal Roeleven <dev@pascalroeleven.nl>
4  */
5 
6 /dts-v1/;
7 #include "sun4i-a10.dtsi"
8 #include "sunxi-common-regulators.dtsi"
9 
10 #include <dt-bindings/gpio/gpio.h>
11 #include <dt-bindings/input/input.h>
12 #include <dt-bindings/interrupt-controller/irq.h>
13 #include <dt-bindings/pwm/pwm.h>
14 
15 / {
16 	model = "Topwise A721";
17 	compatible = "topwise,a721", "allwinner,sun4i-a10";
18 
19 	aliases {
20 		serial0 = &uart0;
21 	};
22 
23 	backlight: backlight {
24 		compatible = "pwm-backlight";
25 		pwms = <&pwm 0 100000 PWM_POLARITY_INVERTED>;
26 		power-supply = <&reg_vbat>;
27 		enable-gpios = <&pio 7 7 GPIO_ACTIVE_HIGH>; /* PH7 */
28 		brightness-levels = <0 30 40 50 60 70 80 90 100>;
29 		default-brightness-level = <8>;
30 	};
31 
32 	chosen {
33 		stdout-path = "serial0:115200n8";
34 	};
35 
36 	panel {
37 		compatible = "starry,kr070pe2t";
38 		backlight = <&backlight>;
39 		power-supply = <&reg_lcd_power>;
40 
41 		port {
42 			panel_input: endpoint {
43 				remote-endpoint = <&tcon0_out_panel>;
44 			};
45 		};
46 	};
47 
48 	reg_lcd_power: reg-lcd-power {
49 		compatible = "regulator-fixed";
50 		regulator-name = "reg-lcd-power";
51 		gpio = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
52 		enable-active-high;
53 	};
54 
55 	reg_vbat: reg-vbat {
56 		compatible = "regulator-fixed";
57 		regulator-name = "vbat";
58 		regulator-min-microvolt = <3700000>;
59 		regulator-max-microvolt = <3700000>;
60 	};
61 
62 };
63 
64 &codec {
65 	status = "okay";
66 };
67 
68 &cpu0 {
69 	cpu-supply = <&reg_dcdc2>;
70 };
71 
72 &de {
73 	status = "okay";
74 };
75 
76 &ehci0 {
77 	status = "okay";
78 };
79 
80 &ehci1 {
81 	status = "okay";
82 };
83 
84 &i2c0 {
85 	status = "okay";
86 
87 	axp209: pmic@34 {
88 		reg = <0x34>;
89 		interrupts = <0>;
90 	};
91 };
92 
93 #include "axp209.dtsi"
94 
95 &ac_power_supply {
96 	status = "okay";
97 };
98 
99 &battery_power_supply {
100 	status = "okay";
101 };
102 
103 &i2c1 {
104 	status = "okay";
105 
106 	accelerometer@4c {
107 		compatible = "fsl,mma7660";
108 		reg = <0x4c>;
109 	};
110 };
111 
112 &i2c2 {
113 	status = "okay";
114 
115 	touchscreen@38 {
116 		compatible = "edt,edt-ft5406";
117 		reg = <0x38>;
118 		interrupt-parent = <&pio>;
119 		interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
120 		touchscreen-size-x = <800>;
121 		touchscreen-size-y = <480>;
122 		vcc-supply = <&reg_vcc3v3>;
123 	};
124 };
125 
126 &lradc {
127 	vref-supply = <&reg_ldo2>;
128 	status = "okay";
129 
130 	button-571 {
131 		label = "Volume Up";
132 		linux,code = <KEY_VOLUMEUP>;
133 		channel = <0>;
134 		voltage = <571428>;
135 	};
136 
137 	button-761 {
138 		label = "Volume Down";
139 		linux,code = <KEY_VOLUMEDOWN>;
140 		channel = <0>;
141 		voltage = <761904>;
142 	};
143 };
144 
145 &mmc0 {
146 	vmmc-supply = <&reg_vcc3v3>;
147 	bus-width = <4>;
148 	cd-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>; /* PH01 */
149 	status = "okay";
150 };
151 
152 &ohci0 {
153 	status = "okay";
154 };
155 
156 &ohci1 {
157 	status = "okay";
158 };
159 
160 &otg_sram {
161 	status = "okay";
162 };
163 
164 &pio {
165 	vcc-pb-supply = <&reg_vcc3v3>;
166 	vcc-pf-supply = <&reg_vcc3v3>;
167 	vcc-ph-supply = <&reg_vcc3v3>;
168 };
169 
170 &pwm {
171 	pinctrl-names = "default";
172 	pinctrl-0 = <&pwm0_pin>;
173 	status = "okay";
174 };
175 
176 &reg_dcdc2 {
177 	regulator-always-on;
178 	regulator-min-microvolt = <1000000>;
179 	regulator-max-microvolt = <1400000>;
180 	regulator-name = "vdd-cpu";
181 };
182 
183 &reg_dcdc3 {
184 	regulator-always-on;
185 	regulator-min-microvolt = <1250000>;
186 	regulator-max-microvolt = <1250000>;
187 	regulator-name = "vdd-int-dll";
188 };
189 
190 &reg_ldo1 {
191 	regulator-name = "vdd-rtc";
192 };
193 
194 &reg_ldo2 {
195 	regulator-always-on;
196 	regulator-min-microvolt = <3000000>;
197 	regulator-max-microvolt = <3000000>;
198 	regulator-name = "avcc";
199 };
200 
201 &reg_usb0_vbus {
202 	status = "okay";
203 };
204 
205 &reg_usb1_vbus {
206 	status = "okay";
207 };
208 
209 &reg_usb2_vbus {
210 	status = "okay";
211 };
212 
213 &tcon0_out {
214 	tcon0_out_panel: endpoint@0 {
215 		reg = <0>;
216 		remote-endpoint = <&panel_input>;
217 	};
218 };
219 
220 &uart0 {
221 	pinctrl-names = "default";
222 	pinctrl-0 = <&uart0_pb_pins>;
223 	status = "okay";
224 };
225 
226 &usb_otg {
227 	dr_mode = "otg";
228 	status = "okay";
229 };
230 
231 &usb_power_supply {
232 	status = "okay";
233 };
234 
235 &usbphy {
236 	usb0_id_det-gpios = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
237 	usb0_vbus_det-gpios = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
238 	usb0_vbus-supply = <&reg_usb0_vbus>;
239 	usb1_vbus-supply = <&reg_usb1_vbus>;
240 	usb2_vbus-supply = <&reg_usb2_vbus>;
241 	status = "okay";
242 };
243