xref: /linux/Documentation/devicetree/bindings/mmc/mtk-sd.yaml (revision 84e85359f4999a439aa12e04bf0ae9e13e00fc66)
1c626695eSWenbin Mei# SPDX-License-Identifier: GPL-2.0
2c626695eSWenbin Mei%YAML 1.2
3c626695eSWenbin Mei---
4c626695eSWenbin Mei$id: http://devicetree.org/schemas/mmc/mtk-sd.yaml#
5c626695eSWenbin Mei$schema: http://devicetree.org/meta-schemas/core.yaml#
6c626695eSWenbin Mei
7*84e85359SKrzysztof Kozlowskititle: MTK MSDC Storage Host Controller
8c626695eSWenbin Mei
9c626695eSWenbin Meimaintainers:
10c626695eSWenbin Mei  - Chaotian Jing <chaotian.jing@mediatek.com>
11c626695eSWenbin Mei  - Wenbin Mei <wenbin.mei@mediatek.com>
12c626695eSWenbin Mei
13c626695eSWenbin Meiproperties:
14c626695eSWenbin Mei  compatible:
15c626695eSWenbin Mei    oneOf:
16c626695eSWenbin Mei      - enum:
17c626695eSWenbin Mei          - mediatek,mt2701-mmc
18c626695eSWenbin Mei          - mediatek,mt2712-mmc
19c626695eSWenbin Mei          - mediatek,mt6779-mmc
2055e7dceeSAngeloGioacchino Del Regno          - mediatek,mt6795-mmc
21c626695eSWenbin Mei          - mediatek,mt7620-mmc
22c626695eSWenbin Mei          - mediatek,mt7622-mmc
231b845c5aSSam Shih          - mediatek,mt7986-mmc
24c626695eSWenbin Mei          - mediatek,mt8135-mmc
25c626695eSWenbin Mei          - mediatek,mt8173-mmc
26c626695eSWenbin Mei          - mediatek,mt8183-mmc
27c626695eSWenbin Mei          - mediatek,mt8516-mmc
28c626695eSWenbin Mei      - items:
29c626695eSWenbin Mei          - const: mediatek,mt7623-mmc
30c626695eSWenbin Mei          - const: mediatek,mt2701-mmc
3159a23395SWenbin Mei      - items:
324ec43b87SJohnson Wang          - enum:
334ec43b87SJohnson Wang              - mediatek,mt8186-mmc
344ec43b87SJohnson Wang              - mediatek,mt8188-mmc
354ec43b87SJohnson Wang              - mediatek,mt8192-mmc
364ec43b87SJohnson Wang              - mediatek,mt8195-mmc
3759a23395SWenbin Mei          - const: mediatek,mt8183-mmc
38c626695eSWenbin Mei
394df297aaSRob Herring  reg:
407792fdf6STinghan Shen    minItems: 1
417792fdf6STinghan Shen    items:
427792fdf6STinghan Shen      - description: base register (required).
437792fdf6STinghan Shen      - description: top base register (required for MT8183).
444df297aaSRob Herring
45c626695eSWenbin Mei  clocks:
46c626695eSWenbin Mei    description:
47c626695eSWenbin Mei      Should contain phandle for the clock feeding the MMC controller.
48c626695eSWenbin Mei    minItems: 2
490b36b7cdSNícolas F. R. A. Prado    maxItems: 7
50c626695eSWenbin Mei
51c626695eSWenbin Mei  clock-names:
52c626695eSWenbin Mei    minItems: 2
530b36b7cdSNícolas F. R. A. Prado    maxItems: 7
54c626695eSWenbin Mei
554df297aaSRob Herring  interrupts:
56035cc395SAxe Yang    description:
57035cc395SAxe Yang      Should at least contain MSDC GIC interrupt. To support SDIO in-band wakeup, an extended
58035cc395SAxe Yang      interrupt is required and be configured as wakeup source irq.
59035cc395SAxe Yang    minItems: 1
60035cc395SAxe Yang    maxItems: 2
61035cc395SAxe Yang
62035cc395SAxe Yang  interrupt-names:
63035cc395SAxe Yang    items:
64035cc395SAxe Yang      - const: msdc
65035cc395SAxe Yang      - const: sdio_wakeup
664df297aaSRob Herring
67c626695eSWenbin Mei  pinctrl-names:
68035cc395SAxe Yang    description:
69035cc395SAxe Yang      Should at least contain default and state_uhs. To support SDIO in-band wakeup, dat1 pin
70035cc395SAxe Yang      will be switched between GPIO mode and SDIO DAT1 mode, state_eint is mandatory in this
71035cc395SAxe Yang      scenario.
72035cc395SAxe Yang    minItems: 2
73c626695eSWenbin Mei    items:
74c626695eSWenbin Mei      - const: default
75c626695eSWenbin Mei      - const: state_uhs
76035cc395SAxe Yang      - const: state_eint
77c626695eSWenbin Mei
78c626695eSWenbin Mei  pinctrl-0:
79c626695eSWenbin Mei    description:
80c626695eSWenbin Mei      should contain default/high speed pin ctrl.
81c626695eSWenbin Mei    maxItems: 1
82c626695eSWenbin Mei
83c626695eSWenbin Mei  pinctrl-1:
84c626695eSWenbin Mei    description:
85c626695eSWenbin Mei      should contain uhs mode pin ctrl.
86c626695eSWenbin Mei    maxItems: 1
87c626695eSWenbin Mei
88035cc395SAxe Yang  pinctrl-2:
89035cc395SAxe Yang    description:
90035cc395SAxe Yang      should switch dat1 pin to GPIO mode.
91035cc395SAxe Yang    maxItems: 1
92035cc395SAxe Yang
93c626695eSWenbin Mei  assigned-clocks:
94c626695eSWenbin Mei    description:
95c626695eSWenbin Mei      PLL of the source clock.
96c626695eSWenbin Mei    maxItems: 1
97c626695eSWenbin Mei
98c626695eSWenbin Mei  assigned-clock-parents:
99c626695eSWenbin Mei    description:
100c626695eSWenbin Mei      parent of source clock, used for HS400 mode to get 400Mhz source clock.
101c626695eSWenbin Mei    maxItems: 1
102c626695eSWenbin Mei
103c626695eSWenbin Mei  hs400-ds-delay:
104c626695eSWenbin Mei    $ref: /schemas/types.yaml#/definitions/uint32
105c626695eSWenbin Mei    description:
106c626695eSWenbin Mei      HS400 DS delay setting.
107c626695eSWenbin Mei    minimum: 0
108c626695eSWenbin Mei    maximum: 0xffffffff
109c626695eSWenbin Mei
110c626695eSWenbin Mei  mediatek,hs200-cmd-int-delay:
111c626695eSWenbin Mei    $ref: /schemas/types.yaml#/definitions/uint32
112c626695eSWenbin Mei    description:
113c626695eSWenbin Mei      HS200 command internal delay setting.
114c626695eSWenbin Mei      This field has total 32 stages.
115c626695eSWenbin Mei      The value is an integer from 0 to 31.
116c626695eSWenbin Mei    minimum: 0
117c626695eSWenbin Mei    maximum: 31
118c626695eSWenbin Mei
119c626695eSWenbin Mei  mediatek,hs400-cmd-int-delay:
120c626695eSWenbin Mei    $ref: /schemas/types.yaml#/definitions/uint32
121c626695eSWenbin Mei    description:
122c626695eSWenbin Mei      HS400 command internal delay setting.
123c626695eSWenbin Mei      This field has total 32 stages.
124c626695eSWenbin Mei      The value is an integer from 0 to 31.
125c626695eSWenbin Mei    minimum: 0
126c626695eSWenbin Mei    maximum: 31
127c626695eSWenbin Mei
128c626695eSWenbin Mei  mediatek,hs400-cmd-resp-sel-rising:
129c626695eSWenbin Mei    $ref: /schemas/types.yaml#/definitions/flag
130c626695eSWenbin Mei    description:
131c626695eSWenbin Mei      HS400 command response sample selection.
132c626695eSWenbin Mei      If present, HS400 command responses are sampled on rising edges.
133c626695eSWenbin Mei      If not present, HS400 command responses are sampled on falling edges.
134c626695eSWenbin Mei
135fb4708e6SWenbin Mei  mediatek,hs400-ds-dly3:
136fb4708e6SWenbin Mei    $ref: /schemas/types.yaml#/definitions/uint32
137fb4708e6SWenbin Mei    description:
138fb4708e6SWenbin Mei      Gear of the third delay line for DS for input data latch in data
139fb4708e6SWenbin Mei      pad macro, there are 32 stages from 0 to 31.
140fb4708e6SWenbin Mei      For different corner IC, the time is different about one step, it is
141fb4708e6SWenbin Mei      about 100ps.
142fb4708e6SWenbin Mei      The value is confirmed by doing scan and calibration to find a best
143fb4708e6SWenbin Mei      value with corner IC and it is valid only for HS400 mode.
144fb4708e6SWenbin Mei    minimum: 0
145fb4708e6SWenbin Mei    maximum: 31
146fb4708e6SWenbin Mei
147c626695eSWenbin Mei  mediatek,latch-ck:
148c626695eSWenbin Mei    $ref: /schemas/types.yaml#/definitions/uint32
149c626695eSWenbin Mei    description:
150c626695eSWenbin Mei      Some SoCs do not support enhance_rx, need set correct latch-ck to avoid
151c626695eSWenbin Mei      data crc error caused by stop clock(fifo full) Valid range = [0:0x7].
152c626695eSWenbin Mei      if not present, default value is 0.
153c626695eSWenbin Mei      applied to compatible "mediatek,mt2701-mmc".
154c626695eSWenbin Mei    minimum: 0
155c626695eSWenbin Mei    maximum: 7
156c626695eSWenbin Mei
157c626695eSWenbin Mei  resets:
158c626695eSWenbin Mei    maxItems: 1
159c626695eSWenbin Mei
160c626695eSWenbin Mei  reset-names:
161c626695eSWenbin Mei    const: hrst
162c626695eSWenbin Mei
163c626695eSWenbin Meirequired:
164c626695eSWenbin Mei  - compatible
165c626695eSWenbin Mei  - reg
166c626695eSWenbin Mei  - interrupts
167c626695eSWenbin Mei  - clocks
168c626695eSWenbin Mei  - clock-names
169c626695eSWenbin Mei  - pinctrl-names
170c626695eSWenbin Mei  - pinctrl-0
171c626695eSWenbin Mei  - pinctrl-1
172c626695eSWenbin Mei  - vmmc-supply
173c626695eSWenbin Mei  - vqmmc-supply
174c626695eSWenbin Mei
1750b36b7cdSNícolas F. R. A. PradoallOf:
1760b36b7cdSNícolas F. R. A. Prado  - $ref: mmc-controller.yaml#
1770b36b7cdSNícolas F. R. A. Prado  - if:
1780b36b7cdSNícolas F. R. A. Prado      properties:
1790b36b7cdSNícolas F. R. A. Prado        compatible:
1800b36b7cdSNícolas F. R. A. Prado          enum:
1810b36b7cdSNícolas F. R. A. Prado            - mediatek,mt2701-mmc
1820b36b7cdSNícolas F. R. A. Prado            - mediatek,mt6779-mmc
1830b36b7cdSNícolas F. R. A. Prado            - mediatek,mt6795-mmc
1840b36b7cdSNícolas F. R. A. Prado            - mediatek,mt7620-mmc
1850b36b7cdSNícolas F. R. A. Prado            - mediatek,mt7622-mmc
1860b36b7cdSNícolas F. R. A. Prado            - mediatek,mt7623-mmc
1870b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8135-mmc
1880b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8173-mmc
1890b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8183-mmc
1900b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8186-mmc
1910b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8188-mmc
1920b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8195-mmc
1930b36b7cdSNícolas F. R. A. Prado            - mediatek,mt8516-mmc
1940b36b7cdSNícolas F. R. A. Prado    then:
1950b36b7cdSNícolas F. R. A. Prado      properties:
1960b36b7cdSNícolas F. R. A. Prado        clocks:
1970b36b7cdSNícolas F. R. A. Prado          minItems: 2
1980b36b7cdSNícolas F. R. A. Prado          items:
1990b36b7cdSNícolas F. R. A. Prado            - description: source clock
2000b36b7cdSNícolas F. R. A. Prado            - description: HCLK which used for host
2010b36b7cdSNícolas F. R. A. Prado            - description: independent source clock gate
2020b36b7cdSNícolas F. R. A. Prado        clock-names:
2030b36b7cdSNícolas F. R. A. Prado          minItems: 2
2040b36b7cdSNícolas F. R. A. Prado          items:
2050b36b7cdSNícolas F. R. A. Prado            - const: source
2060b36b7cdSNícolas F. R. A. Prado            - const: hclk
2070b36b7cdSNícolas F. R. A. Prado            - const: source_cg
2080b36b7cdSNícolas F. R. A. Prado
2090b36b7cdSNícolas F. R. A. Prado  - if:
2100b36b7cdSNícolas F. R. A. Prado      properties:
2110b36b7cdSNícolas F. R. A. Prado        compatible:
2120b36b7cdSNícolas F. R. A. Prado          contains:
2130b36b7cdSNícolas F. R. A. Prado            const: mediatek,mt2712-mmc
2140b36b7cdSNícolas F. R. A. Prado    then:
2150b36b7cdSNícolas F. R. A. Prado      properties:
2160b36b7cdSNícolas F. R. A. Prado        clocks:
2170b36b7cdSNícolas F. R. A. Prado          minItems: 3
2180b36b7cdSNícolas F. R. A. Prado          items:
2190b36b7cdSNícolas F. R. A. Prado            - description: source clock
2200b36b7cdSNícolas F. R. A. Prado            - description: HCLK which used for host
2210b36b7cdSNícolas F. R. A. Prado            - description: independent source clock gate
2220b36b7cdSNícolas F. R. A. Prado            - description: bus clock used for internal register access (required for MSDC0/3).
2230b36b7cdSNícolas F. R. A. Prado        clock-names:
2240b36b7cdSNícolas F. R. A. Prado          minItems: 3
2250b36b7cdSNícolas F. R. A. Prado          items:
2260b36b7cdSNícolas F. R. A. Prado            - const: source
2270b36b7cdSNícolas F. R. A. Prado            - const: hclk
2280b36b7cdSNícolas F. R. A. Prado            - const: source_cg
2290b36b7cdSNícolas F. R. A. Prado            - const: bus_clk
2300b36b7cdSNícolas F. R. A. Prado
2310b36b7cdSNícolas F. R. A. Prado  - if:
2327792fdf6STinghan Shen      properties:
2337792fdf6STinghan Shen        compatible:
2347792fdf6STinghan Shen          contains:
2357792fdf6STinghan Shen            const: mediatek,mt8183-mmc
2367792fdf6STinghan Shen    then:
2377792fdf6STinghan Shen      properties:
2387792fdf6STinghan Shen        reg:
2397792fdf6STinghan Shen          minItems: 2
2407792fdf6STinghan Shen
2410b36b7cdSNícolas F. R. A. Prado  - if:
2420b36b7cdSNícolas F. R. A. Prado      properties:
2430b36b7cdSNícolas F. R. A. Prado        compatible:
2440b36b7cdSNícolas F. R. A. Prado          contains:
2451b845c5aSSam Shih            enum:
2461b845c5aSSam Shih              - mediatek,mt7986-mmc
2471b845c5aSSam Shih    then:
2481b845c5aSSam Shih      properties:
2491b845c5aSSam Shih        clocks:
2501b845c5aSSam Shih          minItems: 3
2511b845c5aSSam Shih          items:
2521b845c5aSSam Shih            - description: source clock
2531b845c5aSSam Shih            - description: HCLK which used for host
2541b845c5aSSam Shih            - description: independent source clock gate
2551b845c5aSSam Shih            - description: bus clock used for internal register access (required for MSDC0/3).
2561b845c5aSSam Shih            - description: msdc subsys clock gate
2571b845c5aSSam Shih        clock-names:
2581b845c5aSSam Shih          minItems: 3
2591b845c5aSSam Shih          items:
2601b845c5aSSam Shih            - const: source
2611b845c5aSSam Shih            - const: hclk
2621b845c5aSSam Shih            - const: source_cg
2631b845c5aSSam Shih            - const: bus_clk
2641b845c5aSSam Shih            - const: sys_cg
2651b845c5aSSam Shih
2661b845c5aSSam Shih  - if:
2671b845c5aSSam Shih      properties:
2681b845c5aSSam Shih        compatible:
2695c133688SMengqi Zhang          enum:
2705c133688SMengqi Zhang            - mediatek,mt8186-mmc
2715c133688SMengqi Zhang            - mediatek,mt8188-mmc
2725c133688SMengqi Zhang            - mediatek,mt8195-mmc
2735c133688SMengqi Zhang    then:
2745c133688SMengqi Zhang      properties:
2755c133688SMengqi Zhang        clocks:
2765c133688SMengqi Zhang          items:
2775c133688SMengqi Zhang            - description: source clock
2785c133688SMengqi Zhang            - description: HCLK which used for host
2795c133688SMengqi Zhang            - description: independent source clock gate
2805c133688SMengqi Zhang            - description: crypto clock used for data encrypt/decrypt (optional)
2815c133688SMengqi Zhang        clock-names:
2825c133688SMengqi Zhang          items:
2835c133688SMengqi Zhang            - const: source
2845c133688SMengqi Zhang            - const: hclk
2855c133688SMengqi Zhang            - const: source_cg
2865c133688SMengqi Zhang            - const: crypto
2875c133688SMengqi Zhang
2885c133688SMengqi Zhang  - if:
2895c133688SMengqi Zhang      properties:
2905c133688SMengqi Zhang        compatible:
2911b845c5aSSam Shih          contains:
2920b36b7cdSNícolas F. R. A. Prado            const: mediatek,mt8192-mmc
2930b36b7cdSNícolas F. R. A. Prado    then:
2940b36b7cdSNícolas F. R. A. Prado      properties:
2950b36b7cdSNícolas F. R. A. Prado        clocks:
2960b36b7cdSNícolas F. R. A. Prado          items:
2970b36b7cdSNícolas F. R. A. Prado            - description: source clock
2980b36b7cdSNícolas F. R. A. Prado            - description: HCLK which used for host
2990b36b7cdSNícolas F. R. A. Prado            - description: independent source clock gate
3000b36b7cdSNícolas F. R. A. Prado            - description: msdc subsys clock gate
3010b36b7cdSNícolas F. R. A. Prado            - description: peripheral bus clock gate
3020b36b7cdSNícolas F. R. A. Prado            - description: AXI bus clock gate
3030b36b7cdSNícolas F. R. A. Prado            - description: AHB bus clock gate
3040b36b7cdSNícolas F. R. A. Prado        clock-names:
3050b36b7cdSNícolas F. R. A. Prado          items:
3060b36b7cdSNícolas F. R. A. Prado            - const: source
3070b36b7cdSNícolas F. R. A. Prado            - const: hclk
3080b36b7cdSNícolas F. R. A. Prado            - const: source_cg
3090b36b7cdSNícolas F. R. A. Prado            - const: sys_cg
3100b36b7cdSNícolas F. R. A. Prado            - const: pclk_cg
3110b36b7cdSNícolas F. R. A. Prado            - const: axi_cg
3120b36b7cdSNícolas F. R. A. Prado            - const: ahb_cg
3130b36b7cdSNícolas F. R. A. Prado
314c626695eSWenbin MeiunevaluatedProperties: false
315c626695eSWenbin Mei
316c626695eSWenbin Meiexamples:
317c626695eSWenbin Mei  - |
318c626695eSWenbin Mei    #include <dt-bindings/interrupt-controller/irq.h>
319c626695eSWenbin Mei    #include <dt-bindings/interrupt-controller/arm-gic.h>
320c626695eSWenbin Mei    #include <dt-bindings/clock/mt8173-clk.h>
321c626695eSWenbin Mei    mmc0: mmc@11230000 {
322c626695eSWenbin Mei        compatible = "mediatek,mt8173-mmc";
323c626695eSWenbin Mei        reg = <0x11230000 0x1000>;
324c626695eSWenbin Mei        interrupts = <GIC_SPI 39 IRQ_TYPE_LEVEL_LOW>;
325c626695eSWenbin Mei        vmmc-supply = <&mt6397_vemc_3v3_reg>;
326c626695eSWenbin Mei        vqmmc-supply = <&mt6397_vio18_reg>;
327c626695eSWenbin Mei        clocks = <&pericfg CLK_PERI_MSDC30_0>,
328c626695eSWenbin Mei                 <&topckgen CLK_TOP_MSDC50_0_H_SEL>;
329c626695eSWenbin Mei        clock-names = "source", "hclk";
330c626695eSWenbin Mei        pinctrl-names = "default", "state_uhs";
331c626695eSWenbin Mei        pinctrl-0 = <&mmc0_pins_default>;
332c626695eSWenbin Mei        pinctrl-1 = <&mmc0_pins_uhs>;
333c626695eSWenbin Mei        assigned-clocks = <&topckgen CLK_TOP_MSDC50_0_SEL>;
334c626695eSWenbin Mei        assigned-clock-parents = <&topckgen CLK_TOP_MSDCPLL_D2>;
335c626695eSWenbin Mei        hs400-ds-delay = <0x14015>;
336c626695eSWenbin Mei        mediatek,hs200-cmd-int-delay = <26>;
337c626695eSWenbin Mei        mediatek,hs400-cmd-int-delay = <14>;
338c626695eSWenbin Mei        mediatek,hs400-cmd-resp-sel-rising;
339c626695eSWenbin Mei    };
340c626695eSWenbin Mei
341035cc395SAxe Yang    mmc3: mmc@11260000 {
342035cc395SAxe Yang        compatible = "mediatek,mt8173-mmc";
343035cc395SAxe Yang        reg = <0x11260000 0x1000>;
344035cc395SAxe Yang        clock-names = "source", "hclk";
345035cc395SAxe Yang        clocks = <&pericfg CLK_PERI_MSDC30_3>,
346035cc395SAxe Yang                 <&topckgen CLK_TOP_MSDC50_2_H_SEL>;
347035cc395SAxe Yang        interrupt-names = "msdc", "sdio_wakeup";
348035cc395SAxe Yang        interrupts-extended = <&gic GIC_SPI 74 IRQ_TYPE_LEVEL_LOW 0>,
349035cc395SAxe Yang                     <&pio 23 IRQ_TYPE_LEVEL_LOW>;
350035cc395SAxe Yang        pinctrl-names = "default", "state_uhs", "state_eint";
351035cc395SAxe Yang        pinctrl-0 = <&mmc2_pins_default>;
352035cc395SAxe Yang        pinctrl-1 = <&mmc2_pins_uhs>;
353035cc395SAxe Yang        pinctrl-2 = <&mmc2_pins_eint>;
354035cc395SAxe Yang        bus-width = <4>;
355035cc395SAxe Yang        max-frequency = <200000000>;
356035cc395SAxe Yang        cap-sd-highspeed;
357035cc395SAxe Yang        sd-uhs-sdr104;
358035cc395SAxe Yang        keep-power-in-suspend;
359035cc395SAxe Yang        wakeup-source;
360035cc395SAxe Yang        cap-sdio-irq;
361035cc395SAxe Yang        no-mmc;
362035cc395SAxe Yang        no-sd;
363035cc395SAxe Yang        non-removable;
364035cc395SAxe Yang        vmmc-supply = <&sdio_fixed_3v3>;
365035cc395SAxe Yang        vqmmc-supply = <&mt6397_vgp3_reg>;
366035cc395SAxe Yang        mmc-pwrseq = <&wifi_pwrseq>;
367035cc395SAxe Yang    };
368035cc395SAxe Yang
369c626695eSWenbin Mei...
370