summaryrefslogtreecommitdiff
path: root/arch/arm/boot/dts/da850-lego-ev3.dts
blob: 81942ae83e1f9c9f717dd0fd565a28966c44c1da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/*
 * Device tree for LEGO MINDSTORMS EV3
 *
 * Copyright (C) 2017 David Lechner <david@lechnology.com>
 *
 * This program is free software; you can redistribute  it and/or modify it
 * under  the terms of  the GNU General  Public License as published by the
 * Free Software Foundation, version 2.
 */

/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/pwm/pwm.h>

#include "da850.dtsi"

/ {
	compatible = "lego,ev3", "ti,da850";
	model = "LEGO MINDSTORMS EV3";

	aliases {
		serial1 = &serial1;
	};

	memory@c0000000 {
		device_type = "memory";
		reg = <0xc0000000 0x04000000>;
	};

	/*
	 * The buttons on the EV3 are mapped to keyboard keys.
	 */
	gpio_keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		label = "EV3 Brick Buttons";
		pinctrl-names = "default";
		pinctrl-0 = <&button_pins>, <&button_bias>;

		center {
			label = "Center";
			linux,code = <KEY_ENTER>;
			gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
		};

		left {
			label = "Left";
			linux,code = <KEY_LEFT>;
			gpios = <&gpio 102 GPIO_ACTIVE_HIGH>;
		};

		back {
			label = "Back";
			linux,code = <KEY_BACKSPACE>;
			gpios = <&gpio 106 GPIO_ACTIVE_HIGH>;
		};

		right {
			label = "Right";
			linux,code = <KEY_RIGHT>;
			gpios = <&gpio 124 GPIO_ACTIVE_HIGH>;
		};

		down {
			label = "Down";
			linux,code = <KEY_DOWN>;
			gpios = <&gpio 126 GPIO_ACTIVE_HIGH>;
		};

		up {
			label = "Up";
			linux,code = <KEY_UP>;
			gpios = <&gpio 127 GPIO_ACTIVE_HIGH>;
		};
	};

	/*
	 * The EV3 has two built-in bi-color LEDs behind the buttons.
	 */
	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&led_pins>;

		left_green {
			label = "led0:green:brick-status";
			/* GP6[13] */
			gpios = <&gpio 103 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "default-on";
		};

		right_red {
			label = "led1:red:brick-status";
			/* GP6[7] */
			gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "default-on";
		};

		left_red {
			label = "led0:red:brick-status";
			/* GP6[12] */
			gpios = <&gpio 109 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "default-on";
		};

		right_green {
			label = "led1:green:brick-status";
			/* GP6[14] */
			gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "default-on";
		};
	};

	/*
	 * The EV3 is powered down by turning off the main 5V supply.
	 */
	gpio-poweroff {
		compatible = "gpio-poweroff";
		gpios = <&gpio 107 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&system_power_pin>;
	};

	sound {
		compatible = "pwm-beeper";
		pinctrl-names = "default";
		pinctrl-0 = <&ehrpwm0b_pins>;
		pwms = <&ehrpwm0 1 1000000 0>;
		amp-supply = <&amp>;
	};

	/*
	 * This is a 5V current limiting regulator that is shared by USB,
	 * the sensor (input) ports, the motor (output) ports and the A/DC.
	 */
	vcc5v: regulator1 {
		pinctrl-names = "default";
		pinctrl-0 = <&vcc5v_pins>;
		compatible = "regulator-fixed";
		regulator-name = "vcc5v";
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
		gpio = <&gpio 101 0>;
		over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
		enable-active-high;
		regulator-boot-on;
	};

	/*
	 * This is a simple voltage divider on VCC5V to provide a 2.5V
	 * reference signal to the ADC.
	 */
	adc_ref: regulator2 {
		compatible = "regulator-fixed";
		regulator-name = "adc ref";
		regulator-min-microvolt = <2500000>;
		regulator-max-microvolt = <2500000>;
		regulator-boot-on;
		vin-supply = <&vcc5v>;
	};

	/*
	 * This is the amplifier for the speaker.
	 */
	amp: regulator3 {
		pinctrl-names = "default";
		pinctrl-0 = <&amp_pins>;
		compatible = "regulator-fixed";
		regulator-name = "amp";
		gpio = <&gpio 111 GPIO_ACTIVE_HIGH>;
		enable-active-high;
	};

	/*
	 * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack.
	 */
	battery {
		pinctrl-names = "default";
		pinctrl-0 = <&battery_pins>;
		compatible = "lego,ev3-battery";
		io-channels = <&adc 4>, <&adc 3>;
		io-channel-names = "voltage", "current";
		rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
	};
};

