GNU Linux-libre 4.19.207-gnu1
[releases.git] / arch / arm / boot / dts / sun4i-a10-inet9f-rev03.dts
1 /*
2  * Copyright 2015 Hans de Goede <hdegoede@redhat.com>
3  *
4  * This file is dual-licensed: you can use it either under the terms
5  * of the GPL or the X11 license, at your option. Note that this dual
6  * licensing only applies to this file, and not this project as a
7  * whole.
8  *
9  *  a) This file is free software; you can redistribute it and/or
10  *     modify it under the terms of the GNU General Public License as
11  *     published by the Free Software Foundation; either version 2 of the
12  *     License, or (at your option) any later version.
13  *
14  *     This file is distributed in the hope that it will be useful,
15  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *     GNU General Public License for more details.
18  *
19  * Or, alternatively,
20  *
21  *  b) Permission is hereby granted, free of charge, to any person
22  *     obtaining a copy of this software and associated documentation
23  *     files (the "Software"), to deal in the Software without
24  *     restriction, including without limitation the rights to use,
25  *     copy, modify, merge, publish, distribute, sublicense, and/or
26  *     sell copies of the Software, and to permit persons to whom the
27  *     Software is furnished to do so, subject to the following
28  *     conditions:
29  *
30  *     The above copyright notice and this permission notice shall be
31  *     included in all copies or substantial portions of the Software.
32  *
33  *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34  *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35  *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36  *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37  *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38  *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39  *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40  *     OTHER DEALINGS IN THE SOFTWARE.
41  */
42
43 /dts-v1/;
44 #include "sun4i-a10.dtsi"
45 #include "sunxi-common-regulators.dtsi"
46 #include <dt-bindings/gpio/gpio.h>
47 #include <dt-bindings/input/input.h>
48 #include <dt-bindings/interrupt-controller/irq.h>
49
50 / {
51         model = "iNet-9F Rev 03";
52         compatible = "inet-tek,inet9f-rev03", "allwinner,sun4i-a10";
53
54         aliases {
55                 serial0 = &uart0;
56         };
57
58         chosen {
59                 stdout-path = "serial0:115200n8";
60         };
61
62         gpio-keys {
63                 compatible = "gpio-keys-polled";
64                 pinctrl-names = "default";
65                 pinctrl-0 = <&key_pins_inet9f>;
66                 poll-interval = <20>;
67
68                 left-joystick-left {
69                         label = "Left Joystick Left";
70                         linux,code = <ABS_X>;
71                         linux,input-type = <EV_ABS>;
72                         linux,input-value = <0xffffffff>; /* -1 */
73                         gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */
74                 };
75
76                 left-joystick-right {
77                         label = "Left Joystick Right";
78                         linux,code = <ABS_X>;
79                         linux,input-type = <EV_ABS>;
80                         linux,input-value = <1>;
81                         gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */
82                 };
83
84                 left-joystick-up {
85                         label = "Left Joystick Up";
86                         linux,code = <ABS_Y>;
87                         linux,input-type = <EV_ABS>;
88                         linux,input-value = <0xffffffff>; /* -1 */
89                         gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
90                 };
91
92                 left-joystick-down {
93                         label = "Left Joystick Down";
94                         linux,code = <ABS_Y>;
95                         linux,input-type = <EV_ABS>;
96                         linux,input-value = <1>;
97                         gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
98                 };
99
100                 right-joystick-left {
101                         label = "Right Joystick Left";
102                         linux,code = <ABS_Z>;
103                         linux,input-type = <EV_ABS>;
104                         linux,input-value = <0xffffffff>; /* -1 */
105                         gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */
106                 };
107
108                 right-joystick-right {
109                         label = "Right Joystick Right";
110                         linux,code = <ABS_Z>;
111                         linux,input-type = <EV_ABS>;
112                         linux,input-value = <1>;
113                         gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */
114                 };
115
116                 right-joystick-up {
117                         label = "Right Joystick Up";
118                         linux,code = <ABS_RZ>;
119                         linux,input-type = <EV_ABS>;
120                         linux,input-value = <0xffffffff>; /* -1 */
121                         gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */
122                 };
123
124                 right-joystick-down {
125                         label = "Right Joystick Down";
126                         linux,code = <ABS_RZ>;
127                         linux,input-type = <EV_ABS>;
128                         linux,input-value = <1>;
129                         gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */
130                 };
131
132                 dpad-left {
133                         label = "DPad Left";
134                         linux,code = <ABS_HAT0X>;
135                         linux,input-type = <EV_ABS>;
136                         linux,input-value = <0xffffffff>; /* -1 */
137                         gpios = <&pio 7 23 GPIO_ACTIVE_LOW>; /* PH23 */
138                 };
139
140                 dpad-right {
141                         label = "DPad Right";
142                         linux,code = <ABS_HAT0X>;
143                         linux,input-type = <EV_ABS>;
144                         linux,input-value = <1>;
145                         gpios = <&pio 7 24 GPIO_ACTIVE_LOW>; /* PH24 */
146                 };
147
148                 dpad-up {
149                         label = "DPad Up";
150                         linux,code = <ABS_HAT0Y>;
151                         linux,input-type = <EV_ABS>;
152                         linux,input-value = <0xffffffff>; /* -1 */
153                         gpios = <&pio 7 25 GPIO_ACTIVE_LOW>; /* PH25 */
154                 };
155
156                 dpad-down {
157                         label = "DPad Down";
158                         linux,code = <ABS_HAT0Y>;
159                         linux,input-type = <EV_ABS>;
160                         linux,input-value = <1>;
161                         gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */
162                 };
163
164                 x {
165                         label = "Button X";
166                         linux,code = <BTN_X>;
167                         gpios = <&pio 0 16 GPIO_ACTIVE_LOW>; /* PA16 */
168                 };
169
170                 y {
171                         label = "Button Y";
172                         linux,code = <BTN_Y>;
173                         gpios = <&pio 0 14 GPIO_ACTIVE_LOW>; /* PA14 */
174                 };
175
176                 a {
177                         label = "Button A";
178                         linux,code = <BTN_A>;
179                         gpios = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */
180                 };
181
182                 b {
183                         label = "Button B";
184                         linux,code = <BTN_B>;
185                         gpios = <&pio 0 15 GPIO_ACTIVE_LOW>; /* PA15 */
186                 };
187
188                 select {
189                         label = "Select Button";
190                         linux,code = <BTN_SELECT>;
191                         gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */
192                 };
193
194                 start {
195                         label = "Start Button";
196                         linux,code = <BTN_START>;
197                         gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */
198                 };
199
200                 top-left {
201                         label = "Top Left Button";
202                         linux,code = <BTN_TL>;
203                         gpios = <&pio 7 22 GPIO_ACTIVE_LOW>; /* PH22 */
204                 };
205
206                 top-right {
207                         label = "Top Right Button";
208                         linux,code = <BTN_TR>;
209                         gpios = <&pio 0 13 GPIO_ACTIVE_LOW>; /* PA13 */
210                 };
211         };
212 };
213
214 &cpu0 {
215         cpu-supply = <&reg_dcdc2>;
216 };
217
218 &ehci1 {
219         status = "okay";
220 };
221
222 &i2c0 {
223         status = "okay";
224
225         axp209: pmic@34 {
226                 reg = <0x34>;
227                 interrupts = <0>;
228         };
229 };
230
231 #include "axp209.dtsi"
232
233 &i2c1 {
234         status = "okay";
235
236         /* Accelerometer */
237         bma250@18 {
238                 compatible = "bosch,bma250";
239                 reg = <0x18>;
240                 interrupt-parent = <&pio>;
241                 interrupts = <7 0 IRQ_TYPE_EDGE_RISING>; /* PH0 / EINT0 */
242         };
243 };
244
245 &i2c2 {
246         status = "okay";
247
248         ft5406ee8: touchscreen@38 {
249                 compatible = "edt,edt-ft5406";
250                 reg = <0x38>;
251                 interrupt-parent = <&pio>;
252                 interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
253                 touchscreen-size-x = <800>;
254                 touchscreen-size-y = <480>;
255         };
256 };
257
258 &lradc {
259         vref-supply = <&reg_ldo2>;
260         status = "okay";
261
262         button-200 {
263                 label = "Menu";
264                 linux,code = <KEY_MENU>;
265                 channel = <0>;
266                 voltage = <200000>;
267         };
268
269         button-600 {
270                 label = "Volume Up";
271                 linux,code = <KEY_VOLUMEUP>;
272                 channel = <0>;
273                 voltage = <600000>;
274         };
275
276         button-800 {
277                 label = "Volume Down";
278                 linux,code = <KEY_VOLUMEDOWN>;
279                 channel = <0>;
280                 voltage = <800000>;
281         };
282
283         button-1000 {
284                 label = "Home";
285                 linux,code = <KEY_HOMEPAGE>;
286                 channel = <0>;
287                 voltage = <1000000>;
288         };
289
290         button-1200 {
291                 label = "Esc";
292                 linux,code = <KEY_ESC>;
293                 channel = <0>;
294                 voltage = <1200000>;
295         };
296 };
297
298 &mmc0 {
299         vmmc-supply = <&reg_vcc3v3>;
300         bus-width = <4>;
301         cd-gpios = <&pio 7 1 GPIO_ACTIVE_LOW>; /* PH1 */
302         status = "okay";
303 };
304
305 &otg_sram {
306         status = "okay";
307 };
308
309 &pio {
310         key_pins_inet9f: key-pins {
311                 pins = "PA0", "PA1", "PA3", "PA4",
312                        "PA5", "PA6", "PA8", "PA9",
313                        "PA11", "PA12", "PA13",
314                        "PA14", "PA15", "PA16", "PA17",
315                        "PH22", "PH23", "PH24", "PH25", "PH26";
316                 function = "gpio_in";
317                 bias-pull-up;
318         };
319
320         usb0_id_detect_pin: usb0-id-detect-pin {
321                 pins = "PH4";
322                 function = "gpio_in";
323                 bias-pull-up;
324         };
325
326         usb0_vbus_detect_pin: usb0-vbus-detect-pin {
327                 pins = "PH5";
328                 function = "gpio_in";
329                 bias-pull-down;
330         };
331 };
332
333 &reg_dcdc2 {
334         regulator-always-on;
335         regulator-min-microvolt = <1000000>;
336         regulator-max-microvolt = <1400000>;
337         regulator-name = "vdd-cpu";
338 };
339
340 &reg_dcdc3 {
341         regulator-always-on;
342         regulator-min-microvolt = <1250000>;
343         regulator-max-microvolt = <1250000>;
344         regulator-name = "vdd-int-dll";
345 };
346
347 &reg_ldo1 {
348         regulator-name = "vdd-rtc";
349 };
350
351 &reg_ldo2 {
352         regulator-always-on;
353         regulator-min-microvolt = <3000000>;
354         regulator-max-microvolt = <3000000>;
355         regulator-name = "avcc";
356 };
357
358 &reg_usb0_vbus {
359         status = "okay";
360 };
361
362 &reg_usb2_vbus {
363         status = "okay";
364 };
365
366 &uart0 {
367         pinctrl-names = "default";
368         pinctrl-0 = <&uart0_pb_pins>;
369         status = "okay";
370 };
371
372 &usb_otg {
373         dr_mode = "otg";
374         status = "okay";
375 };
376
377 &usbphy {
378         pinctrl-names = "default";
379         pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
380         usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
381         usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
382         usb0_vbus-supply = <&reg_usb0_vbus>;
383         usb2_vbus-supply = <&reg_usb2_vbus>;
384         status = "okay";
385 };