da850-lego-ev3.dts 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Device tree for LEGO MINDSTORMS EV3
  4. *
  5. * Copyright (C) 2017 David Lechner <[email protected]>
  6. */
  7. /dts-v1/;
  8. #include <dt-bindings/gpio/gpio.h>
  9. #include <dt-bindings/input/linux-event-codes.h>
  10. #include <dt-bindings/pwm/pwm.h>
  11. #include "da850.dtsi"
  12. / {
  13. compatible = "lego,ev3", "ti,da850";
  14. model = "LEGO MINDSTORMS EV3";
  15. aliases {
  16. serial1 = &serial1;
  17. };
  18. memory@c0000000 {
  19. device_type = "memory";
  20. reg = <0xc0000000 0x04000000>;
  21. };
  22. /*
  23. * The buttons on the EV3 are mapped to keyboard keys.
  24. */
  25. gpio_keys {
  26. compatible = "gpio-keys";
  27. label = "EV3 Brick Buttons";
  28. pinctrl-names = "default";
  29. pinctrl-0 = <&button_bias>;
  30. center {
  31. label = "Center";
  32. linux,code = <KEY_ENTER>;
  33. gpios = <&gpio 29 GPIO_ACTIVE_HIGH>;
  34. };
  35. left {
  36. label = "Left";
  37. linux,code = <KEY_LEFT>;
  38. gpios = <&gpio 102 GPIO_ACTIVE_HIGH>;
  39. };
  40. back {
  41. label = "Back";
  42. linux,code = <KEY_BACKSPACE>;
  43. gpios = <&gpio 106 GPIO_ACTIVE_HIGH>;
  44. };
  45. right {
  46. label = "Right";
  47. linux,code = <KEY_RIGHT>;
  48. gpios = <&gpio 124 GPIO_ACTIVE_HIGH>;
  49. };
  50. down {
  51. label = "Down";
  52. linux,code = <KEY_DOWN>;
  53. gpios = <&gpio 126 GPIO_ACTIVE_HIGH>;
  54. };
  55. up {
  56. label = "Up";
  57. linux,code = <KEY_UP>;
  58. gpios = <&gpio 127 GPIO_ACTIVE_HIGH>;
  59. };
  60. };
  61. /*
  62. * The EV3 has two built-in bi-color LEDs behind the buttons.
  63. */
  64. leds {
  65. compatible = "gpio-leds";
  66. left_green {
  67. label = "led0:green:brick-status";
  68. /* GP6[13] */
  69. gpios = <&gpio 103 GPIO_ACTIVE_HIGH>;
  70. linux,default-trigger = "default-on";
  71. };
  72. right_red {
  73. label = "led1:red:brick-status";
  74. /* GP6[7] */
  75. gpios = <&gpio 108 GPIO_ACTIVE_HIGH>;
  76. linux,default-trigger = "default-on";
  77. };
  78. left_red {
  79. label = "led0:red:brick-status";
  80. /* GP6[12] */
  81. gpios = <&gpio 109 GPIO_ACTIVE_HIGH>;
  82. linux,default-trigger = "default-on";
  83. };
  84. right_green {
  85. label = "led1:green:brick-status";
  86. /* GP6[14] */
  87. gpios = <&gpio 110 GPIO_ACTIVE_HIGH>;
  88. linux,default-trigger = "default-on";
  89. };
  90. };
  91. /*
  92. * The EV3 is powered down by turning off the main 5V supply.
  93. */
  94. gpio-poweroff {
  95. compatible = "gpio-poweroff";
  96. gpios = <&gpio 107 GPIO_ACTIVE_LOW>;
  97. };
  98. sound {
  99. compatible = "pwm-beeper";
  100. pinctrl-names = "default";
  101. pinctrl-0 = <&ehrpwm0b_pins>;
  102. pwms = <&ehrpwm0 1 1000000 0>;
  103. amp-supply = <&amp>;
  104. };
  105. cvdd: regulator0 {
  106. compatible = "regulator-fixed";
  107. regulator-name = "cvdd";
  108. regulator-min-microvolt = <1200000>;
  109. regulator-max-microvolt = <1200000>;
  110. regulator-always-on;
  111. regulator-boot-on;
  112. };
  113. /*
  114. * This is a 5V current limiting regulator that is shared by USB,
  115. * the sensor (input) ports, the motor (output) ports and the A/DC.
  116. */
  117. vcc5v: regulator1 {
  118. compatible = "regulator-fixed";
  119. regulator-name = "vcc5v";
  120. regulator-min-microvolt = <5000000>;
  121. regulator-max-microvolt = <5000000>;
  122. gpio = <&gpio 101 0>;
  123. over-current-gpios = <&gpio 99 GPIO_ACTIVE_LOW>;
  124. enable-active-high;
  125. regulator-boot-on;
  126. };
  127. /*
  128. * This is a simple voltage divider on VCC5V to provide a 2.5V
  129. * reference signal to the ADC.
  130. */
  131. adc_ref: regulator2 {
  132. compatible = "regulator-fixed";
  133. regulator-name = "adc ref";
  134. regulator-min-microvolt = <2500000>;
  135. regulator-max-microvolt = <2500000>;
  136. regulator-boot-on;
  137. vin-supply = <&vcc5v>;
  138. };
  139. /*
  140. * This is the amplifier for the speaker.
  141. */
  142. amp: regulator3 {
  143. compatible = "regulator-fixed";
  144. regulator-name = "amp";
  145. gpio = <&gpio 111 GPIO_ACTIVE_HIGH>;
  146. enable-active-high;
  147. };
  148. /*
  149. * The EV3 can use 6-AA batteries or a rechargeable Li-ion battery pack.
  150. */
  151. battery {
  152. compatible = "lego,ev3-battery";
  153. io-channels = <&adc 4>, <&adc 3>;
  154. io-channel-names = "voltage", "current";
  155. rechargeable-gpios = <&gpio 136 GPIO_ACTIVE_LOW>;
  156. };
  157. bt_slow_clk: bt-clock {
  158. pinctrl-names = "default";
  159. pinctrl-0 = <&ecap2_pins>, <&bt_clock_bias>;
  160. compatible = "pwm-clock";
  161. #clock-cells = <0>;
  162. clock-frequency = <32768>;
  163. pwms = <&ecap2 0 30518 0>;
  164. };
  165. /* ARM local RAM */
  166. memory@ffff0000 {
  167. compatible = "syscon", "simple-mfd";
  168. reg = <0xffff0000 0x2000>; /* 8k */
  169. /*
  170. * The I2C bootloader looks for this magic value to either
  171. * boot normally or boot into a firmware update mode.
  172. */
  173. reboot-mode {
  174. compatible = "syscon-reboot-mode";
  175. offset = <0x1ffc>;
  176. mode-normal = <0x00000000>;
  177. mode-loader = <0x5555aaaa>;
  178. };
  179. };
  180. };
  181. &ref_clk {
  182. clock-frequency = <24000000>;
  183. };
  184. &cpu {
  185. cpu-supply = <&cvdd>;
  186. };
  187. /* since we have a fixed regulator, we can't run at these points */
  188. &opp_100 {
  189. status = "disabled";
  190. };
  191. &opp_200 {
  192. status = "disabled";
  193. };
  194. /*
  195. * The SoC is actually the 456MHz version, but because of the fixed regulator
  196. * This is the fastest we can go.
  197. */
  198. &opp_375 {
  199. status = "okay";
  200. };
  201. &pmx_core {
  202. status = "okay";
  203. ev3_lcd_pins: pinmux_lcd {
  204. pinctrl-single,bits = <
  205. /* SIMO, CLK */
  206. 0x14 0x00100100 0x00f00f00
  207. >;
  208. };
  209. };
  210. &pinconf {
  211. status = "okay";
  212. /* Buttons have external pulldown resistors */
  213. button_bias: button-bias-groups {
  214. disable {
  215. groups = "cp5", "cp24", "cp25", "cp28";
  216. bias-disable;
  217. };
  218. };
  219. bt_clock_bias: bt-clock-bias-groups {
  220. disable {
  221. groups = "cp2";
  222. bias-disable;
  223. };
  224. };
  225. bt_pic_bias: bt-pic-bias-groups {
  226. disable {
  227. groups = "cp20";
  228. bias-disable;
  229. };
  230. };
  231. };
  232. /* Input port 1 */
  233. &serial1 {
  234. status = "okay";
  235. pinctrl-names = "default";
  236. pinctrl-0 = <&serial1_rxtx_pins>;
  237. };
  238. &serial2 {
  239. pinctrl-names = "default";
  240. pinctrl-0 = <&serial2_rxtx_pins>, <&serial2_rtscts_pins>, <&bt_pic_bias>;
  241. status = "okay";
  242. bluetooth {
  243. compatible = "ti,cc2560";
  244. clocks = <&bt_slow_clk>;
  245. clock-names = "ext_clock";
  246. enable-gpios = <&gpio 73 GPIO_ACTIVE_HIGH>;
  247. max-speed = <2000000>;
  248. nvmem-cells = <&bdaddr>;
  249. nvmem-cell-names = "bd-address";
  250. };
  251. };
  252. &rtc0 {
  253. status = "okay";
  254. };
  255. &i2c0 {
  256. status = "okay";
  257. clock-frequency = <400000>;
  258. pinctrl-names = "default";
  259. pinctrl-0 = <&i2c0_pins>;
  260. /*
  261. * EEPROM contains the first stage bootloader, HW ID and Bluetooth MAC.
  262. */
  263. eeprom@50 {
  264. compatible = "microchip,24c128", "atmel,24c128";
  265. pagesize = <64>;
  266. read-only;
  267. reg = <0x50>;
  268. #address-cells = <1>;
  269. #size-cells = <1>;
  270. bdaddr: bdaddr@3f06 {
  271. reg = <0x3f06 0x06>;
  272. };
  273. };
  274. };
  275. &wdt {
  276. status = "okay";
  277. };
  278. &mmc0 {
  279. status = "okay";
  280. max-frequency = <50000000>;
  281. bus-width = <4>;
  282. cd-gpios = <&gpio 94 GPIO_ACTIVE_LOW>;
  283. pinctrl-names = "default";
  284. pinctrl-0 = <&mmc0_pins>;
  285. };
  286. &spi0 {
  287. status = "okay";
  288. pinctrl-names = "default";
  289. pinctrl-0 = <&spi0_pins>, <&spi0_cs0_pin>, <&spi0_cs3_pin>;
  290. flash@0 {
  291. compatible = "n25q128a13", "jedec,spi-nor";
  292. reg = <0>;
  293. spi-max-frequency = <50000000>;
  294. ti,spi-wdelay = <8>;
  295. /* Partitions are based on the official firmware from LEGO */
  296. partitions {
  297. compatible = "fixed-partitions";
  298. #address-cells = <1>;
  299. #size-cells = <1>;
  300. partition@0 {
  301. label = "U-Boot";
  302. reg = <0 0x40000>;
  303. };
  304. partition@40000 {
  305. label = "U-Boot Env";
  306. reg = <0x40000 0x10000>;
  307. };
  308. partition@50000 {
  309. label = "Kernel";
  310. reg = <0x50000 0x200000>;
  311. };
  312. partition@250000 {
  313. label = "Filesystem";
  314. reg = <0x250000 0xa50000>;
  315. };
  316. partition@cb0000 {
  317. label = "Storage";
  318. reg = <0xcb0000 0x2f0000>;
  319. };
  320. };
  321. };
  322. adc: adc@3 {
  323. compatible = "ti,ads7957";
  324. reg = <3>;
  325. #io-channel-cells = <1>;
  326. spi-max-frequency = <1000000>;
  327. ti,spi-wdelay = <63>;
  328. vref-supply = <&adc_ref>;
  329. };
  330. };
  331. &spi1 {
  332. status = "okay";
  333. pinctrl-0 = <&ev3_lcd_pins>;
  334. pinctrl-names = "default";
  335. cs-gpios = <&gpio 44 GPIO_ACTIVE_LOW>;
  336. display@0{
  337. compatible = "lego,ev3-lcd";
  338. reg = <0>;
  339. spi-max-frequency = <10000000>;
  340. a0-gpios = <&gpio 43 GPIO_ACTIVE_HIGH>;
  341. reset-gpios = <&gpio 80 GPIO_ACTIVE_HIGH>;
  342. };
  343. };
  344. &ecap2 {
  345. status = "okay";
  346. };
  347. &ehrpwm0 {
  348. status = "okay";
  349. };
  350. &gpio {
  351. status = "okay";
  352. /* Don't pull down battery voltage adc io channel */
  353. batt_volt_en {
  354. gpio-hog;
  355. gpios = <6 GPIO_ACTIVE_HIGH>;
  356. output-high;
  357. };
  358. /* Don't impede Bluetooth clock signal */
  359. bt_clock_en {
  360. gpio-hog;
  361. gpios = <5 GPIO_ACTIVE_HIGH>;
  362. input;
  363. };
  364. /*
  365. * There is a PIC microcontroller for interfacing with an Apple MFi
  366. * chip. This interferes with normal Bluetooth operation, so we need
  367. * to make sure it is turned off. Note: The publicly available
  368. * schematics from LEGO don't show that these pins are connected to
  369. * anything, but they are present in the source code from LEGO.
  370. */
  371. bt_pic_en {
  372. gpio-hog;
  373. gpios = <51 GPIO_ACTIVE_HIGH>;
  374. output-low;
  375. };
  376. bt_pic_rst {
  377. gpio-hog;
  378. gpios = <78 GPIO_ACTIVE_HIGH>;
  379. output-high;
  380. };
  381. bt_pic_cts {
  382. gpio-hog;
  383. gpios = <87 GPIO_ACTIVE_HIGH>;
  384. input;
  385. };
  386. };
  387. &usb_phy {
  388. status = "okay";
  389. };
  390. &usb0 {
  391. status = "okay";
  392. };
  393. &usb1 {
  394. status = "okay";
  395. vbus-supply = <&vcc5v>;
  396. };