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	soc@01c00000 {
69		emac: ethernet@01c0b000 {
70			pinctrl-names = "default";
71			pinctrl-0 = <&emac_pins_a>;
72			phy = <&phy1>;
73			status = "okay";
74		};
75
76		mdio@01c0b080 {
77			status = "okay";
78
79			phy1: ethernet-phy@1 {
80				reg = <1>;
81			};
82		};
83
84		mmc0: mmc@01c0f000 {
85			pinctrl-names = "default";
86			pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_olinuxino_micro>;
87			vmmc-supply = <&reg_vcc3v3>;
88			bus-width = <4>;
89			cd-gpios = <&pio 6 1 GPIO_ACTIVE_HIGH>; /* PG1 */
90			cd-inverted;
91			status = "okay";
92		};
93
94		mmc1: mmc@01c10000 {
95			pinctrl-names = "default";
96			pinctrl-0 = <&mmc1_pins_a>, <&mmc1_cd_pin_olinuxino_micro>;
97			vmmc-supply = <&reg_vcc3v3>;
98			bus-width = <4>;
99			cd-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
100			cd-inverted;
101			status = "okay";
102		};
103
104		usbphy: phy@01c13400 {
105			usb1_vbus-supply = <&reg_usb1_vbus>;
106			status = "okay";
107		};
108
109		ehci0: usb@01c14000 {
110			status = "okay";
111		};
112
113		ohci0: usb@01c14400 {
114			status = "okay";
115		};
116
117		pinctrl@01c20800 {
118			mmc0_cd_pin_olinuxino_micro: mmc0_cd_pin@0 {
119				allwinner,pins = "PG1";
120				allwinner,function = "gpio_in";
121				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
122				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
123			};
124
125			mmc1_cd_pin_olinuxino_micro: mmc1_cd_pin@0 {
126				allwinner,pins = "PG13";
127				allwinner,function = "gpio_in";
128				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
129				allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
130			};
131
132			led_pins_olinuxino: led_pins@0 {
133				allwinner,pins = "PE3";
134				allwinner,function = "gpio_out";
135				allwinner,drive = <SUN4I_PINCTRL_20_MA>;
136				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
137			};
138
139			usb1_vbus_pin_olinuxino_m: usb1_vbus_pin@0 {
140				allwinner,pins = "PB10";
141				allwinner,function = "gpio_out";
142				allwinner,drive = <SUN4I_PINCTRL_10_MA>;
143				allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
144			};
145		};
146
147		lradc: lradc@01c22800 {
148			vref-supply = <&reg_vcc3v0>;
149			status = "okay";
150
151			button@191 {
152				label = "Volume Up";
153				linux,code = <KEY_VOLUMEUP>;
154				channel = <0>;
155				voltage = <191274>;
156			};
157
158			button@392 {
159				label = "Volume Down";
160				linux,code = <KEY_VOLUMEDOWN>;
161				channel = <0>;
162				voltage = <392644>;
163			};
164
165			button@601 {
166				label = "Menu";
167				linux,code = <KEY_MENU>;
168				channel = <0>;
169				voltage = <601151>;
170			};
171
172			button@795 {
173				label = "Enter";
174				linux,code = <KEY_ENTER>;
175				channel = <0>;
176				voltage = <795090>;
177			};
178
179			button@987 {
180				label = "Home";
181				linux,code = <KEY_HOMEPAGE>;
182				channel = <0>;
183				voltage = <987387>;
184			};
185		};
186
187		uart0: serial@01c28000 {
188			pinctrl-names = "default";
189			pinctrl-0 = <&uart0_pins_a>;
190			status = "okay";
191		};
192
193		uart2: serial@01c28800 {
194			pinctrl-names = "default";
195			pinctrl-0 = <&uart2_pins_a>;
196			status = "okay";
197		};
198
199		uart3: serial@01c28c00 {
200			pinctrl-names = "default";
201			pinctrl-0 = <&uart3_pins_a>;
202			status = "okay";
203		};
204
205		i2c0: i2c@01c2ac00 {
206			pinctrl-names = "default";
207			pinctrl-0 = <&i2c0_pins_a>;
208			status = "okay";
209		};
210
211		i2c1: i2c@01c2b000 {
212			pinctrl-names = "default";
213			pinctrl-0 = <&i2c1_pins_a>;
214			status = "okay";
215
216			at24@50 {
217				compatible = "at,24c16";
218				pagesize = <16>;
219				reg = <0x50>;
220				read-only;
221			};
222		};
223
224		i2c2: i2c@01c2b400 {
225			pinctrl-names = "default";
226			pinctrl-0 = <&i2c2_pins_a>;
227			status = "okay";
228		};
229	};
230
231	leds {
232		compatible = "gpio-leds";
233		pinctrl-names = "default";
234		pinctrl-0 = <&led_pins_olinuxino>;
235
236		green {
237			label = "a10s-olinuxino-micro:green:usr";
238			gpios = <&pio 4 3 GPIO_ACTIVE_HIGH>;
239			default-state = "on";
240		};
241	};
242
243	reg_usb1_vbus: usb1-vbus {
244		pinctrl-0 = <&usb1_vbus_pin_olinuxino_m>;
245		gpio = <&pio 1 10 GPIO_ACTIVE_HIGH>;
246		status = "okay";
247	};
248};
249