meson-gxm-khadas-vim2.dts 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  2. /*
  3. * Copyright (c) 2017 Martin Blumenstingl <martin.blumenstingl@googlemail.com>.
  4. * Copyright (c) 2017 BayLibre, SAS
  5. * Author: Neil Armstrong <narmstrong@baylibre.com>
  6. */
  7. /dts-v1/;
  8. #include <dt-bindings/input/input.h>
  9. #include <dt-bindings/thermal/thermal.h>
  10. #include "meson-gxm.dtsi"
  11. / {
  12. compatible = "khadas,vim2", "amlogic,s912", "amlogic,meson-gxm";
  13. model = "Khadas VIM2";
  14. aliases {
  15. serial0 = &uart_AO;
  16. serial2 = &uart_AO_B;
  17. };
  18. chosen {
  19. stdout-path = "serial0:115200n8";
  20. };
  21. memory@0 {
  22. device_type = "memory";
  23. reg = <0x0 0x0 0x0 0x80000000>;
  24. };
  25. adc-keys {
  26. compatible = "adc-keys";
  27. io-channels = <&saradc 0>;
  28. io-channel-names = "buttons";
  29. keyup-threshold-microvolt = <1710000>;
  30. button-function {
  31. label = "Function";
  32. linux,code = <KEY_FN>;
  33. press-threshold-microvolt = <10000>;
  34. };
  35. };
  36. emmc_pwrseq: emmc-pwrseq {
  37. compatible = "mmc-pwrseq-emmc";
  38. reset-gpios = <&gpio BOOT_9 GPIO_ACTIVE_LOW>;
  39. };
  40. gpio_fan: gpio-fan {
  41. compatible = "gpio-fan";
  42. gpios = <&gpio GPIODV_14 GPIO_ACTIVE_HIGH
  43. &gpio GPIODV_15 GPIO_ACTIVE_HIGH>;
  44. /* Dummy RPM values since fan is optional */
  45. gpio-fan,speed-map = <0 0
  46. 1 1
  47. 2 2
  48. 3 3>;
  49. #cooling-cells = <2>;
  50. };
  51. gpio-keys-polled {
  52. compatible = "gpio-keys-polled";
  53. poll-interval = <100>;
  54. power-button {
  55. label = "power";
  56. linux,code = <KEY_POWER>;
  57. gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_LOW>;
  58. };
  59. };
  60. hdmi-connector {
  61. compatible = "hdmi-connector";
  62. type = "a";
  63. port {
  64. hdmi_connector_in: endpoint {
  65. remote-endpoint = <&hdmi_tx_tmds_out>;
  66. };
  67. };
  68. };
  69. pwmleds {
  70. compatible = "pwm-leds";
  71. power {
  72. label = "vim:red:power";
  73. pwms = <&pwm_AO_ab 1 7812500 0>;
  74. max-brightness = <255>;
  75. linux,default-trigger = "default-on";
  76. };
  77. };
  78. sdio_pwrseq: sdio-pwrseq {
  79. compatible = "mmc-pwrseq-simple";
  80. reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
  81. clocks = <&wifi32k>;
  82. clock-names = "ext_clock";
  83. };
  84. thermal-zones {
  85. cpu-thermal {
  86. polling-delay-passive = <250>; /* milliseconds */
  87. polling-delay = <1000>; /* milliseconds */
  88. thermal-sensors = <&scpi_sensors 0>;
  89. trips {
  90. cpu_alert0: cpu-alert0 {
  91. temperature = <70000>; /* millicelsius */
  92. hysteresis = <2000>; /* millicelsius */
  93. type = "active";
  94. };
  95. cpu_alert1: cpu-alert1 {
  96. temperature = <80000>; /* millicelsius */
  97. hysteresis = <2000>; /* millicelsius */
  98. type = "passive";
  99. };
  100. };
  101. cooling-maps {
  102. map0 {
  103. trip = <&cpu_alert0>;
  104. cooling-device = <&gpio_fan THERMAL_NO_LIMIT 1>;
  105. };
  106. map1 {
  107. trip = <&cpu_alert1>;
  108. cooling-device = <&gpio_fan 2 THERMAL_NO_LIMIT>,
  109. <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  110. <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  111. <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  112. <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  113. <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  114. <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  115. <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>,
  116. <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
  117. };
  118. };
  119. };
  120. };
  121. hdmi_5v: regulator-hdmi-5v {
  122. compatible = "regulator-fixed";
  123. regulator-name = "HDMI_5V";
  124. regulator-min-microvolt = <5000000>;
  125. regulator-max-microvolt = <5000000>;
  126. gpio = <&gpio GPIOH_3 GPIO_ACTIVE_HIGH>;
  127. enable-active-high;
  128. regulator-always-on;
  129. };
  130. vcc_3v3: regulator-vcc_3v3 {
  131. compatible = "regulator-fixed";
  132. regulator-name = "VCC_3V3";
  133. regulator-min-microvolt = <3300000>;
  134. regulator-max-microvolt = <3300000>;
  135. };
  136. vddio_ao18: regulator-vddio_ao18 {
  137. compatible = "regulator-fixed";
  138. regulator-name = "VDDIO_AO18";
  139. regulator-min-microvolt = <1800000>;
  140. regulator-max-microvolt = <1800000>;
  141. };
  142. vddio_boot: regulator-vddio_boot {
  143. compatible = "regulator-fixed";
  144. regulator-name = "VDDIO_BOOT";
  145. regulator-min-microvolt = <1800000>;
  146. regulator-max-microvolt = <1800000>;
  147. };
  148. vddao_3v3: regulator-vddao_3v3 {
  149. compatible = "regulator-fixed";
  150. regulator-name = "VDDAO_3V3";
  151. regulator-min-microvolt = <3300000>;
  152. regulator-max-microvolt = <3300000>;
  153. };
  154. wifi32k: wifi32k {
  155. compatible = "pwm-clock";
  156. #clock-cells = <0>;
  157. clock-frequency = <32768>;
  158. pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
  159. };
  160. };
  161. &cec_AO {
  162. status = "okay";
  163. pinctrl-0 = <&ao_cec_pins>;
  164. pinctrl-names = "default";
  165. hdmi-phandle = <&hdmi_tx>;
  166. };
  167. &cpu0 {
  168. #cooling-cells = <2>;
  169. };
  170. &cpu1 {
  171. #cooling-cells = <2>;
  172. };
  173. &cpu2 {
  174. #cooling-cells = <2>;
  175. };
  176. &cpu3 {
  177. #cooling-cells = <2>;
  178. };
  179. &cpu4 {
  180. #cooling-cells = <2>;
  181. };
  182. &cpu5 {
  183. #cooling-cells = <2>;
  184. };
  185. &cpu6 {
  186. #cooling-cells = <2>;
  187. };
  188. &cpu7 {
  189. #cooling-cells = <2>;
  190. };
  191. &ethmac {
  192. pinctrl-0 = <&eth_pins>;
  193. pinctrl-names = "default";
  194. /* Select external PHY by default */
  195. phy-handle = <&external_phy>;
  196. amlogic,tx-delay-ns = <2>;
  197. /* External PHY is in RGMII */
  198. phy-mode = "rgmii";
  199. status = "okay";
  200. };
  201. &external_mdio {
  202. external_phy: ethernet-phy@0 {
  203. /* Realtek RTL8211F (0x001cc916) */
  204. reg = <0>;
  205. reset-assert-us = <10000>;
  206. reset-deassert-us = <30000>;
  207. reset-gpios = <&gpio GPIOZ_14 GPIO_ACTIVE_LOW>;
  208. interrupt-parent = <&gpio_intc>;
  209. /* MAC_INTR on GPIOZ_15 */
  210. interrupts = <25 IRQ_TYPE_LEVEL_LOW>;
  211. };
  212. };
  213. &hdmi_tx {
  214. status = "okay";
  215. pinctrl-0 = <&hdmi_hpd_pins>, <&hdmi_i2c_pins>;
  216. pinctrl-names = "default";
  217. hdmi-supply = <&hdmi_5v>;
  218. };
  219. &hdmi_tx_tmds_port {
  220. hdmi_tx_tmds_out: endpoint {
  221. remote-endpoint = <&hdmi_connector_in>;
  222. };
  223. };
  224. &i2c_A {
  225. status = "okay";
  226. pinctrl-0 = <&i2c_a_pins>;
  227. pinctrl-names = "default";
  228. };
  229. &i2c_B {
  230. status = "okay";
  231. pinctrl-0 = <&i2c_b_pins>;
  232. pinctrl-names = "default";
  233. rtc: rtc@51 {
  234. /* has to be enabled manually when a battery is connected: */
  235. status = "disabled";
  236. compatible = "haoyu,hym8563";
  237. reg = <0x51>;
  238. #clock-cells = <0>;
  239. clock-frequency = <32768>;
  240. clock-output-names = "xin32k";
  241. };
  242. };
  243. &ir {
  244. status = "okay";
  245. pinctrl-0 = <&remote_input_ao_pins>;
  246. pinctrl-names = "default";
  247. linux,rc-map-name = "rc-khadas";
  248. };
  249. &pwm_AO_ab {
  250. status = "okay";
  251. pinctrl-0 = <&pwm_ao_a_3_pins>, <&pwm_ao_b_pins>;
  252. pinctrl-names = "default";
  253. clocks = <&clkc CLKID_FCLK_DIV4>;
  254. clock-names = "clkin0";
  255. };
  256. &pwm_ef {
  257. status = "okay";
  258. pinctrl-0 = <&pwm_e_pins>, <&pwm_f_clk_pins>;
  259. pinctrl-names = "default";
  260. clocks = <&clkc CLKID_FCLK_DIV4>;
  261. clock-names = "clkin0";
  262. };
  263. &sd_emmc_a {
  264. status = "okay";
  265. pinctrl-0 = <&sdio_pins>;
  266. pinctrl-1 = <&sdio_clk_gate_pins>;
  267. pinctrl-names = "default", "clk-gate";
  268. #address-cells = <1>;
  269. #size-cells = <0>;
  270. bus-width = <4>;
  271. max-frequency = <50000000>;
  272. non-removable;
  273. disable-wp;
  274. /* WiFi firmware requires power to be kept while in suspend */
  275. keep-power-in-suspend;
  276. mmc-pwrseq = <&sdio_pwrseq>;
  277. vmmc-supply = <&vddao_3v3>;
  278. vqmmc-supply = <&vddio_boot>;
  279. brcmf: wifi@1 {
  280. reg = <1>;
  281. compatible = "brcm,bcm4329-fmac";
  282. };
  283. };
  284. /* SD card */
  285. &sd_emmc_b {
  286. status = "okay";
  287. pinctrl-0 = <&sdcard_pins>;
  288. pinctrl-1 = <&sdcard_clk_gate_pins>;
  289. pinctrl-names = "default", "clk-gate";
  290. bus-width = <4>;
  291. cap-sd-highspeed;
  292. max-frequency = <50000000>;
  293. disable-wp;
  294. cd-gpios = <&gpio CARD_6 GPIO_ACTIVE_LOW>;
  295. vmmc-supply = <&vddao_3v3>;
  296. vqmmc-supply = <&vddio_boot>;
  297. };
  298. /* eMMC */
  299. &sd_emmc_c {
  300. status = "okay";
  301. pinctrl-0 = <&emmc_pins>, <&emmc_ds_pins>;
  302. pinctrl-1 = <&emmc_clk_gate_pins>;
  303. pinctrl-names = "default", "clk-gate";
  304. bus-width = <8>;
  305. cap-mmc-highspeed;
  306. max-frequency = <200000000>;
  307. non-removable;
  308. disable-wp;
  309. mmc-ddr-1_8v;
  310. mmc-hs200-1_8v;
  311. mmc-pwrseq = <&emmc_pwrseq>;
  312. vmmc-supply = <&vcc_3v3>;
  313. vqmmc-supply = <&vddio_boot>;
  314. };
  315. /*
  316. * EMMC_DS pin is shared between SPI NOR CS and eMMC Data Strobe
  317. * Remove emmc_ds_pins from sd_emmc_c pinctrl-0 then spifc can be enabled
  318. */
  319. &spifc {
  320. status = "disabled";
  321. pinctrl-0 = <&nor_pins>;
  322. pinctrl-names = "default";
  323. w25q32: spi-flash@0 {
  324. #address-cells = <1>;
  325. #size-cells = <1>;
  326. compatible = "winbond,w25q16", "jedec,spi-nor";
  327. reg = <0>;
  328. spi-max-frequency = <3000000>;
  329. };
  330. };
  331. /* This one is connected to the Bluetooth module */
  332. &uart_A {
  333. status = "okay";
  334. pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
  335. pinctrl-names = "default";
  336. uart-has-rtscts;
  337. bluetooth {
  338. compatible = "brcm,bcm43438-bt";
  339. shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
  340. max-speed = <2000000>;
  341. clocks = <&wifi32k>;
  342. clock-names = "lpo";
  343. };
  344. };
  345. /* This is brought out on the Linux_RX (18) and Linux_TX (19) pins: */
  346. &uart_AO {
  347. status = "okay";
  348. pinctrl-0 = <&uart_ao_a_pins>;
  349. pinctrl-names = "default";
  350. };
  351. /* This is brought out on the UART_RX_AO_B (15) and UART_TX_AO_B (16) pins: */
  352. &uart_AO_B {
  353. status = "okay";
  354. pinctrl-0 = <&uart_ao_b_pins>;
  355. pinctrl-names = "default";
  356. };
  357. &saradc {
  358. status = "okay";
  359. vref-supply = <&vddio_ao18>;
  360. };
  361. &usb0 {
  362. status = "okay";
  363. };