Merge branch 'apw' (xfrm_user fixes)
[sfrench/cifs-2.6.git] / arch / arm / boot / dts / da850-lego-ev3.dts
1 /*
2  * Device tree for LEGO MINDSTORMS EV3
3  *
4  * Copyright (C) 2017 David Lechner <david@lechnology.com>
5  *
6  * This program is free software; you can redistribute  it and/or modify it
7  * under  the terms of  the GNU General  Public License as published by the
8  * Free Software Foundation, version 2.
9  */
10
11 /dts-v1/;
12 #include <dt-bindings/gpio/gpio.h>
13 #include <dt-bindings/input/linux-event-codes.h>
14 #include <dt-bindings/pwm/pwm.h>
15
16 #include "da850.dtsi"
17
18 / {
19         compatible = "lego,ev3", "ti,da850";
20         model = "LEGO MINDSTORMS EV3";
21
22         aliases {
23                 serial1 = &serial1;
24         };
25
26         memory@c0000000 {
27                 device_type = "memory";
28                 reg = <0xc0000000 0x04000000>;
29         };
30
31         /*
32          * The buttons on the EV3 are mapped to keyboard keys.
33          */
34         gpio_keys {
35                 compatible = "gpio-keys";
36                 #address-cells = <1>;
37                 #size-cells = <0>;
38                 label = "EV3 Brick Buttons";
39                 pinctrl-names = "default";
40                 pinctrl-0 = <&button_pins>, <&button_bias>;
41
42                 center {
43                         label = "Center";
44                         linux,code = <KEY_ENTER>;
45                         gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
46                 };
47
48                 left {
49                         label = "Left";
50                         linux,code = <KEY_LEFT>;
51                         gpios = <&gpio 102 GPIO_ACTIVE_HIGH>;
52                 };
53
54                 back {
55                         label = "Back";
56                         linux,code = <KEY_BACKSPACE>;
57                         gpios = <&gpio 106 GPIO_ACTIVE_HIGH>;
58                 };
59
60                 right {
61                         label = "Right";
62                         linux,code = <KEY_RIGHT>;
63                         gpios = <&gpio 124 GPIO_ACTIVE_HIGH>;
64                 };
65
66                 down {
67                         label = "Down";
68                         linux,code = <KEY_DOWN>;
69                         gpios = <&gpio 126 GPIO_ACTIVE_HIGH>;
70                 };
71
72                 up {
73                         label = "Up";
74                         linux,code = <KEY_UP>;
75                         gpios = <&gpio 127 GPIO_ACTIVE_HIGH>;
76                 };
77         };
78
79         /*
80          * The EV3 has two built-in bi-color LEDs behind the buttons.
81          */
82         leds {
83                 compatible = "gpio-leds";
84                 pinctrl-names = "default";
85                 pinctrl-0 = <&led_pins>;
86
87                 left_green {
88                         label = "led0:green:brick-status";
89                         /* GP6[13] */
90                         gpios = <&gpio 103 GPIO_ACTIVE_HIGH>;
91                         linux,default-trigger = "default-on";
92                 };
93
94                 right_red {
95                         label = "led1:red:brick-status";
96                         /* GP6[7] */
97                         gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
98                         linux,default-trigger = "default-on";
99                 };
100
101                 left_red {
102                         label = "led0:red:brick-status";
103                         /* GP6[12] */
104                         gpios = <&gpio 109 GPIO_ACTIVE_HIGH>;
105                         linux,default-trigger = "default-on";
106                 };
107
108                 right_green {
109                         label = "led1:green:brick-status";
110                         /* GP6[14] */
111                         gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
112                         linux,default-trigger = "default-on";
113                 };
114         };
115
116         /*
117          * The EV3 is powered down by turning off the main 5V supply.
118          */
119         gpio-poweroff {
120                 compatible = "gpio-poweroff";
121                 gpios = <&gpio 107 GPIO_ACTIVE_LOW>;
122                 pinctrl-names = "default";
123                 pinctrl-0 = <&system_power_pin>;
124         };
125
126         /*
127          * This is a 5V current limiting regulator that is shared by USB,
128          * the sensor (input) ports, the motor (output) ports and the A/DC.
129          */
130         vcc5v: regulator1 {
131                 pinctrl-names = "default";
132                 pinctrl-0 = <&vcc5v_pins>;
133                 compatible = "regulator-fixed";
134                 regulator-name = "vcc5v";
135                 regulator-min-microvolt = <5000000>;
136                 regulator-max-microvolt = <5000000>;
137                 gpio = <&gpio 101 0>;
138                 over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
139                 enable-active-high;
140                 regulator-boot-on;
141         };
142 };
143
144 &pmx_core {
145         status = "okay";
146
147         spi0_cs3_pin: pinmux_spi0_cs3_pin {
148                 pinctrl-single,bits = <
149                         /* CS3 */
150                         0xc 0x01000000 0x0f000000
151                 >;
152         };
153
154         mmc0_cd_pin: pinmux_mmc0_cd {
155                 pinctrl-single,bits = <
156                         /* GP5[14] */
157                         0x2C 0x00000080 0x000000f0
158                 >;
159         };
160
161         button_pins: pinmux_button_pins {
162                 pinctrl-single,bits = <
163                         /* GP1[13] */
164                         0x8 0x00000800 0x00000f00
165                         /* GP6[10] */
166                         0x34 0x00800000 0x00f00000
167                         /* GP6[6] */
168                         0x38 0x00000080 0x000000f0
169                         /* GP7[12], GP7[14], GP7[15] */
170                         0x40 0x00808800 0x00f0ff00
171                 >;
172         };
173
174         led_pins: pinmux_led_pins {
175                 pinctrl-single,bits = <
176                         /* GP6[12], GP6[13], GP6[14] */
177                         0x34 0x00008880 0x0000fff0
178                         /* GP6[7] */
179                         0x38 0x00000008 0x0000000f
180                 >;
181         };
182
183         system_power_pin: pinmux_system_power {
184                 pinctrl-single,bits = <
185                         /* GP6[11] */
186                         0x34 0x00080000 0x000f0000
187                 >;
188         };
189
190         vcc5v_pins: pinmux_vcc5v {
191                 pinctrl-single,bits = <
192                         /* GP6[5] */
193                         0x40 0x00000080 0x000000f0
194                         /* GP6[3] */
195                         0x4c 0x00008000 0x0000f000
196                 >;
197         };
198 };
199
200 &pinconf {
201         status = "okay";
202
203         /* Buttons have external pulldown resistors */
204         button_bias: button-bias-groups {
205                 disable {
206                         groups = "cp5", "cp24", "cp25", "cp28";
207                         bias-disable;
208                 };
209         };
210 };
211
212 /* Input port 1 */
213 &serial1 {
214         status = "okay";
215         pinctrl-names = "default";
216         pinctrl-0 = <&serial1_rxtx_pins>;
217 };
218
219 &rtc0 {
220         status = "okay";
221 };
222
223 &i2c0 {
224         status = "okay";
225         clock-frequency = <400000>;
226         pinctrl-names = "default";
227         pinctrl-0 = <&i2c0_pins>;
228
229         /*
230          * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
231          */
232         eeprom@50 {
233                 compatible = "microchip,24c128";
234                 pagesize = <64>;
235                 read-only;
236                 reg = <0x50>;
237         };
238 };
239
240 &wdt {
241         status = "okay";
242 };
243
244 &mmc0 {
245         status = "okay";
246         max-frequency = <50000000>;
247         bus-width = <4>;
248         cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
249         pinctrl-names = "default";
250         pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>;
251 };
252
253 &spi0 {
254         status = "okay";
255         pinctrl-names = "default";
256         pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
257
258         flash@0 {
259                 compatible = "n25q128a13", "jedec,spi-nor";
260                 reg = <0>;
261                 spi-max-frequency = <50000000>;
262                 ti,spi-wdelay = <8>;
263
264                 /* Partitions are based on the official firmware from LEGO */
265                 partitions {
266                         compatible = "fixed-partitions";
267                         #address-cells = <1>;
268                         #size-cells = <1>;
269
270                         partition@0 {
271                                 label = "U-Boot";
272                                 reg = <0 0x40000>;
273                         };
274
275                         partition@40000 {
276                                 label = "U-Boot Env";
277                                 reg = <0x40000 0x10000>;
278                         };
279
280                         partition@50000 {
281                                 label = "Kernel";
282                                 reg = <0x50000 0x200000>;
283                         };
284
285                         partition@250000 {
286                                 label = "Filesystem";
287                                 reg = <0x250000 0xa50000>;
288                         };
289
290                         partition@cb0000 {
291                                 label = "Storage";
292                                 reg = <0xcb0000 0x2f0000>;
293                         };
294                 };
295         };
296 };
297
298 &gpio {
299         status = "okay";
300 };
301
302 &usb_phy {
303         status = "okay";
304 };
305
306 &usb0 {
307         status = "okay";
308 };
309
310 &usb1 {
311         status = "okay";
312         vbus-supply = <&vcc5v>;
313 };