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 * This is a 5V current limiting regulator that is shared by USB,
127 * the sensor (input) ports, the motor (output) ports and the A/DC.
130 compatible = "regulator-fixed";
131 regulator-name = "vcc5v";
132 regulator-min-microvolt = <5000000>;
133 regulator-max-microvolt = <5000000>;
134 gpio = <&gpio 101 0>;
135 over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
141 * This is a simple voltage divider on VCC5V to provide a 2.5V
142 * reference signal to the ADC.
144 adc_ref: regulator2 {
145 compatible = "regulator-fixed";
146 regulator-name = "adc ref";
147 regulator-min-microvolt = <2500000>;
148 regulator-max-microvolt = <2500000>;
150 vin-supply = <&vcc5v>;
154 * This is the amplifier for the speaker.
157 compatible = "regulator-fixed";
158 regulator-name = "amp";
159 gpio = <&gpio 111 GPIO_ACTIVE_HIGH>;
164 * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack.
167 compatible = "lego,ev3-battery";
168 io-channels = <&adc 4>, <&adc 3>;
169 io-channel-names = "voltage", "current";
170 rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
173 bt_slow_clk: bt-clock {
174 pinctrl-names = "default";
175 pinctrl-0 = <&ecap2_pins>, <&bt_clock_bias>;
176 compatible = "pwm-clock";
178 clock-frequency = <32768>;
179 pwms = <&ecap2 0 30518 0>;
184 compatible = "syscon", "simple-mfd";
185 reg = <0xffff0000 0x2000>; /* 8k */
188 * The I2C bootloader looks for this magic value to either
189 * boot normally or boot into a firmware update mode.
192 compatible = "syscon-reboot-mode";
194 mode-normal = <0x00000000>;
195 mode-loader = <0x5555aaaa>;
201 clock-frequency = <24000000>;
207 ev3_lcd_pins: pinmux_lcd {
208 pinctrl-single,bits = <
210 0x14 0x00100100 0x00f00f00
218 /* Buttons have external pulldown resistors */
219 button_bias: button-bias-groups {
221 groups = "cp5", "cp24", "cp25", "cp28";
226 bt_clock_bias: bt-clock-bias-groups {
233 bt_pic_bias: bt-pic-bias-groups {
244 pinctrl-names = "default";
245 pinctrl-0 = <&serial1_rxtx_pins>;
249 pinctrl-names = "default";
250 pinctrl-0 = <&serial2_rxtx_pins>, <&serial2_rtscts_pins>, <&bt_pic_bias>;
254 compatible = "ti,cc2560";
255 clocks = <&bt_slow_clk>;
256 clock-names = "ext_clock";
257 enable-gpios = <&gpio 73 GPIO_ACTIVE_HIGH>;
258 max-speed = <2000000>;
259 nvmem-cells = <&bdaddr>;
260 nvmem-cell-names = "bd-address";
270 clock-frequency = <400000>;
271 pinctrl-names = "default";
272 pinctrl-0 = <&i2c0_pins>;
275 * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
278 compatible = "microchip,24c128", "atmel,24c128";
282 #address-cells = <1>;
285 bdaddr: bdaddr@3f06 {
297 max-frequency = <50000000>;
299 cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
300 pinctrl-names = "default";
301 pinctrl-0 = <&mmc0_pins>;
306 pinctrl-names = "default";
307 pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
310 compatible = "n25q128a13", "jedec,spi-nor";
312 spi-max-frequency = <50000000>;
315 /* Partitions are based on the official firmware from LEGO */
317 compatible = "fixed-partitions";
318 #address-cells = <1>;
327 label = "U-Boot Env";
328 reg = <0x40000 0x10000>;
333 reg = <0x50000 0x200000>;
337 label = "Filesystem";
338 reg = <0x250000 0xa50000>;
343 reg = <0xcb0000 0x2f0000>;
349 compatible = "ti,ads7957";
351 #io-channel-cells = <1>;
352 spi-max-frequency = <1000000>;
353 ti,spi-wdelay = <63>;
354 vref-supply = <&adc_ref>;
360 pinctrl-0 = <&ev3_lcd_pins>;
361 pinctrl-names = "default";
362 cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
365 compatible = "lego,ev3-lcd";
367 spi-max-frequency = <10000000>;
368 a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
369 reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
384 /* Don't pull down battery voltage adc io channel */
387 gpios = <6 GPIO_ACTIVE_HIGH>;
391 /* Don't impede Bluetooth clock signal */
394 gpios = <5 GPIO_ACTIVE_HIGH>;
399 * There is a PIC microcontroller for interfacing with an Apple MFi
400 * chip. This interferes with normal Bluetooth operation, so we need
401 * to make sure it is turned off. Note: The publicly available
402 * schematics from LEGO don't show that these pins are connected to
403 * anything, but they are present in the source code from LEGO.
408 gpios = <51 GPIO_ACTIVE_HIGH>;
414 gpios = <78 GPIO_ACTIVE_HIGH>;
420 gpios = <87 GPIO_ACTIVE_HIGH>;
435 vbus-supply = <&vcc5v>;