mtk-sd.yaml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. # SPDX-License-Identifier: GPL-2.0
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/mmc/mtk-sd.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: MTK MSDC Storage Host Controller
  7. maintainers:
  8. - Chaotian Jing <chaotian.jing@mediatek.com>
  9. - Wenbin Mei <wenbin.mei@mediatek.com>
  10. properties:
  11. compatible:
  12. oneOf:
  13. - enum:
  14. - mediatek,mt2701-mmc
  15. - mediatek,mt2712-mmc
  16. - mediatek,mt6779-mmc
  17. - mediatek,mt6795-mmc
  18. - mediatek,mt7620-mmc
  19. - mediatek,mt7622-mmc
  20. - mediatek,mt7986-mmc
  21. - mediatek,mt7988-mmc
  22. - mediatek,mt8135-mmc
  23. - mediatek,mt8173-mmc
  24. - mediatek,mt8183-mmc
  25. - mediatek,mt8196-mmc
  26. - mediatek,mt8516-mmc
  27. - items:
  28. - const: mediatek,mt7623-mmc
  29. - const: mediatek,mt2701-mmc
  30. - items:
  31. - enum:
  32. - mediatek,mt6893-mmc
  33. - mediatek,mt8186-mmc
  34. - mediatek,mt8188-mmc
  35. - mediatek,mt8192-mmc
  36. - mediatek,mt8195-mmc
  37. - mediatek,mt8365-mmc
  38. - const: mediatek,mt8183-mmc
  39. reg:
  40. minItems: 1
  41. items:
  42. - description: base register (required).
  43. - description: top base register (required for MT8183).
  44. clocks:
  45. description:
  46. Should contain phandle for the clock feeding the MMC controller.
  47. minItems: 2
  48. maxItems: 7
  49. clock-names:
  50. minItems: 2
  51. maxItems: 7
  52. interrupts:
  53. description:
  54. Should at least contain MSDC GIC interrupt. To support SDIO in-band wakeup, an extended
  55. interrupt is required and be configured as wakeup source irq.
  56. minItems: 1
  57. maxItems: 2
  58. interrupt-names:
  59. items:
  60. - const: msdc
  61. - const: sdio_wakeup
  62. pinctrl-names:
  63. description:
  64. Should at least contain default and state_uhs. To support SDIO in-band wakeup, dat1 pin
  65. will be switched between GPIO mode and SDIO DAT1 mode, state_eint is mandatory in this
  66. scenario.
  67. minItems: 2
  68. items:
  69. - const: default
  70. - const: state_uhs
  71. - const: state_eint
  72. pinctrl-0:
  73. description:
  74. should contain default/high speed pin ctrl.
  75. maxItems: 1
  76. pinctrl-1:
  77. description:
  78. should contain uhs mode pin ctrl.
  79. maxItems: 1
  80. pinctrl-2:
  81. description:
  82. should switch dat1 pin to GPIO mode.
  83. maxItems: 1
  84. hs400-ds-delay:
  85. $ref: /schemas/types.yaml#/definitions/uint32
  86. description:
  87. HS400 DS delay setting.
  88. minimum: 0
  89. maximum: 0xffffffff
  90. mediatek,hs200-cmd-int-delay:
  91. $ref: /schemas/types.yaml#/definitions/uint32
  92. description:
  93. HS200 command internal delay setting.
  94. This field has total 32 stages.
  95. The value is an integer from 0 to 31.
  96. minimum: 0
  97. maximum: 31
  98. mediatek,hs400-cmd-int-delay:
  99. $ref: /schemas/types.yaml#/definitions/uint32
  100. description:
  101. HS400 command internal delay setting.
  102. This field has total 32 stages.
  103. The value is an integer from 0 to 31.
  104. minimum: 0
  105. maximum: 31
  106. mediatek,hs400-cmd-resp-sel-rising:
  107. $ref: /schemas/types.yaml#/definitions/flag
  108. description:
  109. HS400 command response sample selection.
  110. If present, HS400 command responses are sampled on rising edges.
  111. If not present, HS400 command responses are sampled on falling edges.
  112. mediatek,hs400-ds-dly3:
  113. $ref: /schemas/types.yaml#/definitions/uint32
  114. description:
  115. Gear of the third delay line for DS for input data latch in data
  116. pad macro, there are 32 stages from 0 to 31.
  117. For different corner IC, the time is different about one step, it is
  118. about 100ps.
  119. The value is confirmed by doing scan and calibration to find a best
  120. value with corner IC and it is valid only for HS400 mode.
  121. minimum: 0
  122. maximum: 31
  123. mediatek,latch-ck:
  124. $ref: /schemas/types.yaml#/definitions/uint32
  125. description:
  126. Some SoCs do not support enhance_rx, need set correct latch-ck to avoid
  127. data crc error caused by stop clock(fifo full) Valid range = [0:0x7].
  128. if not present, default value is 0.
  129. applied to compatible "mediatek,mt2701-mmc".
  130. minimum: 0
  131. maximum: 7
  132. mediatek,tuning-step:
  133. $ref: /schemas/types.yaml#/definitions/uint32
  134. description:
  135. Some SoCs need extend tuning step for better delay value to avoid CRC issue.
  136. If not present, default tuning step is 32. For eMMC and SD, this can yield
  137. satisfactory calibration results in most cases.
  138. enum: [32, 64]
  139. default: 32
  140. resets:
  141. maxItems: 1
  142. reset-names:
  143. const: hrst
  144. required:
  145. - compatible
  146. - reg
  147. - interrupts
  148. - clocks
  149. - clock-names
  150. - pinctrl-names
  151. - pinctrl-0
  152. - pinctrl-1
  153. - vmmc-supply
  154. - vqmmc-supply
  155. allOf:
  156. - $ref: mmc-controller.yaml#
  157. - if:
  158. properties:
  159. compatible:
  160. enum:
  161. - mediatek,mt2701-mmc
  162. - mediatek,mt6779-mmc
  163. - mediatek,mt6795-mmc
  164. - mediatek,mt7620-mmc
  165. - mediatek,mt7622-mmc
  166. - mediatek,mt7623-mmc
  167. - mediatek,mt8135-mmc
  168. - mediatek,mt8173-mmc
  169. - mediatek,mt8183-mmc
  170. - mediatek,mt8186-mmc
  171. - mediatek,mt8188-mmc
  172. - mediatek,mt8195-mmc
  173. - mediatek,mt8196-mmc
  174. - mediatek,mt8516-mmc
  175. then:
  176. properties:
  177. clocks:
  178. minItems: 2
  179. items:
  180. - description: source clock
  181. - description: HCLK which used for host
  182. - description: independent source clock gate
  183. clock-names:
  184. minItems: 2
  185. items:
  186. - const: source
  187. - const: hclk
  188. - const: source_cg
  189. - if:
  190. properties:
  191. compatible:
  192. contains:
  193. const: mediatek,mt2712-mmc
  194. then:
  195. properties:
  196. clocks:
  197. minItems: 3
  198. items:
  199. - description: source clock
  200. - description: HCLK which used for host
  201. - description: independent source clock gate
  202. - description: bus clock used for internal register access (required for MSDC0/3).
  203. clock-names:
  204. minItems: 3
  205. items:
  206. - const: source
  207. - const: hclk
  208. - const: source_cg
  209. - const: bus_clk
  210. - if:
  211. properties:
  212. compatible:
  213. contains:
  214. enum:
  215. - mediatek,mt7986-mmc
  216. - mediatek,mt7988-mmc
  217. - mediatek,mt8183-mmc
  218. - mediatek,mt8196-mmc
  219. then:
  220. properties:
  221. reg:
  222. minItems: 2
  223. else:
  224. properties:
  225. reg:
  226. maxItems: 1
  227. - if:
  228. properties:
  229. compatible:
  230. contains:
  231. enum:
  232. - mediatek,mt7986-mmc
  233. then:
  234. properties:
  235. clocks:
  236. minItems: 3
  237. items:
  238. - description: source clock
  239. - description: HCLK which used for host
  240. - description: independent source clock gate
  241. - description: bus clock used for internal register access (required for MSDC0/3).
  242. - description: msdc subsys clock gate
  243. clock-names:
  244. minItems: 3
  245. items:
  246. - const: source
  247. - const: hclk
  248. - const: source_cg
  249. - const: bus_clk
  250. - const: sys_cg
  251. - if:
  252. properties:
  253. compatible:
  254. contains:
  255. enum:
  256. - mediatek,mt7988-mmc
  257. then:
  258. properties:
  259. clocks:
  260. items:
  261. - description: source clock
  262. - description: HCLK which used for host
  263. - description: Advanced eXtensible Interface
  264. - description: Advanced High-performance Bus clock
  265. clock-names:
  266. items:
  267. - const: source
  268. - const: hclk
  269. - const: axi_cg
  270. - const: ahb_cg
  271. - if:
  272. properties:
  273. compatible:
  274. enum:
  275. - mediatek,mt6893-mmc
  276. - mediatek,mt8186-mmc
  277. - mediatek,mt8188-mmc
  278. - mediatek,mt8195-mmc
  279. then:
  280. properties:
  281. clocks:
  282. items:
  283. - description: source clock
  284. - description: HCLK which used for host
  285. - description: independent source clock gate
  286. - description: crypto clock used for data encrypt/decrypt (optional)
  287. clock-names:
  288. items:
  289. - const: source
  290. - const: hclk
  291. - const: source_cg
  292. - const: crypto
  293. - if:
  294. properties:
  295. compatible:
  296. contains:
  297. const: mediatek,mt8192-mmc
  298. then:
  299. properties:
  300. clocks:
  301. items:
  302. - description: source clock
  303. - description: HCLK which used for host
  304. - description: independent source clock gate
  305. - description: msdc subsys clock gate
  306. - description: peripheral bus clock gate
  307. - description: AXI bus clock gate
  308. - description: AHB bus clock gate
  309. clock-names:
  310. items:
  311. - const: source
  312. - const: hclk
  313. - const: source_cg
  314. - const: sys_cg
  315. - const: pclk_cg
  316. - const: axi_cg
  317. - const: ahb_cg
  318. unevaluatedProperties: false
  319. examples:
  320. - |
  321. #include <dt-bindings/interrupt-controller/irq.h>
  322. #include <dt-bindings/interrupt-controller/arm-gic.h>
  323. #include <dt-bindings/clock/mt8173-clk.h>
  324. mmc0: mmc@11230000 {
  325. compatible = "mediatek,mt8173-mmc";
  326. reg = <0x11230000 0x1000>;
  327. interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_LOW>;
  328. vmmc-supply = <&mt6397_vemc_3v3_reg>;
  329. vqmmc-supply = <&mt6397_vio18_reg>;
  330. clocks = <&pericfg CLK_PERI_MSDC30_0>,
  331. <&topckgen CLK_TOP_MSDC50_0_H_SEL>;
  332. clock-names = "source", "hclk";
  333. pinctrl-names = "default", "state_uhs";
  334. pinctrl-0 = <&mmc0_pins_default>;
  335. pinctrl-1 = <&mmc0_pins_uhs>;
  336. assigned-clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>;
  337. assigned-clock-parents = <&topckgen CLK_TOP_MSDCPLL_D2>;
  338. hs400-ds-delay = <0x14015>;
  339. mediatek,hs200-cmd-int-delay = <26>;
  340. mediatek,hs400-cmd-int-delay = <14>;
  341. mediatek,hs400-cmd-resp-sel-rising;
  342. };
  343. mmc3: mmc@11260000 {
  344. compatible = "mediatek,mt8173-mmc";
  345. reg = <0x11260000 0x1000>;
  346. clock-names = "source", "hclk";
  347. clocks = <&pericfg CLK_PERI_MSDC30_3>,
  348. <&topckgen CLK_TOP_MSDC50_2_H_SEL>;
  349. interrupt-names = "msdc", "sdio_wakeup";
  350. interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_LOW 0>,
  351. <&pio 23 IRQ_TYPE_LEVEL_LOW>;
  352. pinctrl-names = "default", "state_uhs", "state_eint";
  353. pinctrl-0 = <&mmc2_pins_default>;
  354. pinctrl-1 = <&mmc2_pins_uhs>;
  355. pinctrl-2 = <&mmc2_pins_eint>;
  356. bus-width = <4>;
  357. max-frequency = <200000000>;
  358. cap-sd-highspeed;
  359. sd-uhs-sdr104;
  360. keep-power-in-suspend;
  361. wakeup-source;
  362. cap-sdio-irq;
  363. no-mmc;
  364. no-sd;
  365. non-removable;
  366. vmmc-supply = <&sdio_fixed_3v3>;
  367. vqmmc-supply = <&mt6397_vgp3_reg>;
  368. mmc-pwrseq = <&wifi_pwrseq>;
  369. };
  370. ...