Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Device tree for LEGO MINDSTORMS EV3
0004  *
0005  * Copyright (C) 2017 David Lechner <david@lechnology.com>
0006  */
0007 
0008 /dts-v1/;
0009 #include <dt-bindings/gpio/gpio.h>
0010 #include <dt-bindings/input/linux-event-codes.h>
0011 #include <dt-bindings/pwm/pwm.h>
0012 
0013 #include "da850.dtsi"
0014 
0015 / {
0016         compatible = "lego,ev3", "ti,da850";
0017         model = "LEGO MINDSTORMS EV3";
0018 
0019         aliases {
0020                 serial1 = &serial1;
0021         };
0022 
0023         memory@c0000000 {
0024                 device_type = "memory";
0025                 reg = <0xc0000000 0x04000000>;
0026         };
0027 
0028         /*
0029          * The buttons on the EV3 are mapped to keyboard keys.
0030          */
0031         gpio_keys {
0032                 compatible = "gpio-keys";
0033                 label = "EV3 Brick Buttons";
0034                 pinctrl-names = "default";
0035                 pinctrl-0 = <&button_bias>;
0036 
0037                 center {
0038                         label = "Center";
0039                         linux,code = <KEY_ENTER>;
0040                         gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
0041                 };
0042 
0043                 left {
0044                         label = "Left";
0045                         linux,code = <KEY_LEFT>;
0046                         gpios = <&gpio 102 GPIO_ACTIVE_HIGH>;
0047                 };
0048 
0049                 back {
0050                         label = "Back";
0051                         linux,code = <KEY_BACKSPACE>;
0052                         gpios = <&gpio 106 GPIO_ACTIVE_HIGH>;
0053                 };
0054 
0055                 right {
0056                         label = "Right";
0057                         linux,code = <KEY_RIGHT>;
0058                         gpios = <&gpio 124 GPIO_ACTIVE_HIGH>;
0059                 };
0060 
0061                 down {
0062                         label = "Down";
0063                         linux,code = <KEY_DOWN>;
0064                         gpios = <&gpio 126 GPIO_ACTIVE_HIGH>;
0065                 };
0066 
0067                 up {
0068                         label = "Up";
0069                         linux,code = <KEY_UP>;
0070                         gpios = <&gpio 127 GPIO_ACTIVE_HIGH>;
0071                 };
0072         };
0073 
0074         /*
0075          * The EV3 has two built-in bi-color LEDs behind the buttons.
0076          */
0077         leds {
0078                 compatible = "gpio-leds";
0079 
0080                 left_green {
0081                         label = "led0:green:brick-status";
0082                         /* GP6[13] */
0083                         gpios = <&gpio 103 GPIO_ACTIVE_HIGH>;
0084                         linux,default-trigger = "default-on";
0085                 };
0086 
0087                 right_red {
0088                         label = "led1:red:brick-status";
0089                         /* GP6[7] */
0090                         gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
0091                         linux,default-trigger = "default-on";
0092                 };
0093 
0094                 left_red {
0095                         label = "led0:red:brick-status";
0096                         /* GP6[12] */
0097                         gpios = <&gpio 109 GPIO_ACTIVE_HIGH>;
0098                         linux,default-trigger = "default-on";
0099                 };
0100 
0101                 right_green {
0102                         label = "led1:green:brick-status";
0103                         /* GP6[14] */
0104                         gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
0105                         linux,default-trigger = "default-on";
0106                 };
0107         };
0108 
0109         /*
0110          * The EV3 is powered down by turning off the main 5V supply.
0111          */
0112         gpio-poweroff {
0113                 compatible = "gpio-poweroff";
0114                 gpios = <&gpio 107 GPIO_ACTIVE_LOW>;
0115         };
0116 
0117         sound {
0118                 compatible = "pwm-beeper";
0119                 pinctrl-names = "default";
0120                 pinctrl-0 = <&ehrpwm0b_pins>;
0121                 pwms = <&ehrpwm0 1 1000000 0>;
0122                 amp-supply = <&amp>;
0123         };
0124 
0125         cvdd: regulator0 {
0126                 compatible = "regulator-fixed";
0127                 regulator-name = "cvdd";
0128                 regulator-min-microvolt = <1200000>;
0129                 regulator-max-microvolt = <1200000>;
0130                 regulator-always-on;
0131                 regulator-boot-on;
0132         };
0133 
0134         /*
0135          * This is a 5V current limiting regulator that is shared by USB,
0136          * the sensor (input) ports, the motor (output) ports and the A/DC.
0137          */
0138         vcc5v: regulator1 {
0139                 compatible = "regulator-fixed";
0140                 regulator-name = "vcc5v";
0141                 regulator-min-microvolt = <5000000>;
0142                 regulator-max-microvolt = <5000000>;
0143                 gpio = <&gpio 101 0>;
0144                 over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
0145                 enable-active-high;
0146                 regulator-boot-on;
0147         };
0148 
0149         /*
0150          * This is a simple voltage divider on VCC5V to provide a 2.5V
0151          * reference signal to the ADC.
0152          */
0153         adc_ref: regulator2 {
0154                 compatible = "regulator-fixed";
0155                 regulator-name = "adc ref";
0156                 regulator-min-microvolt = <2500000>;
0157                 regulator-max-microvolt = <2500000>;
0158                 regulator-boot-on;
0159                 vin-supply = <&vcc5v>;
0160         };
0161 
0162         /*
0163          * This is the amplifier for the speaker.
0164          */
0165         amp: regulator3 {
0166                 compatible = "regulator-fixed";
0167                 regulator-name = "amp";
0168                 gpio = <&gpio 111 GPIO_ACTIVE_HIGH>;
0169                 enable-active-high;
0170         };
0171 
0172         /*
0173          * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack.
0174          */
0175         battery {
0176                 compatible = "lego,ev3-battery";
0177                 io-channels = <&adc 4>, <&adc 3>;
0178                 io-channel-names = "voltage", "current";
0179                 rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
0180         };
0181 
0182         bt_slow_clk: bt-clock {
0183                 pinctrl-names = "default";
0184                 pinctrl-0 = <&ecap2_pins>, <&bt_clock_bias>;
0185                 compatible = "pwm-clock";
0186                 #clock-cells = <0>;
0187                 clock-frequency = <32768>;
0188                 pwms = <&ecap2 0 30518 0>;
0189         };
0190 
0191         /* ARM local RAM */
0192         memory@ffff0000 {
0193                 compatible = "syscon", "simple-mfd";
0194                 reg = <0xffff0000 0x2000>; /* 8k */
0195 
0196                 /*
0197                  * The I2C bootloader looks for this magic value to either
0198                  * boot normally or boot into a firmware update mode.
0199                  */
0200                 reboot-mode {
0201                         compatible = "syscon-reboot-mode";
0202                         offset = <0x1ffc>;
0203                         mode-normal = <0x00000000>;
0204                         mode-loader = <0x5555aaaa>;
0205                 };
0206         };
0207 };
0208 
0209 &ref_clk {
0210         clock-frequency = <24000000>;
0211 };
0212 
0213 &cpu {
0214         cpu-supply = <&cvdd>;
0215 };
0216 
0217 /* since we have a fixed regulator, we can't run at these points */
0218 &opp_100 {
0219         status = "disabled";
0220 };
0221 
0222 &opp_200 {
0223         status = "disabled";
0224 };
0225 
0226 /*
0227  * The SoC is actually the 456MHz version, but because of the fixed regulator
0228  * This is the fastest we can go.
0229  */
0230 &opp_375 {
0231         status = "okay";
0232 };
0233 
0234 &pmx_core {
0235         status = "okay";
0236 
0237         ev3_lcd_pins: pinmux_lcd {
0238                 pinctrl-single,bits = <
0239                         /* SIMO, CLK */
0240                         0x14 0x00100100 0x00f00f00
0241                 >;
0242         };
0243 };
0244 
0245 &pinconf {
0246         status = "okay";
0247 
0248         /* Buttons have external pulldown resistors */
0249         button_bias: button-bias-groups {
0250                 disable {
0251                         groups = "cp5", "cp24", "cp25", "cp28";
0252                         bias-disable;
0253                 };
0254         };
0255 
0256         bt_clock_bias: bt-clock-bias-groups {
0257                 disable {
0258                         groups = "cp2";
0259                         bias-disable;
0260                 };
0261         };
0262 
0263         bt_pic_bias: bt-pic-bias-groups {
0264                 disable {
0265                         groups = "cp20";
0266                         bias-disable;
0267                 };
0268         };
0269 };
0270 
0271 /* Input port 1 */
0272 &serial1 {
0273         status = "okay";
0274         pinctrl-names = "default";
0275         pinctrl-0 = <&serial1_rxtx_pins>;
0276 };
0277 
0278 &serial2 {
0279         pinctrl-names = "default";
0280         pinctrl-0 = <&serial2_rxtx_pins>, <&serial2_rtscts_pins>, <&bt_pic_bias>;
0281         status = "okay";
0282 
0283         bluetooth {
0284                 compatible = "ti,cc2560";
0285                 clocks = <&bt_slow_clk>;
0286                 clock-names = "ext_clock";
0287                 enable-gpios = <&gpio 73 GPIO_ACTIVE_HIGH>;
0288                 max-speed = <2000000>;
0289                 nvmem-cells = <&bdaddr>;
0290                 nvmem-cell-names = "bd-address";
0291         };
0292 };
0293 
0294 &rtc0 {
0295         status = "okay";
0296 };
0297 
0298 &i2c0 {
0299         status = "okay";
0300         clock-frequency = <400000>;
0301         pinctrl-names = "default";
0302         pinctrl-0 = <&i2c0_pins>;
0303 
0304         /*
0305          * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
0306          */
0307         eeprom@50 {
0308                 compatible = "microchip,24c128", "atmel,24c128";
0309                 pagesize = <64>;
0310                 read-only;
0311                 reg = <0x50>;
0312                 #address-cells = <1>;
0313                 #size-cells = <1>;
0314 
0315                 bdaddr: bdaddr@3f06 {
0316                         reg = <0x3f06 0x06>;
0317                 };
0318         };
0319 };
0320 
0321 &wdt {
0322         status = "okay";
0323 };
0324 
0325 &mmc0 {
0326         status = "okay";
0327         max-frequency = <50000000>;
0328         bus-width = <4>;
0329         cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
0330         pinctrl-names = "default";
0331         pinctrl-0 = <&mmc0_pins>;
0332 };
0333 
0334 &spi0 {
0335         status = "okay";
0336         pinctrl-names = "default";
0337         pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
0338 
0339         flash@0 {
0340                 compatible = "n25q128a13", "jedec,spi-nor";
0341                 reg = <0>;
0342                 spi-max-frequency = <50000000>;
0343                 ti,spi-wdelay = <8>;
0344 
0345                 /* Partitions are based on the official firmware from LEGO */
0346                 partitions {
0347                         compatible = "fixed-partitions";
0348                         #address-cells = <1>;
0349                         #size-cells = <1>;
0350 
0351                         partition@0 {
0352                                 label = "U-Boot";
0353                                 reg = <0 0x40000>;
0354                         };
0355 
0356                         partition@40000 {
0357                                 label = "U-Boot Env";
0358                                 reg = <0x40000 0x10000>;
0359                         };
0360 
0361                         partition@50000 {
0362                                 label = "Kernel";
0363                                 reg = <0x50000 0x200000>;
0364                         };
0365 
0366                         partition@250000 {
0367                                 label = "Filesystem";
0368                                 reg = <0x250000 0xa50000>;
0369                         };
0370 
0371                         partition@cb0000 {
0372                                 label = "Storage";
0373                                 reg = <0xcb0000 0x2f0000>;
0374                         };
0375                 };
0376         };
0377 
0378         adc: adc@3 {
0379                 compatible = "ti,ads7957";
0380                 reg = <3>;
0381                 #io-channel-cells = <1>;
0382                 spi-max-frequency = <1000000>;
0383                 ti,spi-wdelay = <63>;
0384                 vref-supply = <&adc_ref>;
0385         };
0386 };
0387 
0388 &spi1 {
0389         status = "okay";
0390         pinctrl-0 = <&ev3_lcd_pins>;
0391         pinctrl-names = "default";
0392         cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
0393 
0394         display@0{
0395                 compatible = "lego,ev3-lcd";
0396                 reg = <0>;
0397                 spi-max-frequency = <10000000>;
0398                 a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
0399                 reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
0400         };
0401 };
0402 
0403 &ecap2 {
0404         status = "okay";
0405 };
0406 
0407 &ehrpwm0 {
0408         status = "okay";
0409 };
0410 
0411 &gpio {
0412         status = "okay";
0413 
0414         /* Don't pull down battery voltage adc io channel */
0415         batt_volt_en {
0416                 gpio-hog;
0417                 gpios = <6 GPIO_ACTIVE_HIGH>;
0418                 output-high;
0419         };
0420 
0421         /* Don't impede Bluetooth clock signal */
0422         bt_clock_en {
0423                 gpio-hog;
0424                 gpios = <5 GPIO_ACTIVE_HIGH>;
0425                 input;
0426         };
0427 
0428         /*
0429          * There is a PIC microcontroller for interfacing with an Apple MFi
0430          * chip. This interferes with normal Bluetooth operation, so we need
0431          * to make sure it is turned off. Note: The publicly available
0432          * schematics from LEGO don't show that these pins are connected to
0433          * anything, but they are present in the source code from LEGO.
0434          */
0435 
0436         bt_pic_en {
0437                 gpio-hog;
0438                 gpios = <51 GPIO_ACTIVE_HIGH>;
0439                 output-low;
0440         };
0441 
0442         bt_pic_rst {
0443                 gpio-hog;
0444                 gpios = <78 GPIO_ACTIVE_HIGH>;
0445                 output-high;
0446         };
0447 
0448         bt_pic_cts {
0449                 gpio-hog;
0450                 gpios = <87 GPIO_ACTIVE_HIGH>;
0451                 input;
0452         };
0453 };
0454 
0455 &usb_phy {
0456         status = "okay";
0457 };
0458 
0459 &usb0 {
0460         status = "okay";
0461 };
0462 
0463 &usb1 {
0464         status = "okay";
0465         vbus-supply = <&vcc5v>;
0466 };