• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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		#address-cells = <1>;
67		#size-cells = <0>;
68		poll-interval = <20>;
69
70		button@0 {
71			label = "Left Joystick Left";
72			linux,code = <ABS_X>;
73			linux,input-type = <EV_ABS>;
74			linux,input-value = <0xffffffff>; /* -1 */
75			gpios = <&pio 0 6 GPIO_ACTIVE_LOW>; /* PA6 */
76		};
77
78		button@1 {
79			label = "Left Joystick Right";
80			linux,code = <ABS_X>;
81			linux,input-type = <EV_ABS>;
82			linux,input-value = <1>;
83			gpios = <&pio 0 5 GPIO_ACTIVE_LOW>; /* PA5 */
84		};
85
86		button@2 {
87			label = "Left Joystick Up";
88			linux,code = <ABS_Y>;
89			linux,input-type = <EV_ABS>;
90			linux,input-value = <0xffffffff>; /* -1 */
91			gpios = <&pio 0 8 GPIO_ACTIVE_LOW>; /* PA8 */
92		};
93
94		button@3 {
95			label = "Left Joystick Down";
96			linux,code = <ABS_Y>;
97			linux,input-type = <EV_ABS>;
98			linux,input-value = <1>;
99			gpios = <&pio 0 9 GPIO_ACTIVE_LOW>; /* PA9 */
100		};
101
102		button@4 {
103			label = "Right Joystick Left";
104			linux,code = <ABS_Z>;
105			linux,input-type = <EV_ABS>;
106			linux,input-value = <0xffffffff>; /* -1 */
107			gpios = <&pio 0 1 GPIO_ACTIVE_LOW>; /* PA1 */
108		};
109
110		button@5 {
111			label = "Right Joystick Right";
112			linux,code = <ABS_Z>;
113			linux,input-type = <EV_ABS>;
114			linux,input-value = <1>;
115			gpios = <&pio 0 0 GPIO_ACTIVE_LOW>; /* PA0 */
116		};
117
118		button@6 {
119			label = "Right Joystick Up";
120			linux,code = <ABS_RZ>;
121			linux,input-type = <EV_ABS>;
122			linux,input-value = <0xffffffff>; /* -1 */
123			gpios = <&pio 0 3 GPIO_ACTIVE_LOW>; /* PA3 */
124		};
125
126		button@7 {
127			label = "Right Joystick Down";
128			linux,code = <ABS_RZ>;
129			linux,input-type = <EV_ABS>;
130			linux,input-value = <1>;
131			gpios = <&pio 0 4 GPIO_ACTIVE_LOW>; /* PA4 */
132		};
133
134		button@8 {
135			label = "DPad Left";
136			linux,code = <ABS_HAT0X>;
137			linux,input-type = <EV_ABS>;
138			linux,input-value = <0xffffffff>; /* -1 */
139			gpios = <&pio 7 23 GPIO_ACTIVE_LOW>; /* PH23 */
140		};
141
142		button@9 {
143			label = "DPad Right";
144			linux,code = <ABS_HAT0X>;
145			linux,input-type = <EV_ABS>;
146			linux,input-value = <1>;
147			gpios = <&pio 7 24 GPIO_ACTIVE_LOW>; /* PH24 */
148		};
149
150		button@10 {
151			label = "DPad Up";
152			linux,code = <ABS_HAT0Y>;
153			linux,input-type = <EV_ABS>;
154			linux,input-value = <0xffffffff>; /* -1 */
155			gpios = <&pio 7 25 GPIO_ACTIVE_LOW>; /* PH25 */
156		};
157
158		button@11 {
159			label = "DPad Down";
160			linux,code = <ABS_HAT0Y>;
161			linux,input-type = <EV_ABS>;
162			linux,input-value = <1>;
163			gpios = <&pio 7 26 GPIO_ACTIVE_LOW>; /* PH26 */
164		};
165
166		button@12 {
167			label = "Button X";
168			linux,code = <BTN_X>;
169			gpios = <&pio 0 16 GPIO_ACTIVE_LOW>; /* PA16 */
170		};
171
172		button@13 {
173			label = "Button Y";
174			linux,code = <BTN_Y>;
175			gpios = <&pio 0 14 GPIO_ACTIVE_LOW>; /* PA14 */
176		};
177
178		button@14 {
179			label = "Button A";
180			linux,code = <BTN_A>;
181			gpios = <&pio 0 17 GPIO_ACTIVE_LOW>; /* PA17 */
182		};
183
184		button@15 {
185			label = "Button B";
186			linux,code = <BTN_B>;
187			gpios = <&pio 0 15 GPIO_ACTIVE_LOW>; /* PA15 */
188		};
189
190		button@16 {
191			label = "Select Button";
192			linux,code = <BTN_SELECT>;
193			gpios = <&pio 0 11 GPIO_ACTIVE_LOW>; /* PA11 */
194		};
195
196		button@17 {
197			label = "Start Button";
198			linux,code = <BTN_START>;
199			gpios = <&pio 0 12 GPIO_ACTIVE_LOW>; /* PA12 */
200		};
201
202		button@18 {
203			label = "Top Left Button";
204			linux,code = <BTN_TL>;
205			gpios = <&pio 7 22 GPIO_ACTIVE_LOW>; /* PH22 */
206		};
207
208		button@19 {
209			label = "Top Right Button";
210			linux,code = <BTN_TR>;
211			gpios = <&pio 0 13 GPIO_ACTIVE_LOW>; /* PA13 */
212		};
213	};
214};
215
216&cpu0 {
217	cpu-supply = <&reg_dcdc2>;
218};
219
220&ehci1 {
221	status = "okay";
222};
223
224&i2c0 {
225	pinctrl-names = "default";
226	pinctrl-0 = <&i2c0_pins_a>;
227	status = "okay";
228
229	axp209: pmic@34 {
230		reg = <0x34>;
231		interrupts = <0>;
232	};
233};
234
235#include "axp209.dtsi"
236
237&i2c1 {
238	pinctrl-names = "default";
239	pinctrl-0 = <&i2c1_pins_a>;
240	status = "okay";
241
242	/* Accelerometer */
243	bma250@18 {
244		compatible = "bosch,bma250";
245		reg = <0x18>;
246		interrupt-parent = <&pio>;
247		interrupts = <7 0 IRQ_TYPE_EDGE_RISING>; /* PH0 / EINT0 */
248	};
249};
250
251&i2c2 {
252	pinctrl-names = "default";
253	pinctrl-0 = <&i2c2_pins_a>;
254	status = "okay";
255
256	ft5406ee8: touchscreen@38 {
257		compatible = "edt,edt-ft5406";
258		reg = <0x38>;
259		interrupt-parent = <&pio>;
260		interrupts = <7 21 IRQ_TYPE_EDGE_FALLING>;
261		touchscreen-size-x = <800>;
262		touchscreen-size-y = <480>;
263	};
264};
265
266&lradc {
267	vref-supply = <&reg_ldo2>;
268	status = "okay";
269
270	button@200 {
271		label = "Menu";
272		linux,code = <KEY_MENU>;
273		channel = <0>;
274		voltage = <200000>;
275	};
276
277	button@600 {
278		label = "Volume Up";
279		linux,code = <KEY_VOLUMEUP>;
280		channel = <0>;
281		voltage = <600000>;
282	};
283
284	button@800 {
285		label = "Volume Down";
286		linux,code = <KEY_VOLUMEDOWN>;
287		channel = <0>;
288		voltage = <800000>;
289	};
290
291	button@1000 {
292		label = "Home";
293		linux,code = <KEY_HOMEPAGE>;
294		channel = <0>;
295		voltage = <1000000>;
296	};
297
298	button@1200 {
299		label = "Esc";
300		linux,code = <KEY_ESC>;
301		channel = <0>;
302		voltage = <1200000>;
303	};
304};
305
306&mmc0 {
307	pinctrl-names = "default";
308	pinctrl-0 = <&mmc0_pins_a>;
309	vmmc-supply = <&reg_vcc3v3>;
310	bus-width = <4>;
311	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
312	cd-inverted;
313	status = "okay";
314};
315
316&otg_sram {
317	status = "okay";
318};
319
320&pio {
321	key_pins_inet9f: key_pins@0 {
322		pins = "PA0", "PA1", "PA3", "PA4",
323		       "PA5", "PA6", "PA8", "PA9",
324		       "PA11", "PA12", "PA13",
325		       "PA14", "PA15", "PA16", "PA17",
326		       "PH22", "PH23", "PH24", "PH25", "PH26";
327		function = "gpio_in";
328		bias-pull-up;
329	};
330
331	usb0_id_detect_pin: usb0_id_detect_pin@0 {
332		pins = "PH4";
333		function = "gpio_in";
334		bias-pull-up;
335	};
336
337	usb0_vbus_detect_pin: usb0_vbus_detect_pin@0 {
338		pins = "PH5";
339		function = "gpio_in";
340		bias-pull-down;
341	};
342};
343
344&reg_dcdc2 {
345	regulator-always-on;
346	regulator-min-microvolt = <1000000>;
347	regulator-max-microvolt = <1400000>;
348	regulator-name = "vdd-cpu";
349};
350
351&reg_dcdc3 {
352	regulator-always-on;
353	regulator-min-microvolt = <1250000>;
354	regulator-max-microvolt = <1250000>;
355	regulator-name = "vdd-int-dll";
356};
357
358&reg_ldo1 {
359	regulator-name = "vdd-rtc";
360};
361
362&reg_ldo2 {
363	regulator-always-on;
364	regulator-min-microvolt = <3000000>;
365	regulator-max-microvolt = <3000000>;
366	regulator-name = "avcc";
367};
368
369&reg_usb0_vbus {
370	status = "okay";
371};
372
373&reg_usb2_vbus {
374	status = "okay";
375};
376
377&uart0 {
378	pinctrl-names = "default";
379	pinctrl-0 = <&uart0_pins_a>;
380	status = "okay";
381};
382
383&usb_otg {
384	dr_mode = "otg";
385	status = "okay";
386};
387
388&usbphy {
389	pinctrl-names = "default";
390	pinctrl-0 = <&usb0_id_detect_pin>, <&usb0_vbus_detect_pin>;
391	usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
392	usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
393	usb0_vbus-supply = <&reg_usb0_vbus>;
394	usb2_vbus-supply = <&reg_usb2_vbus>;
395	status = "okay";
396};
397