1724ba675SRob Herring// SPDX-License-Identifier: GPL-2.0-only 2724ba675SRob Herring/* 3724ba675SRob Herring * Device tree for LEGO MINDSTORMS EV3 4724ba675SRob Herring * 5724ba675SRob Herring * Copyright (C) 2017 David Lechner <david@lechnology.com> 6724ba675SRob Herring */ 7724ba675SRob Herring 8724ba675SRob Herring/dts-v1/; 9724ba675SRob Herring#include <dt-bindings/gpio/gpio.h> 10724ba675SRob Herring#include <dt-bindings/input/linux-event-codes.h> 11724ba675SRob Herring#include <dt-bindings/pwm/pwm.h> 12724ba675SRob Herring 13724ba675SRob Herring#include "da850.dtsi" 14724ba675SRob Herring 15724ba675SRob Herring/ { 16724ba675SRob Herring compatible = "lego,ev3", "ti,da850"; 17724ba675SRob Herring model = "LEGO MINDSTORMS EV3"; 18724ba675SRob Herring 19724ba675SRob Herring aliases { 20724ba675SRob Herring serial1 = &serial1; 21724ba675SRob Herring }; 22724ba675SRob Herring 23724ba675SRob Herring memory@c0000000 { 24724ba675SRob Herring device_type = "memory"; 25724ba675SRob Herring reg = <0xc0000000 0x04000000>; 26724ba675SRob Herring }; 27724ba675SRob Herring 28724ba675SRob Herring /* 29724ba675SRob Herring * The buttons on the EV3 are mapped to keyboard keys. 30724ba675SRob Herring */ 31724ba675SRob Herring gpio_keys { 32724ba675SRob Herring compatible = "gpio-keys"; 33724ba675SRob Herring label = "EV3 Brick Buttons"; 34724ba675SRob Herring pinctrl-names = "default"; 35724ba675SRob Herring pinctrl-0 = <&button_bias>; 36724ba675SRob Herring 37724ba675SRob Herring center { 38724ba675SRob Herring label = "Center"; 39724ba675SRob Herring linux,code = <KEY_ENTER>; 40724ba675SRob Herring gpios = <&gpio 29 GPIO_ACTIVE_HIGH>; 41724ba675SRob Herring }; 42724ba675SRob Herring 43724ba675SRob Herring left { 44724ba675SRob Herring label = "Left"; 45724ba675SRob Herring linux,code = <KEY_LEFT>; 46724ba675SRob Herring gpios = <&gpio 102 GPIO_ACTIVE_HIGH>; 47724ba675SRob Herring }; 48724ba675SRob Herring 49724ba675SRob Herring back { 50724ba675SRob Herring label = "Back"; 51724ba675SRob Herring linux,code = <KEY_BACKSPACE>; 52724ba675SRob Herring gpios = <&gpio 106 GPIO_ACTIVE_HIGH>; 53724ba675SRob Herring }; 54724ba675SRob Herring 55724ba675SRob Herring right { 56724ba675SRob Herring label = "Right"; 57724ba675SRob Herring linux,code = <KEY_RIGHT>; 58724ba675SRob Herring gpios = <&gpio 124 GPIO_ACTIVE_HIGH>; 59724ba675SRob Herring }; 60724ba675SRob Herring 61724ba675SRob Herring down { 62724ba675SRob Herring label = "Down"; 63724ba675SRob Herring linux,code = <KEY_DOWN>; 64724ba675SRob Herring gpios = <&gpio 126 GPIO_ACTIVE_HIGH>; 65724ba675SRob Herring }; 66724ba675SRob Herring 67724ba675SRob Herring up { 68724ba675SRob Herring label = "Up"; 69724ba675SRob Herring linux,code = <KEY_UP>; 70724ba675SRob Herring gpios = <&gpio 127 GPIO_ACTIVE_HIGH>; 71724ba675SRob Herring }; 72724ba675SRob Herring }; 73724ba675SRob Herring 74724ba675SRob Herring /* 75724ba675SRob Herring * The EV3 has two built-in bi-color LEDs behind the buttons. 76724ba675SRob Herring */ 77724ba675SRob Herring leds { 78724ba675SRob Herring compatible = "gpio-leds"; 79724ba675SRob Herring 80724ba675SRob Herring left_green { 81724ba675SRob Herring label = "led0:green:brick-status"; 82724ba675SRob Herring /* GP6[13] */ 83724ba675SRob Herring gpios = <&gpio 103 GPIO_ACTIVE_HIGH>; 84724ba675SRob Herring linux,default-trigger = "default-on"; 85724ba675SRob Herring }; 86724ba675SRob Herring 87724ba675SRob Herring right_red { 88724ba675SRob Herring label = "led1:red:brick-status"; 89724ba675SRob Herring /* GP6[7] */ 90724ba675SRob Herring gpios = <&gpio 108 GPIO_ACTIVE_HIGH>; 91724ba675SRob Herring linux,default-trigger = "default-on"; 92724ba675SRob Herring }; 93724ba675SRob Herring 94724ba675SRob Herring left_red { 95724ba675SRob Herring label = "led0:red:brick-status"; 96724ba675SRob Herring /* GP6[12] */ 97724ba675SRob Herring gpios = <&gpio 109 GPIO_ACTIVE_HIGH>; 98724ba675SRob Herring linux,default-trigger = "default-on"; 99724ba675SRob Herring }; 100724ba675SRob Herring 101724ba675SRob Herring right_green { 102724ba675SRob Herring label = "led1:green:brick-status"; 103724ba675SRob Herring /* GP6[14] */ 104724ba675SRob Herring gpios = <&gpio 110 GPIO_ACTIVE_HIGH>; 105724ba675SRob Herring linux,default-trigger = "default-on"; 106724ba675SRob Herring }; 107724ba675SRob Herring }; 108724ba675SRob Herring 109724ba675SRob Herring /* 110724ba675SRob Herring * The EV3 is powered down by turning off the main 5V supply. 111724ba675SRob Herring */ 112724ba675SRob Herring gpio-poweroff { 113724ba675SRob Herring compatible = "gpio-poweroff"; 114724ba675SRob Herring gpios = <&gpio 107 GPIO_ACTIVE_LOW>; 115724ba675SRob Herring }; 116724ba675SRob Herring 117724ba675SRob Herring sound { 118724ba675SRob Herring compatible = "pwm-beeper"; 119724ba675SRob Herring pinctrl-names = "default"; 120724ba675SRob Herring pinctrl-0 = <&ehrpwm0b_pins>; 121724ba675SRob Herring pwms = <&ehrpwm0 1 1000000 0>; 122724ba675SRob Herring amp-supply = <&>; 123724ba675SRob Herring }; 124724ba675SRob Herring 125724ba675SRob Herring cvdd: regulator0 { 126724ba675SRob Herring compatible = "regulator-fixed"; 127724ba675SRob Herring regulator-name = "cvdd"; 128724ba675SRob Herring regulator-min-microvolt = <1200000>; 129724ba675SRob Herring regulator-max-microvolt = <1200000>; 130724ba675SRob Herring regulator-always-on; 131724ba675SRob Herring regulator-boot-on; 132724ba675SRob Herring }; 133724ba675SRob Herring 134724ba675SRob Herring /* 135724ba675SRob Herring * This is a 5V current limiting regulator that is shared by USB, 136724ba675SRob Herring * the sensor (input) ports, the motor (output) ports and the A/DC. 137724ba675SRob Herring */ 138724ba675SRob Herring vcc5v: regulator1 { 139724ba675SRob Herring compatible = "regulator-fixed"; 140724ba675SRob Herring regulator-name = "vcc5v"; 141724ba675SRob Herring regulator-min-microvolt = <5000000>; 142724ba675SRob Herring regulator-max-microvolt = <5000000>; 143724ba675SRob Herring gpio = <&gpio 101 0>; 144724ba675SRob Herring over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>; 145724ba675SRob Herring enable-active-high; 146724ba675SRob Herring regulator-boot-on; 147724ba675SRob Herring }; 148724ba675SRob Herring 149724ba675SRob Herring /* 150724ba675SRob Herring * This is a simple voltage divider on VCC5V to provide a 2.5V 151724ba675SRob Herring * reference signal to the ADC. 152724ba675SRob Herring */ 153724ba675SRob Herring adc_ref: regulator2 { 154724ba675SRob Herring compatible = "regulator-fixed"; 155724ba675SRob Herring regulator-name = "adc ref"; 156724ba675SRob Herring regulator-min-microvolt = <2500000>; 157724ba675SRob Herring regulator-max-microvolt = <2500000>; 158724ba675SRob Herring regulator-boot-on; 159724ba675SRob Herring vin-supply = <&vcc5v>; 160724ba675SRob Herring }; 161724ba675SRob Herring 162724ba675SRob Herring /* 163724ba675SRob Herring * This is the amplifier for the speaker. 164724ba675SRob Herring */ 165724ba675SRob Herring amp: regulator3 { 166724ba675SRob Herring compatible = "regulator-fixed"; 167724ba675SRob Herring regulator-name = "amp"; 168724ba675SRob Herring gpio = <&gpio 111 GPIO_ACTIVE_HIGH>; 169724ba675SRob Herring enable-active-high; 170724ba675SRob Herring }; 171724ba675SRob Herring 172724ba675SRob Herring /* 173724ba675SRob Herring * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack. 174724ba675SRob Herring */ 175724ba675SRob Herring battery { 176724ba675SRob Herring compatible = "lego,ev3-battery"; 177724ba675SRob Herring io-channels = <&adc 4>, <&adc 3>; 178724ba675SRob Herring io-channel-names = "voltage", "current"; 179724ba675SRob Herring rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>; 180724ba675SRob Herring }; 181724ba675SRob Herring 182724ba675SRob Herring bt_slow_clk: bt-clock { 183724ba675SRob Herring pinctrl-names = "default"; 184724ba675SRob Herring pinctrl-0 = <&ecap2_pins>, <&bt_clock_bias>; 185724ba675SRob Herring compatible = "pwm-clock"; 186724ba675SRob Herring #clock-cells = <0>; 187724ba675SRob Herring clock-frequency = <32768>; 188724ba675SRob Herring pwms = <&ecap2 0 30518 0>; 189724ba675SRob Herring }; 190724ba675SRob Herring 191724ba675SRob Herring /* ARM local RAM */ 192724ba675SRob Herring memory@ffff0000 { 193724ba675SRob Herring compatible = "syscon", "simple-mfd"; 194724ba675SRob Herring reg = <0xffff0000 0x2000>; /* 8k */ 195724ba675SRob Herring 196724ba675SRob Herring /* 197724ba675SRob Herring * The I2C bootloader looks for this magic value to either 198724ba675SRob Herring * boot normally or boot into a firmware update mode. 199724ba675SRob Herring */ 200724ba675SRob Herring reboot-mode { 201724ba675SRob Herring compatible = "syscon-reboot-mode"; 202724ba675SRob Herring offset = <0x1ffc>; 203724ba675SRob Herring mode-normal = <0x00000000>; 204724ba675SRob Herring mode-loader = <0x5555aaaa>; 205724ba675SRob Herring }; 206724ba675SRob Herring }; 207724ba675SRob Herring}; 208724ba675SRob Herring 209724ba675SRob Herring&ref_clk { 210724ba675SRob Herring clock-frequency = <24000000>; 211724ba675SRob Herring}; 212724ba675SRob Herring 213724ba675SRob Herring&cpu { 214724ba675SRob Herring cpu-supply = <&cvdd>; 215724ba675SRob Herring}; 216724ba675SRob Herring 217724ba675SRob Herring/* since we have a fixed regulator, we can't run at these points */ 218724ba675SRob Herring&opp_100 { 219724ba675SRob Herring status = "disabled"; 220724ba675SRob Herring}; 221724ba675SRob Herring 222724ba675SRob Herring&opp_200 { 223724ba675SRob Herring status = "disabled"; 224724ba675SRob Herring}; 225724ba675SRob Herring 226724ba675SRob Herring/* 227724ba675SRob Herring * The SoC is actually the 456MHz version, but because of the fixed regulator 228724ba675SRob Herring * This is the fastest we can go. 229724ba675SRob Herring */ 230724ba675SRob Herring&opp_375 { 231724ba675SRob Herring status = "okay"; 232724ba675SRob Herring}; 233724ba675SRob Herring 234724ba675SRob Herring&pmx_core { 235724ba675SRob Herring status = "okay"; 236724ba675SRob Herring 237*d49b1e4fSTony Lindgren ev3_lcd_pins: lcd-pins { 238724ba675SRob Herring pinctrl-single,bits = < 239724ba675SRob Herring /* SIMO, CLK */ 240724ba675SRob Herring 0x14 0x00100100 0x00f00f00 241724ba675SRob Herring >; 242724ba675SRob Herring }; 243724ba675SRob Herring}; 244724ba675SRob Herring 245724ba675SRob Herring&pinconf { 246724ba675SRob Herring status = "okay"; 247724ba675SRob Herring 248724ba675SRob Herring /* Buttons have external pulldown resistors */ 249724ba675SRob Herring button_bias: button-bias-groups { 250724ba675SRob Herring disable { 251724ba675SRob Herring groups = "cp5", "cp24", "cp25", "cp28"; 252724ba675SRob Herring bias-disable; 253724ba675SRob Herring }; 254724ba675SRob Herring }; 255724ba675SRob Herring 256724ba675SRob Herring bt_clock_bias: bt-clock-bias-groups { 257724ba675SRob Herring disable { 258724ba675SRob Herring groups = "cp2"; 259724ba675SRob Herring bias-disable; 260724ba675SRob Herring }; 261724ba675SRob Herring }; 262724ba675SRob Herring 263724ba675SRob Herring bt_pic_bias: bt-pic-bias-groups { 264724ba675SRob Herring disable { 265724ba675SRob Herring groups = "cp20"; 266724ba675SRob Herring bias-disable; 267724ba675SRob Herring }; 268724ba675SRob Herring }; 269724ba675SRob Herring}; 270724ba675SRob Herring 271724ba675SRob Herring/* Input port 1 */ 272724ba675SRob Herring&serial1 { 273724ba675SRob Herring status = "okay"; 274724ba675SRob Herring pinctrl-names = "default"; 275724ba675SRob Herring pinctrl-0 = <&serial1_rxtx_pins>; 276724ba675SRob Herring}; 277724ba675SRob Herring 278724ba675SRob Herring&serial2 { 279724ba675SRob Herring pinctrl-names = "default"; 280724ba675SRob Herring pinctrl-0 = <&serial2_rxtx_pins>, <&serial2_rtscts_pins>, <&bt_pic_bias>; 281724ba675SRob Herring status = "okay"; 282724ba675SRob Herring 283724ba675SRob Herring bluetooth { 284724ba675SRob Herring compatible = "ti,cc2560"; 285724ba675SRob Herring clocks = <&bt_slow_clk>; 286724ba675SRob Herring clock-names = "ext_clock"; 287724ba675SRob Herring enable-gpios = <&gpio 73 GPIO_ACTIVE_HIGH>; 288724ba675SRob Herring max-speed = <2000000>; 289724ba675SRob Herring nvmem-cells = <&bdaddr>; 290724ba675SRob Herring nvmem-cell-names = "bd-address"; 291724ba675SRob Herring }; 292724ba675SRob Herring}; 293724ba675SRob Herring 294724ba675SRob Herring&rtc0 { 295724ba675SRob Herring status = "okay"; 296724ba675SRob Herring}; 297724ba675SRob Herring 298724ba675SRob Herring&i2c0 { 299724ba675SRob Herring status = "okay"; 300724ba675SRob Herring clock-frequency = <400000>; 301724ba675SRob Herring pinctrl-names = "default"; 302724ba675SRob Herring pinctrl-0 = <&i2c0_pins>; 303724ba675SRob Herring 304724ba675SRob Herring /* 305724ba675SRob Herring * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC. 306724ba675SRob Herring */ 307724ba675SRob Herring eeprom@50 { 308724ba675SRob Herring compatible = "microchip,24c128", "atmel,24c128"; 309724ba675SRob Herring pagesize = <64>; 310724ba675SRob Herring read-only; 311724ba675SRob Herring reg = <0x50>; 312724ba675SRob Herring #address-cells = <1>; 313724ba675SRob Herring #size-cells = <1>; 314724ba675SRob Herring 315724ba675SRob Herring bdaddr: bdaddr@3f06 { 316724ba675SRob Herring reg = <0x3f06 0x06>; 317724ba675SRob Herring }; 318724ba675SRob Herring }; 319724ba675SRob Herring}; 320724ba675SRob Herring 321724ba675SRob Herring&wdt { 322724ba675SRob Herring status = "okay"; 323724ba675SRob Herring}; 324724ba675SRob Herring 325724ba675SRob Herring&mmc0 { 326724ba675SRob Herring status = "okay"; 327724ba675SRob Herring max-frequency = <50000000>; 328724ba675SRob Herring bus-width = <4>; 329724ba675SRob Herring cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>; 330724ba675SRob Herring pinctrl-names = "default"; 331724ba675SRob Herring pinctrl-0 = <&mmc0_pins>; 332724ba675SRob Herring}; 333724ba675SRob Herring 334724ba675SRob Herring&spi0 { 335724ba675SRob Herring status = "okay"; 336724ba675SRob Herring pinctrl-names = "default"; 337724ba675SRob Herring pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>; 338724ba675SRob Herring 339724ba675SRob Herring flash@0 { 340724ba675SRob Herring compatible = "n25q128a13", "jedec,spi-nor"; 341724ba675SRob Herring reg = <0>; 342724ba675SRob Herring spi-max-frequency = <50000000>; 343724ba675SRob Herring ti,spi-wdelay = <8>; 344724ba675SRob Herring 345724ba675SRob Herring /* Partitions are based on the official firmware from LEGO */ 346724ba675SRob Herring partitions { 347724ba675SRob Herring compatible = "fixed-partitions"; 348724ba675SRob Herring #address-cells = <1>; 349724ba675SRob Herring #size-cells = <1>; 350724ba675SRob Herring 351724ba675SRob Herring partition@0 { 352724ba675SRob Herring label = "U-Boot"; 353724ba675SRob Herring reg = <0 0x40000>; 354724ba675SRob Herring }; 355724ba675SRob Herring 356724ba675SRob Herring partition@40000 { 357724ba675SRob Herring label = "U-Boot Env"; 358724ba675SRob Herring reg = <0x40000 0x10000>; 359724ba675SRob Herring }; 360724ba675SRob Herring 361724ba675SRob Herring partition@50000 { 362724ba675SRob Herring label = "Kernel"; 363724ba675SRob Herring reg = <0x50000 0x200000>; 364724ba675SRob Herring }; 365724ba675SRob Herring 366724ba675SRob Herring partition@250000 { 367724ba675SRob Herring label = "Filesystem"; 368724ba675SRob Herring reg = <0x250000 0xa50000>; 369724ba675SRob Herring }; 370724ba675SRob Herring 371724ba675SRob Herring partition@cb0000 { 372724ba675SRob Herring label = "Storage"; 373724ba675SRob Herring reg = <0xcb0000 0x2f0000>; 374724ba675SRob Herring }; 375724ba675SRob Herring }; 376724ba675SRob Herring }; 377724ba675SRob Herring 378724ba675SRob Herring adc: adc@3 { 379724ba675SRob Herring compatible = "ti,ads7957"; 380724ba675SRob Herring reg = <3>; 381724ba675SRob Herring #io-channel-cells = <1>; 382724ba675SRob Herring spi-max-frequency = <1000000>; 383724ba675SRob Herring ti,spi-wdelay = <63>; 384724ba675SRob Herring vref-supply = <&adc_ref>; 385724ba675SRob Herring }; 386724ba675SRob Herring}; 387724ba675SRob Herring 388724ba675SRob Herring&spi1 { 389724ba675SRob Herring status = "okay"; 390724ba675SRob Herring pinctrl-0 = <&ev3_lcd_pins>; 391724ba675SRob Herring pinctrl-names = "default"; 392724ba675SRob Herring cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>; 393724ba675SRob Herring 394724ba675SRob Herring display@0{ 395724ba675SRob Herring compatible = "lego,ev3-lcd"; 396724ba675SRob Herring reg = <0>; 397724ba675SRob Herring spi-max-frequency = <10000000>; 398724ba675SRob Herring a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>; 399724ba675SRob Herring reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>; 400724ba675SRob Herring }; 401724ba675SRob Herring}; 402724ba675SRob Herring 403724ba675SRob Herring&ecap2 { 404724ba675SRob Herring status = "okay"; 405724ba675SRob Herring}; 406724ba675SRob Herring 407724ba675SRob Herring&ehrpwm0 { 408724ba675SRob Herring status = "okay"; 409724ba675SRob Herring}; 410724ba675SRob Herring 411724ba675SRob Herring&gpio { 412724ba675SRob Herring status = "okay"; 413724ba675SRob Herring 414724ba675SRob Herring /* Don't pull down battery voltage adc io channel */ 415724ba675SRob Herring batt_volt_en { 416724ba675SRob Herring gpio-hog; 417724ba675SRob Herring gpios = <6 GPIO_ACTIVE_HIGH>; 418724ba675SRob Herring output-high; 419724ba675SRob Herring }; 420724ba675SRob Herring 421724ba675SRob Herring /* Don't impede Bluetooth clock signal */ 422724ba675SRob Herring bt_clock_en { 423724ba675SRob Herring gpio-hog; 424724ba675SRob Herring gpios = <5 GPIO_ACTIVE_HIGH>; 425724ba675SRob Herring input; 426724ba675SRob Herring }; 427724ba675SRob Herring 428724ba675SRob Herring /* 429724ba675SRob Herring * There is a PIC microcontroller for interfacing with an Apple MFi 430724ba675SRob Herring * chip. This interferes with normal Bluetooth operation, so we need 431724ba675SRob Herring * to make sure it is turned off. Note: The publicly available 432724ba675SRob Herring * schematics from LEGO don't show that these pins are connected to 433724ba675SRob Herring * anything, but they are present in the source code from LEGO. 434724ba675SRob Herring */ 435724ba675SRob Herring 436724ba675SRob Herring bt_pic_en { 437724ba675SRob Herring gpio-hog; 438724ba675SRob Herring gpios = <51 GPIO_ACTIVE_HIGH>; 439724ba675SRob Herring output-low; 440724ba675SRob Herring }; 441724ba675SRob Herring 442724ba675SRob Herring bt_pic_rst { 443724ba675SRob Herring gpio-hog; 444724ba675SRob Herring gpios = <78 GPIO_ACTIVE_HIGH>; 445724ba675SRob Herring output-high; 446724ba675SRob Herring }; 447724ba675SRob Herring 448724ba675SRob Herring bt_pic_cts { 449724ba675SRob Herring gpio-hog; 450724ba675SRob Herring gpios = <87 GPIO_ACTIVE_HIGH>; 451724ba675SRob Herring input; 452724ba675SRob Herring }; 453724ba675SRob Herring}; 454724ba675SRob Herring 455724ba675SRob Herring&usb_phy { 456724ba675SRob Herring status = "okay"; 457724ba675SRob Herring}; 458724ba675SRob Herring 459724ba675SRob Herring&usb0 { 460724ba675SRob Herring status = "okay"; 461724ba675SRob Herring}; 462724ba675SRob Herring 463724ba675SRob Herring&usb1 { 464724ba675SRob Herring status = "okay"; 465724ba675SRob Herring vbus-supply = <&vcc5v>; 466724ba675SRob Herring}; 467