&pmx_core {
	status = "okay";

	mmc0_cd_pin: pinmux_mmc0_cd {
		pinctrl-single,bits = <
			/* GP5[14] */
			0x2C 0x00000080 0x000000f0
		>;
	};

	button_pins: pinmux_button_pins {
		pinctrl-single,bits = <
			/* GP1[13] */
			0x8 0x00000800 0x00000f00
			/* GP6[10] */
			0x34 0x00800000 0x00f00000
			/* GP6[6] */
			0x38 0x00000080 0x000000f0
			/* GP7[12], GP7[14], GP7[15] */
			0x40 0x00808800 0x00f0ff00
		>;
	};

	led_pins: pinmux_led_pins {
		pinctrl-single,bits = <
			/* GP6[12], GP6[13], GP6[14] */
			0x34 0x00008880 0x0000fff0
			/* GP6[7] */
			0x38 0x00000008 0x0000000f
		>;
	};

	system_power_pin: pinmux_system_power {
		pinctrl-single,bits = <
			/* GP6[11] */
			0x34 0x00080000 0x000f0000
		>;
	};

	vcc5v_pins: pinmux_vcc5v {
		pinctrl-single,bits = <
			/* GP6[5] */
			0x40 0x00000080 0x000000f0
			/* GP6[3] */
			0x4c 0x00008000 0x0000f000
		>;
	};

	amp_pins: pinmux_amp_pins {
		pinctrl-single,bits = <
			/* GP6[15] */
			0x34 0x00000008 0x0000000f
		>;
	};

	battery_pins: pinmux_battery_pins {
		pinctrl-single,bits = <
			/* GP0[6] */
			0x04 0x00000080 0x000000f0
			/* GP8[8] */
			0x4c 0x00000080 0x000000f0
		>;
	};

	ev3_lcd_pins: pinmux_lcd {
		pinctrl-single,bits = <
			/* SIMO, GP2[11], GP2[12], CLK */
			0x14 0x00188100 0x00ffff00
			/* GP5[0] */
			0x30 0x80000000 0xf0000000
		>;
	};
};

&pinconf {
	status = "okay";

	/* Buttons have external pulldown resistors */
	button_bias: button-bias-groups {
		disable {
			groups = "cp5", "cp24", "cp25", "cp28";
			bias-disable;
		};
	};
};

/* Input port 1 */
&serial1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&serial1_rxtx_pins>;
};

&rtc0 {
	status = "okay";
};

&i2c0 {
	status = "okay";
	clock-frequency = <400000>;
	pinctrl-names = "default";
	pinctrl-0 = <&i2c0_pins>;

	/*
	 * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
	 */
	eeprom@50 {
		compatible = "microchip,24c128";
		pagesize = <64>;
		read-only;
		reg = <0x50>;
	};
};

&wdt {
	status = "okay";
};

&mmc0 {
	status = "okay";
	max-frequency = <50000000>;
	bus-width = <4>;
	cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
	pinctrl-names = "default";
	pinctrl-0 = <&mmc0_pins>, <&mmc0_cd_pin>;
};

&spi0 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;

	flash@0 {
		compatible = "n25q128a13", "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <50000000>;
		ti,spi-wdelay = <8>;

		/* Partitions are based on the official firmware from LEGO */
		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
				label = "U-Boot";
				reg = <0 0x40000>;
			};

			partition@40000 {
				label = "U-Boot Env";
				reg = <0x40000 0x10000>;
			};

			partition@50000 {
				label = "Kernel";
				reg = <0x50000 0x200000>;
			};

			partition@250000 {
				label = "Filesystem";
				reg = <0x250000 0xa50000>;
			};

			partition@cb0000 {
				label = "Storage";
				reg = <0xcb0000 0x2f0000>;
			};
		};
	};

	adc: adc@3 {
		compatible = "ti,ads7957";
		reg = <3>;
		#io-channel-cells = <1>;
		spi-max-frequency = <10000000>;
		vref-supply = <&adc_ref>;
	};
};

&spi1 {
	status = "okay";
	pinctrl-0 = <&ev3_lcd_pins>;
	pinctrl-names = "default";
	cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;

	display@0{
		compatible = "lego,ev3-lcd";
		reg = <0>;
		spi-max-frequency = <10000000>;
		a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
		reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
	};
};

&ehrpwm0 {
	status = "okay";
};

&gpio {
	status = "okay";

	/* Don't pull down battery voltage adc io channel */
	batt_volt_en {
		gpio-hog;
		gpios = <6 GPIO_ACTIVE_HIGH>;
		output-high;
	};
};

&usb_phy {
	status = "okay";
};

&usb0 {
	status = "okay";
};

&usb1 {
	status = "okay";
	vbus-supply = <&vcc5v>;
};