1 // SPDX-License-Identifier: GPL-2.0-only
3 * Device tree for LEGO MINDSTORMS EV3
5 * Copyright (C) 2017 David Lechner <david@lechnology.com>
9 #include <dt-bindings/gpio/gpio.h>
10 #include <dt-bindings/input/linux-event-codes.h>
11 #include <dt-bindings/pwm/pwm.h>
16 compatible = "lego,ev3", "ti,da850";
17 model = "LEGO MINDSTORMS EV3";
24 device_type = "memory";
25 reg = <0xc0000000 0x04000000>;
29 * The buttons on the EV3 are mapped to keyboard keys.
32 compatible = "gpio-keys";
33 label = "EV3 Brick Buttons";
34 pinctrl-names = "default";
35 pinctrl-0 = <&button_bias>;
39 linux,code = <KEY_ENTER>;
40 gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
45 linux,code = <KEY_LEFT>;
46 gpios = <&gpio 102 GPIO_ACTIVE_HIGH>;
51 linux,code = <KEY_BACKSPACE>;
52 gpios = <&gpio 106 GPIO_ACTIVE_HIGH>;
57 linux,code = <KEY_RIGHT>;
58 gpios = <&gpio 124 GPIO_ACTIVE_HIGH>;
63 linux,code = <KEY_DOWN>;
64 gpios = <&gpio 126 GPIO_ACTIVE_HIGH>;
69 linux,code = <KEY_UP>;
70 gpios = <&gpio 127 GPIO_ACTIVE_HIGH>;
75 * The EV3 has two built-in bi-color LEDs behind the buttons.
78 compatible = "gpio-leds";
81 label = "led0:green:brick-status";
83 gpios = <&gpio 103 GPIO_ACTIVE_HIGH>;
84 linux,default-trigger = "default-on";
88 label = "led1:red:brick-status";
90 gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
91 linux,default-trigger = "default-on";
95 label = "led0:red:brick-status";
97 gpios = <&gpio 109 GPIO_ACTIVE_HIGH>;
98 linux,default-trigger = "default-on";
102 label = "led1:green:brick-status";
104 gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
105 linux,default-trigger = "default-on";
110 * The EV3 is powered down by turning off the main 5V supply.
113 compatible = "gpio-poweroff";
114 gpios = <&gpio 107 GPIO_ACTIVE_LOW>;
118 compatible = "pwm-beeper";
119 pinctrl-names = "default";
120 pinctrl-0 = <&ehrpwm0b_pins>;
121 pwms = <&ehrpwm0 1 1000000 0>;
126 compatible = "regulator-fixed";
127 regulator-name = "cvdd";
128 regulator-min-microvolt = <1200000>;
129 regulator-max-microvolt = <1200000>;
135 * This is a 5V current limiting regulator that is shared by USB,
136 * the sensor (input) ports, the motor (output) ports and the A/DC.
139 compatible = "regulator-fixed";
140 regulator-name = "vcc5v";
141 regulator-min-microvolt = <5000000>;
142 regulator-max-microvolt = <5000000>;
143 gpio = <&gpio 101 0>;
144 over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
150 * This is a simple voltage divider on VCC5V to provide a 2.5V
151 * reference signal to the ADC.
153 adc_ref: regulator2 {
154 compatible = "regulator-fixed";
155 regulator-name = "adc ref";
156 regulator-min-microvolt = <2500000>;
157 regulator-max-microvolt = <2500000>;
159 vin-supply = <&vcc5v>;
163 * This is the amplifier for the speaker.
166 compatible = "regulator-fixed";
167 regulator-name = "amp";
168 gpio = <&gpio 111 GPIO_ACTIVE_HIGH>;
173 * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack.
176 compatible = "lego,ev3-battery";
177 io-channels = <&adc 4>, <&adc 3>;
178 io-channel-names = "voltage", "current";
179 rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
182 bt_slow_clk: bt-clock {
183 pinctrl-names = "default";
184 pinctrl-0 = <&ecap2_pins>, <&bt_clock_bias>;
185 compatible = "pwm-clock";
187 clock-frequency = <32768>;
188 pwms = <&ecap2 0 30518 0>;
193 compatible = "syscon", "simple-mfd";
194 reg = <0xffff0000 0x2000>; /* 8k */
197 * The I2C bootloader looks for this magic value to either
198 * boot normally or boot into a firmware update mode.
201 compatible = "syscon-reboot-mode";
203 mode-normal = <0x00000000>;
204 mode-loader = <0x5555aaaa>;
210 clock-frequency = <24000000>;
214 cpu-supply = <&cvdd>;
217 /* since we have a fixed regulator, we can't run at these points */
227 * The SoC is actually the 456MHz version, but because of the fixed regulator
228 * This is the fastest we can go.
237 ev3_lcd_pins: pinmux_lcd {
238 pinctrl-single,bits = <
240 0x14 0x00100100 0x00f00f00
248 /* Buttons have external pulldown resistors */
249 button_bias: button-bias-groups {
251 groups = "cp5", "cp24", "cp25", "cp28";
256 bt_clock_bias: bt-clock-bias-groups {
263 bt_pic_bias: bt-pic-bias-groups {
274 pinctrl-names = "default";
275 pinctrl-0 = <&serial1_rxtx_pins>;
279 pinctrl-names = "default";
280 pinctrl-0 = <&serial2_rxtx_pins>, <&serial2_rtscts_pins>, <&bt_pic_bias>;
284 compatible = "ti,cc2560";
285 clocks = <&bt_slow_clk>;
286 clock-names = "ext_clock";
287 enable-gpios = <&gpio 73 GPIO_ACTIVE_HIGH>;
288 max-speed = <2000000>;
289 nvmem-cells = <&bdaddr>;
290 nvmem-cell-names = "bd-address";
300 clock-frequency = <400000>;
301 pinctrl-names = "default";
302 pinctrl-0 = <&i2c0_pins>;
305 * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
308 compatible = "microchip,24c128", "atmel,24c128";
312 #address-cells = <1>;
315 bdaddr: bdaddr@3f06 {
327 max-frequency = <50000000>;
329 cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
330 pinctrl-names = "default";
331 pinctrl-0 = <&mmc0_pins>;
336 pinctrl-names = "default";
337 pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
340 compatible = "n25q128a13", "jedec,spi-nor";
342 spi-max-frequency = <50000000>;
345 /* Partitions are based on the official firmware from LEGO */
347 compatible = "fixed-partitions";
348 #address-cells = <1>;
357 label = "U-Boot Env";
358 reg = <0x40000 0x10000>;
363 reg = <0x50000 0x200000>;
367 label = "Filesystem";
368 reg = <0x250000 0xa50000>;
373 reg = <0xcb0000 0x2f0000>;
379 compatible = "ti,ads7957";
381 #io-channel-cells = <1>;
382 spi-max-frequency = <1000000>;
383 ti,spi-wdelay = <63>;
384 vref-supply = <&adc_ref>;
390 pinctrl-0 = <&ev3_lcd_pins>;
391 pinctrl-names = "default";
392 cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
395 compatible = "lego,ev3-lcd";
397 spi-max-frequency = <10000000>;
398 a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
399 reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
414 /* Don't pull down battery voltage adc io channel */
417 gpios = <6 GPIO_ACTIVE_HIGH>;
421 /* Don't impede Bluetooth clock signal */
424 gpios = <5 GPIO_ACTIVE_HIGH>;
429 * There is a PIC microcontroller for interfacing with an Apple MFi
430 * chip. This interferes with normal Bluetooth operation, so we need
431 * to make sure it is turned off. Note: The publicly available
432 * schematics from LEGO don't show that these pins are connected to
433 * anything, but they are present in the source code from LEGO.
438 gpios = <51 GPIO_ACTIVE_HIGH>;
444 gpios = <78 GPIO_ACTIVE_HIGH>;
450 gpios = <87 GPIO_ACTIVE_HIGH>;
465 vbus-supply = <&vcc5v>;