1/*
2 * Copyright 2013 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This file is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This file is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 *     You should have received a copy of the GNU General Public
22 *     License along with this file; if not, write to the Free
23 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 *     MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 *  b) Permission is hereby granted, free of charge, to any person
29 *     obtaining a copy of this software and associated documentation
30 *     files (the "Software"), to deal in the Software without
31 *     restriction, including without limitation the rights to use,
32 *     copy, modify, merge, publish, distribute, sublicense, and/or
33 *     sell copies of the Software, and to permit persons to whom the
34 *     Software is furnished to do so, subject to the following
35 *     conditions:
36 *
37 *     The above copyright notice and this permission notice shall be
38 *     included in all copies or substantial portions of the Software.
39 *
40 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 *     OTHER DEALINGS IN THE SOFTWARE.
48 */
49
50/dts-v1/;
51#include "sun5i-a10s.dtsi"
52#include "sunxi-common-regulators.dtsi"
53
54#include <dt-bindings/gpio/gpio.h>
55#include <dt-bindings/input/input.h>
56#include <dt-bindings/pinctrl/sun4i-a10.h>
57
58/ {
59	model = "Olimex A10s-Olinuxino Micro";
60	compatible = "olimex,a10s-olinuxino-micro", "allwinner,sun5i-a10s";
61
62	aliases {
63		serial0 = &uart0;
64		serial1 = &uart2;
65		serial2 = &uart3;
66	};
67
68	chosen {
69		stdout-path = "serial0:115200n8";
70	};
71
72	leds {
73		compatible = "gpio-leds";
74		pinctrl-names = "default";
75		pinctrl-0 = <&led_pins_olinuxino>;
76
77		green {
78			label = "a10s-olinuxino-micro:green:usr";
79			gpios = <&pio 4 3 GPIO_ACTIVE_HIGH>;
80			default-state = "on";
81		};
82	};
83};
84
85&ehci0 {
86	status = "okay";
87};
88
89&emac {
90	pinctrl-names = "default";
91	pinctrl-0 = <&emac_pins_a>;
92	phy = <&phy1>;
93	status = "okay";
94};
95
96&i2c0 {
97	pinctrl-names = "default";
98	pinctrl-0 = <&i2c0_pins_a>;
99	status = "okay";
100};
101
102&i2c1 {
103	pinctrl-names = "default";
104	pinctrl-0 = <&i2c1_pins_a>;
105	status = "okay";
106
107	at24@50 {
108		compatible = "at,24c16";
109		pagesize = <16>;
110		reg = <0x50>;
111		read-only;
112	};
113};
114
115&i2c2 {
116	pinctrl-names = "default";
117	pinctrl-0 = <&i2c2_pins_a>;
118	status = "okay";
119};
120
121&lradc {
122	vref-supply = <&reg_vcc3v0>;
123	status = "okay";
124
125	button@191 {
126		label = "Volume Up";
127		linux,code = <KEY_VOLUMEUP>;
128		channel = <0>;
129		voltage = <191274>;
130	};
131
132	button@392 {
133		label = "Volume Down";
134		linux,code = <KEY_VOLUMEDOWN>;
135		channel = <0>;
136		voltage = <392644>;
137	};
138
139	button@601 {
140		label = "Menu";
141		linux,code = <KEY_MENU>;
142		channel = <0>;
143		voltage = <601151>;
144	};
145
146	button@795 {
147		label = "Enter";
148		linux,code = <KEY_ENTER>;
149		channel = <0>;
150		voltage = <795090>;
151	};
152
153	button@987 {
154		label = "Home";
155		linux,code = <KEY_HOMEPAGE>;
156		channel = <0>;
157		voltage = <987387>;
158	};
159};
160
161&mdio {
162	status = "okay";
163
164	phy1: ethernet-phy@1 {
165		reg = <1>;
166	};
167};
168
169&mmc0 {
170	pinctrl-names = "default";
171	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino_micro>;
172	vmmc-supply = <&reg_vcc3v3>;
173	bus-width = <4>;
174	cd-gpios = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
175	cd-inverted;
176	status = "okay";
177};
178
179&mmc1 {
180	pinctrl-names = "default";
181	pinctrl-0 = <&mmc1_pins_a>, <&mmc1_cd_pin_olinuxino_micro>;
182	vmmc-supply = <&reg_vcc3v3>;
183	bus-width = <4>;
184	cd-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
185	cd-inverted;
186	status = "okay";
187};
188
189&ohci0 {
190	status = "okay";
191};
192
193&pio {
194	mmc0_cd_pin_olinuxino_micro: mmc0_cd_pin@0 {
195		allwinner,pins = "PG1";
196		allwinner,function = "gpio_in";
197		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
198		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
199	};
200
201	mmc1_cd_pin_olinuxino_micro: mmc1_cd_pin@0 {
202		allwinner,pins = "PG13";
203		allwinner,function = "gpio_in";
204		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
205		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
206	};
207
208	led_pins_olinuxino: led_pins@0 {
209		allwinner,pins = "PE3";
210		allwinner,function = "gpio_out";
211		allwinner,drive = <SUN4I_PINCTRL_20_MA>;
212		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
213	};
214
215	usb1_vbus_pin_olinuxino_m: usb1_vbus_pin@0 {
216		allwinner,pins = "PB10";
217		allwinner,function = "gpio_out";
218		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
219		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
220	};
221};
222
223&reg_usb1_vbus {
224	pinctrl-0 = <&usb1_vbus_pin_olinuxino_m>;
225	gpio = <&pio 1 10 GPIO_ACTIVE_HIGH>;
226	status = "okay";
227};
228
229&uart0 {
230	pinctrl-names = "default";
231	pinctrl-0 = <&uart0_pins_a>;
232	status = "okay";
233};
234
235&uart2 {
236	pinctrl-names = "default";
237	pinctrl-0 = <&uart2_pins_a>;
238	status = "okay";
239};
240
241&uart3 {
242	pinctrl-names = "default";
243	pinctrl-0 = <&uart3_pins_a>;
244	status = "okay";
245};
246
247&usbphy {
248	usb1_vbus-supply = <&reg_usb1_vbus>;
249	status = "okay";
250};
251
252