meson-khadas-vim3.dtsi 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. // SPDX-License-Identifier: (GPL-2.0+ OR MIT)
  2. /*
  3. * Copyright (c) 2019 BayLibre, SAS
  4. * Author: Neil Armstrong <[email protected]>
  5. * Copyright (c) 2019 Christian Hewitt <[email protected]>
  6. */
  7. #include <dt-bindings/input/input.h>
  8. #include <dt-bindings/leds/common.h>
  9. #include <dt-bindings/gpio/meson-g12a-gpio.h>
  10. #include <dt-bindings/sound/meson-g12a-tohdmitx.h>
  11. / {
  12. aliases {
  13. serial0 = &uart_AO;
  14. ethernet0 = &ethmac;
  15. rtc0 = &rtc;
  16. rtc1 = &vrtc;
  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 2>;
  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. leds {
  37. compatible = "gpio-leds";
  38. led-white {
  39. color = <LED_COLOR_ID_WHITE>;
  40. function = LED_FUNCTION_STATUS;
  41. gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_HIGH>;
  42. linux,default-trigger = "heartbeat";
  43. };
  44. led-red {
  45. color = <LED_COLOR_ID_RED>;
  46. function = LED_FUNCTION_STATUS;
  47. gpios = <&gpio_expander 5 GPIO_ACTIVE_HIGH>;
  48. };
  49. };
  50. emmc_pwrseq: emmc-pwrseq {
  51. compatible = "mmc-pwrseq-emmc";
  52. reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
  53. };
  54. gpio-keys-polled {
  55. compatible = "gpio-keys-polled";
  56. poll-interval = <100>;
  57. power-button {
  58. label = "power";
  59. linux,code = <KEY_POWER>;
  60. gpios = <&gpio_ao GPIOAO_7 GPIO_ACTIVE_LOW>;
  61. };
  62. };
  63. sdio_pwrseq: sdio-pwrseq {
  64. compatible = "mmc-pwrseq-simple";
  65. reset-gpios = <&gpio GPIOX_6 GPIO_ACTIVE_LOW>;
  66. clocks = <&wifi32k>;
  67. clock-names = "ext_clock";
  68. };
  69. dc_in: regulator-dc_in {
  70. compatible = "regulator-fixed";
  71. regulator-name = "DC_IN";
  72. regulator-min-microvolt = <5000000>;
  73. regulator-max-microvolt = <5000000>;
  74. regulator-always-on;
  75. };
  76. vcc_5v: regulator-vcc_5v {
  77. compatible = "regulator-fixed";
  78. regulator-name = "VCC_5V";
  79. regulator-min-microvolt = <5000000>;
  80. regulator-max-microvolt = <5000000>;
  81. vin-supply = <&dc_in>;
  82. gpio = <&gpio GPIOH_8 GPIO_OPEN_DRAIN>;
  83. enable-active-high;
  84. };
  85. vcc_1v8: regulator-vcc_1v8 {
  86. compatible = "regulator-fixed";
  87. regulator-name = "VCC_1V8";
  88. regulator-min-microvolt = <1800000>;
  89. regulator-max-microvolt = <1800000>;
  90. vin-supply = <&vcc_3v3>;
  91. regulator-always-on;
  92. };
  93. vcc_3v3: regulator-vcc_3v3 {
  94. compatible = "regulator-fixed";
  95. regulator-name = "VCC_3V3";
  96. regulator-min-microvolt = <3300000>;
  97. regulator-max-microvolt = <3300000>;
  98. vin-supply = <&vsys_3v3>;
  99. regulator-always-on;
  100. /* FIXME: actually controlled by VDDCPU_B_EN */
  101. };
  102. vddao_1v8: regulator-vddao_1v8 {
  103. compatible = "regulator-fixed";
  104. regulator-name = "VDDIO_AO1V8";
  105. regulator-min-microvolt = <1800000>;
  106. regulator-max-microvolt = <1800000>;
  107. vin-supply = <&vsys_3v3>;
  108. regulator-always-on;
  109. };
  110. emmc_1v8: regulator-emmc_1v8 {
  111. compatible = "regulator-fixed";
  112. regulator-name = "EMMC_AO1V8";
  113. regulator-min-microvolt = <1800000>;
  114. regulator-max-microvolt = <1800000>;
  115. vin-supply = <&vcc_3v3>;
  116. regulator-always-on;
  117. };
  118. vsys_3v3: regulator-vsys_3v3 {
  119. compatible = "regulator-fixed";
  120. regulator-name = "VSYS_3V3";
  121. regulator-min-microvolt = <3300000>;
  122. regulator-max-microvolt = <3300000>;
  123. vin-supply = <&dc_in>;
  124. regulator-always-on;
  125. };
  126. usb_pwr: regulator-usb_pwr {
  127. compatible = "regulator-fixed";
  128. regulator-name = "USB_PWR";
  129. regulator-min-microvolt = <5000000>;
  130. regulator-max-microvolt = <5000000>;
  131. vin-supply = <&vcc_5v>;
  132. gpio = <&gpio GPIOA_6 GPIO_ACTIVE_HIGH>;
  133. enable-active-high;
  134. };
  135. hdmi-connector {
  136. compatible = "hdmi-connector";
  137. type = "a";
  138. port {
  139. hdmi_connector_in: endpoint {
  140. remote-endpoint = <&hdmi_tx_tmds_out>;
  141. };
  142. };
  143. };
  144. sound {
  145. compatible = "amlogic,axg-sound-card";
  146. model = "KHADAS-VIM3";
  147. audio-aux-devs = <&tdmin_a>, <&tdmout_a>;
  148. audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0",
  149. "TDMOUT_A IN 1", "FRDDR_B OUT 0",
  150. "TDMOUT_A IN 2", "FRDDR_C OUT 0",
  151. "TDM_A Playback", "TDMOUT_A OUT",
  152. "TDMIN_A IN 0", "TDM_A Capture",
  153. "TDMIN_A IN 3", "TDM_A Loopback",
  154. "TODDR_A IN 0", "TDMIN_A OUT",
  155. "TODDR_B IN 0", "TDMIN_A OUT",
  156. "TODDR_C IN 0", "TDMIN_A OUT";
  157. assigned-clocks = <&clkc CLKID_MPLL2>,
  158. <&clkc CLKID_MPLL0>,
  159. <&clkc CLKID_MPLL1>;
  160. assigned-clock-parents = <0>, <0>, <0>;
  161. assigned-clock-rates = <294912000>,
  162. <270950400>,
  163. <393216000>;
  164. status = "okay";
  165. dai-link-0 {
  166. sound-dai = <&frddr_a>;
  167. };
  168. dai-link-1 {
  169. sound-dai = <&frddr_b>;
  170. };
  171. dai-link-2 {
  172. sound-dai = <&frddr_c>;
  173. };
  174. dai-link-3 {
  175. sound-dai = <&toddr_a>;
  176. };
  177. dai-link-4 {
  178. sound-dai = <&toddr_b>;
  179. };
  180. dai-link-5 {
  181. sound-dai = <&toddr_c>;
  182. };
  183. /* 8ch hdmi interface */
  184. dai-link-6 {
  185. sound-dai = <&tdmif_a>;
  186. dai-format = "i2s";
  187. dai-tdm-slot-tx-mask-0 = <1 1>;
  188. dai-tdm-slot-tx-mask-1 = <1 1>;
  189. dai-tdm-slot-tx-mask-2 = <1 1>;
  190. dai-tdm-slot-tx-mask-3 = <1 1>;
  191. mclk-fs = <256>;
  192. codec {
  193. sound-dai = <&tohdmitx TOHDMITX_I2S_IN_A>;
  194. };
  195. };
  196. /* hdmi glue */
  197. dai-link-7 {
  198. sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
  199. codec {
  200. sound-dai = <&hdmi_tx>;
  201. };
  202. };
  203. };
  204. wifi32k: wifi32k {
  205. compatible = "pwm-clock";
  206. #clock-cells = <0>;
  207. clock-frequency = <32768>;
  208. pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
  209. };
  210. };
  211. &arb {
  212. status = "okay";
  213. };
  214. &clkc_audio {
  215. status = "okay";
  216. };
  217. &cec_AO {
  218. pinctrl-0 = <&cec_ao_a_h_pins>;
  219. pinctrl-names = "default";
  220. status = "disabled";
  221. hdmi-phandle = <&hdmi_tx>;
  222. };
  223. &cecb_AO {
  224. pinctrl-0 = <&cec_ao_b_h_pins>;
  225. pinctrl-names = "default";
  226. status = "okay";
  227. hdmi-phandle = <&hdmi_tx>;
  228. };
  229. &cpu_thermal {
  230. trips {
  231. cpu_active: cpu-active {
  232. temperature = <80000>; /* millicelsius */
  233. hysteresis = <2000>; /* millicelsius */
  234. type = "active";
  235. };
  236. };
  237. cooling-maps {
  238. map {
  239. trip = <&cpu_active>;
  240. cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
  241. };
  242. };
  243. };
  244. &ext_mdio {
  245. external_phy: ethernet-phy@0 {
  246. /* Realtek RTL8211F (0x001cc916) */
  247. reg = <0>;
  248. max-speed = <1000>;
  249. interrupt-parent = <&gpio_intc>;
  250. /* MAC_INTR on GPIOZ_14 */
  251. interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
  252. };
  253. };
  254. &ethmac {
  255. pinctrl-0 = <&eth_pins>, <&eth_rgmii_pins>;
  256. pinctrl-names = "default";
  257. status = "okay";
  258. phy-mode = "rgmii";
  259. phy-handle = <&external_phy>;
  260. amlogic,tx-delay-ns = <2>;
  261. };
  262. &frddr_a {
  263. status = "okay";
  264. };
  265. &frddr_b {
  266. status = "okay";
  267. };
  268. &frddr_c {
  269. status = "okay";
  270. };
  271. &hdmi_tx {
  272. status = "okay";
  273. pinctrl-0 = <&hdmitx_hpd_pins>, <&hdmitx_ddc_pins>;
  274. pinctrl-names = "default";
  275. hdmi-supply = <&vcc_5v>;
  276. };
  277. &hdmi_tx_tmds_port {
  278. hdmi_tx_tmds_out: endpoint {
  279. remote-endpoint = <&hdmi_connector_in>;
  280. };
  281. };
  282. &i2c_AO {
  283. status = "okay";
  284. pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
  285. pinctrl-names = "default";
  286. khadas_mcu: system-controller@18 {
  287. compatible = "khadas,mcu";
  288. reg = <0x18>;
  289. #cooling-cells = <2>;
  290. };
  291. gpio_expander: gpio-controller@20 {
  292. compatible = "ti,tca6408";
  293. reg = <0x20>;
  294. vcc-supply = <&vcc_3v3>;
  295. gpio-controller;
  296. #gpio-cells = <2>;
  297. };
  298. rtc: rtc@51 {
  299. compatible = "haoyu,hym8563";
  300. reg = <0x51>;
  301. #clock-cells = <0>;
  302. };
  303. };
  304. &ir {
  305. status = "okay";
  306. pinctrl-0 = <&remote_input_ao_pins>;
  307. pinctrl-names = "default";
  308. linux,rc-map-name = "rc-khadas";
  309. };
  310. &pcie {
  311. reset-gpios = <&gpio GPIOA_8 GPIO_ACTIVE_LOW>;
  312. };
  313. &pwm_ef {
  314. status = "okay";
  315. pinctrl-0 = <&pwm_e_pins>;
  316. pinctrl-names = "default";
  317. };
  318. &saradc {
  319. status = "okay";
  320. vref-supply = <&vddao_1v8>;
  321. };
  322. /* SDIO */
  323. &sd_emmc_a {
  324. status = "okay";
  325. pinctrl-0 = <&sdio_pins>;
  326. pinctrl-1 = <&sdio_clk_gate_pins>;
  327. pinctrl-names = "default", "clk-gate";
  328. #address-cells = <1>;
  329. #size-cells = <0>;
  330. bus-width = <4>;
  331. cap-sd-highspeed;
  332. max-frequency = <100000000>;
  333. non-removable;
  334. disable-wp;
  335. /* WiFi firmware requires power to be kept while in suspend */
  336. keep-power-in-suspend;
  337. mmc-pwrseq = <&sdio_pwrseq>;
  338. vmmc-supply = <&vsys_3v3>;
  339. vqmmc-supply = <&vddao_1v8>;
  340. brcmf: wifi@1 {
  341. reg = <1>;
  342. compatible = "brcm,bcm4329-fmac";
  343. };
  344. };
  345. /* SD card */
  346. &sd_emmc_b {
  347. status = "okay";
  348. pinctrl-0 = <&sdcard_c_pins>;
  349. pinctrl-1 = <&sdcard_clk_gate_c_pins>;
  350. pinctrl-names = "default", "clk-gate";
  351. bus-width = <4>;
  352. cap-sd-highspeed;
  353. max-frequency = <50000000>;
  354. disable-wp;
  355. cd-gpios = <&gpio GPIOC_6 GPIO_ACTIVE_LOW>;
  356. vmmc-supply = <&vsys_3v3>;
  357. vqmmc-supply = <&vsys_3v3>;
  358. };
  359. /* eMMC */
  360. &sd_emmc_c {
  361. status = "okay";
  362. pinctrl-0 = <&emmc_ctrl_pins>, <&emmc_data_8b_pins>, <&emmc_ds_pins>;
  363. pinctrl-1 = <&emmc_clk_gate_pins>;
  364. pinctrl-names = "default", "clk-gate";
  365. bus-width = <8>;
  366. cap-mmc-highspeed;
  367. mmc-ddr-1_8v;
  368. mmc-hs200-1_8v;
  369. max-frequency = <200000000>;
  370. disable-wp;
  371. mmc-pwrseq = <&emmc_pwrseq>;
  372. vmmc-supply = <&vcc_3v3>;
  373. vqmmc-supply = <&emmc_1v8>;
  374. };
  375. /*
  376. * EMMC_D4, EMMC_D5, EMMC_D6 and EMMC_D7 pins are shared between SPI NOR CS
  377. * and eMMC Data 4 to 7 pins.
  378. * Replace emmc_data_8b_pins to emmc_data_4b_pins from sd_emmc_c pinctrl-0,
  379. * and change bus-width to 4 then spifc can be enabled.
  380. */
  381. &spifc {
  382. status = "disabled";
  383. pinctrl-0 = <&nor_pins>;
  384. pinctrl-names = "default";
  385. w25q128: flash@0 {
  386. #address-cells = <1>;
  387. #size-cells = <1>;
  388. compatible = "winbond,w25q128fw", "jedec,spi-nor";
  389. reg = <0>;
  390. spi-max-frequency = <104000000>;
  391. };
  392. };
  393. &tdmif_a {
  394. status = "okay";
  395. };
  396. &tdmin_a {
  397. status = "okay";
  398. };
  399. &tdmout_a {
  400. status = "okay";
  401. };
  402. &toddr_a {
  403. status = "okay";
  404. };
  405. &toddr_b {
  406. status = "okay";
  407. };
  408. &toddr_c {
  409. status = "okay";
  410. };
  411. &tohdmitx {
  412. status = "okay";
  413. };
  414. &uart_A {
  415. status = "okay";
  416. pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
  417. pinctrl-names = "default";
  418. uart-has-rtscts;
  419. bluetooth {
  420. compatible = "brcm,bcm43438-bt";
  421. shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
  422. max-speed = <2000000>;
  423. clocks = <&wifi32k>;
  424. clock-names = "lpo";
  425. };
  426. };
  427. &uart_AO {
  428. status = "okay";
  429. pinctrl-0 = <&uart_ao_a_pins>;
  430. pinctrl-names = "default";
  431. };
  432. &usb2_phy0 {
  433. phy-supply = <&dc_in>;
  434. };
  435. &usb2_phy1 {
  436. phy-supply = <&usb_pwr>;
  437. };
  438. &usb3_pcie_phy {
  439. phy-supply = <&usb_pwr>;
  440. };
  441. &usb {
  442. status = "okay";
  443. dr_mode = "peripheral";
  444. };