xref: /freebsd/sys/contrib/device-tree/Bindings/iommu/mediatek,iommu.yaml (revision aa1a8ff2d6dbc51ef058f46f3db5a8bb77967145)
15def4c47SEmmanuel Vadot# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
25def4c47SEmmanuel Vadot%YAML 1.2
35def4c47SEmmanuel Vadot---
45def4c47SEmmanuel Vadot$id: http://devicetree.org/schemas/iommu/mediatek,iommu.yaml#
55def4c47SEmmanuel Vadot$schema: http://devicetree.org/meta-schemas/core.yaml#
65def4c47SEmmanuel Vadot
75def4c47SEmmanuel Vadottitle: MediaTek IOMMU Architecture Implementation
85def4c47SEmmanuel Vadot
95def4c47SEmmanuel Vadotmaintainers:
105def4c47SEmmanuel Vadot  - Yong Wu <yong.wu@mediatek.com>
115def4c47SEmmanuel Vadot
125def4c47SEmmanuel Vadotdescription: |+
135def4c47SEmmanuel Vadot  Some MediaTek SOCs contain a Multimedia Memory Management Unit (M4U), and
145def4c47SEmmanuel Vadot  this M4U have two generations of HW architecture. Generation one uses flat
155def4c47SEmmanuel Vadot  pagetable, and only supports 4K size page mapping. Generation two uses the
165def4c47SEmmanuel Vadot  ARM Short-Descriptor translation table format for address translation.
175def4c47SEmmanuel Vadot
185def4c47SEmmanuel Vadot  About the M4U Hardware Block Diagram, please check below:
195def4c47SEmmanuel Vadot
205def4c47SEmmanuel Vadot                EMI (External Memory Interface)
215def4c47SEmmanuel Vadot                 |
225def4c47SEmmanuel Vadot                m4u (Multimedia Memory Management Unit)
235def4c47SEmmanuel Vadot                 |
245def4c47SEmmanuel Vadot            +--------+
255def4c47SEmmanuel Vadot            |        |
265def4c47SEmmanuel Vadot        gals0-rx   gals1-rx    (Global Async Local Sync rx)
275def4c47SEmmanuel Vadot            |        |
285def4c47SEmmanuel Vadot            |        |
295def4c47SEmmanuel Vadot        gals0-tx   gals1-tx    (Global Async Local Sync tx)
305def4c47SEmmanuel Vadot            |        |          Some SoCs may have GALS.
315def4c47SEmmanuel Vadot            +--------+
325def4c47SEmmanuel Vadot                 |
335def4c47SEmmanuel Vadot             SMI Common(Smart Multimedia Interface Common)
345def4c47SEmmanuel Vadot                 |
355def4c47SEmmanuel Vadot         +----------------+-------
365def4c47SEmmanuel Vadot         |                |
375def4c47SEmmanuel Vadot         |             gals-rx        There may be GALS in some larbs.
385def4c47SEmmanuel Vadot         |                |
395def4c47SEmmanuel Vadot         |                |
405def4c47SEmmanuel Vadot         |             gals-tx
415def4c47SEmmanuel Vadot         |                |
425def4c47SEmmanuel Vadot     SMI larb0        SMI larb1   ... SoCs have several SMI local arbiter(larb).
435def4c47SEmmanuel Vadot     (display)         (vdec)
445def4c47SEmmanuel Vadot         |                |
455def4c47SEmmanuel Vadot         |                |
465def4c47SEmmanuel Vadot   +-----+-----+     +----+----+
475def4c47SEmmanuel Vadot   |     |     |     |    |    |
485def4c47SEmmanuel Vadot   |     |     |...  |    |    |  ... There are different ports in each larb.
495def4c47SEmmanuel Vadot   |     |     |     |    |    |
505def4c47SEmmanuel Vadot  OVL0 RDMA0 WDMA0  MC   PP   VLD
515def4c47SEmmanuel Vadot
525def4c47SEmmanuel Vadot  As above, The Multimedia HW will go through SMI and M4U while it
535def4c47SEmmanuel Vadot  access EMI. SMI is a bridge between m4u and the Multimedia HW. It contain
545def4c47SEmmanuel Vadot  smi local arbiter and smi common. It will control whether the Multimedia
555def4c47SEmmanuel Vadot  HW should go though the m4u for translation or bypass it and talk
565def4c47SEmmanuel Vadot  directly with EMI. And also SMI help control the power domain and clocks for
575def4c47SEmmanuel Vadot  each local arbiter.
585def4c47SEmmanuel Vadot
595def4c47SEmmanuel Vadot  Normally we specify a local arbiter(larb) for each multimedia HW
605def4c47SEmmanuel Vadot  like display, video decode, and camera. And there are different ports
615def4c47SEmmanuel Vadot  in each larb. Take a example, There are many ports like MC, PP, VLD in the
625def4c47SEmmanuel Vadot  video decode local arbiter, all these ports are according to the video HW.
635def4c47SEmmanuel Vadot
645def4c47SEmmanuel Vadot  In some SoCs, there may be a GALS(Global Async Local Sync) module between
655def4c47SEmmanuel Vadot  smi-common and m4u, and additional GALS module between smi-larb and
665def4c47SEmmanuel Vadot  smi-common. GALS can been seen as a "asynchronous fifo" which could help
675def4c47SEmmanuel Vadot  synchronize for the modules in different clock frequency.
685def4c47SEmmanuel Vadot
695def4c47SEmmanuel Vadotproperties:
705def4c47SEmmanuel Vadot  compatible:
715def4c47SEmmanuel Vadot    oneOf:
725def4c47SEmmanuel Vadot      - enum:
735def4c47SEmmanuel Vadot          - mediatek,mt2701-m4u  # generation one
745def4c47SEmmanuel Vadot          - mediatek,mt2712-m4u  # generation two
755def4c47SEmmanuel Vadot          - mediatek,mt6779-m4u  # generation two
767ef62cebSEmmanuel Vadot          - mediatek,mt6795-m4u  # generation two
775def4c47SEmmanuel Vadot          - mediatek,mt8167-m4u  # generation two
785def4c47SEmmanuel Vadot          - mediatek,mt8173-m4u  # generation two
795def4c47SEmmanuel Vadot          - mediatek,mt8183-m4u  # generation two
80d5b0e70fSEmmanuel Vadot          - mediatek,mt8186-iommu-mm         # generation two
81*aa1a8ff2SEmmanuel Vadot          - mediatek,mt8188-iommu-vdo        # generation two
82*aa1a8ff2SEmmanuel Vadot          - mediatek,mt8188-iommu-vpp        # generation two
83*aa1a8ff2SEmmanuel Vadot          - mediatek,mt8188-iommu-infra      # generation two
845def4c47SEmmanuel Vadot          - mediatek,mt8192-m4u  # generation two
85d5b0e70fSEmmanuel Vadot          - mediatek,mt8195-iommu-vdo        # generation two
86d5b0e70fSEmmanuel Vadot          - mediatek,mt8195-iommu-vpp        # generation two
87d5b0e70fSEmmanuel Vadot          - mediatek,mt8195-iommu-infra      # generation two
888bab661aSEmmanuel Vadot          - mediatek,mt8365-m4u  # generation two
895def4c47SEmmanuel Vadot
905def4c47SEmmanuel Vadot      - description: mt7623 generation one
915def4c47SEmmanuel Vadot        items:
925def4c47SEmmanuel Vadot          - const: mediatek,mt7623-m4u
935def4c47SEmmanuel Vadot          - const: mediatek,mt2701-m4u
945def4c47SEmmanuel Vadot
955def4c47SEmmanuel Vadot  reg:
965def4c47SEmmanuel Vadot    maxItems: 1
975def4c47SEmmanuel Vadot
985def4c47SEmmanuel Vadot  interrupts:
995def4c47SEmmanuel Vadot    maxItems: 1
1005def4c47SEmmanuel Vadot
1015def4c47SEmmanuel Vadot  clocks:
1025def4c47SEmmanuel Vadot    items:
1035def4c47SEmmanuel Vadot      - description: bclk is the block clock.
1045def4c47SEmmanuel Vadot
1055def4c47SEmmanuel Vadot  clock-names:
1065def4c47SEmmanuel Vadot    items:
1075def4c47SEmmanuel Vadot      - const: bclk
1085def4c47SEmmanuel Vadot
109b97ee269SEmmanuel Vadot  mediatek,infracfg:
110b97ee269SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle
111b97ee269SEmmanuel Vadot    description: The phandle to the mediatek infracfg syscon
112b97ee269SEmmanuel Vadot
1135def4c47SEmmanuel Vadot  mediatek,larbs:
1145def4c47SEmmanuel Vadot    $ref: /schemas/types.yaml#/definitions/phandle-array
1155def4c47SEmmanuel Vadot    minItems: 1
1165def4c47SEmmanuel Vadot    maxItems: 32
117c9ccf3a3SEmmanuel Vadot    items:
118c9ccf3a3SEmmanuel Vadot      maxItems: 1
1195def4c47SEmmanuel Vadot    description: |
1205def4c47SEmmanuel Vadot      List of phandle to the local arbiters in the current Socs.
1215def4c47SEmmanuel Vadot      Refer to bindings/memory-controllers/mediatek,smi-larb.yaml. It must sort
1225def4c47SEmmanuel Vadot      according to the local arbiter index, like larb0, larb1, larb2...
1235def4c47SEmmanuel Vadot
1245def4c47SEmmanuel Vadot  '#iommu-cells':
1255def4c47SEmmanuel Vadot    const: 1
1265def4c47SEmmanuel Vadot    description: |
1275def4c47SEmmanuel Vadot      This is the mtk_m4u_id according to the HW. Specifies the mtk_m4u_id as
1285def4c47SEmmanuel Vadot      defined in
129*aa1a8ff2SEmmanuel Vadot      dt-binding/memory/mediatek,mt8188-memory-port.h for mt8188,
1305def4c47SEmmanuel Vadot      dt-binding/memory/mt2701-larb-port.h for mt2701 and mt7623,
1315def4c47SEmmanuel Vadot      dt-binding/memory/mt2712-larb-port.h for mt2712,
1325def4c47SEmmanuel Vadot      dt-binding/memory/mt6779-larb-port.h for mt6779,
1337ef62cebSEmmanuel Vadot      dt-binding/memory/mt6795-larb-port.h for mt6795,
1345def4c47SEmmanuel Vadot      dt-binding/memory/mt8167-larb-port.h for mt8167,
1355def4c47SEmmanuel Vadot      dt-binding/memory/mt8173-larb-port.h for mt8173,
1365def4c47SEmmanuel Vadot      dt-binding/memory/mt8183-larb-port.h for mt8183,
137d5b0e70fSEmmanuel Vadot      dt-binding/memory/mt8186-memory-port.h for mt8186,
1385def4c47SEmmanuel Vadot      dt-binding/memory/mt8192-larb-port.h for mt8192.
139d5b0e70fSEmmanuel Vadot      dt-binding/memory/mt8195-memory-port.h for mt8195.
1408bab661aSEmmanuel Vadot      dt-binding/memory/mediatek,mt8365-larb-port.h for mt8365.
1415def4c47SEmmanuel Vadot
1425def4c47SEmmanuel Vadot  power-domains:
1435def4c47SEmmanuel Vadot    maxItems: 1
1445def4c47SEmmanuel Vadot
1455def4c47SEmmanuel Vadotrequired:
1465def4c47SEmmanuel Vadot  - compatible
1475def4c47SEmmanuel Vadot  - reg
1485def4c47SEmmanuel Vadot  - interrupts
1495def4c47SEmmanuel Vadot  - '#iommu-cells'
1505def4c47SEmmanuel Vadot
1515def4c47SEmmanuel VadotallOf:
1525def4c47SEmmanuel Vadot  - if:
1535def4c47SEmmanuel Vadot      properties:
1545def4c47SEmmanuel Vadot        compatible:
1555def4c47SEmmanuel Vadot          contains:
1565def4c47SEmmanuel Vadot            enum:
1575def4c47SEmmanuel Vadot              - mediatek,mt2701-m4u
1585def4c47SEmmanuel Vadot              - mediatek,mt2712-m4u
1597ef62cebSEmmanuel Vadot              - mediatek,mt6795-m4u
1605def4c47SEmmanuel Vadot              - mediatek,mt8173-m4u
161d5b0e70fSEmmanuel Vadot              - mediatek,mt8186-iommu-mm
162*aa1a8ff2SEmmanuel Vadot              - mediatek,mt8188-iommu-vdo
163*aa1a8ff2SEmmanuel Vadot              - mediatek,mt8188-iommu-vpp
1645def4c47SEmmanuel Vadot              - mediatek,mt8192-m4u
165d5b0e70fSEmmanuel Vadot              - mediatek,mt8195-iommu-vdo
166d5b0e70fSEmmanuel Vadot              - mediatek,mt8195-iommu-vpp
1675def4c47SEmmanuel Vadot
1685def4c47SEmmanuel Vadot    then:
1695def4c47SEmmanuel Vadot      required:
1705def4c47SEmmanuel Vadot        - clocks
1715def4c47SEmmanuel Vadot
1725def4c47SEmmanuel Vadot  - if:
1735def4c47SEmmanuel Vadot      properties:
1745def4c47SEmmanuel Vadot        compatible:
1755def4c47SEmmanuel Vadot          enum:
176d5b0e70fSEmmanuel Vadot            - mediatek,mt8186-iommu-mm
177*aa1a8ff2SEmmanuel Vadot            - mediatek,mt8188-iommu-vdo
178*aa1a8ff2SEmmanuel Vadot            - mediatek,mt8188-iommu-vpp
1795def4c47SEmmanuel Vadot            - mediatek,mt8192-m4u
180d5b0e70fSEmmanuel Vadot            - mediatek,mt8195-iommu-vdo
181d5b0e70fSEmmanuel Vadot            - mediatek,mt8195-iommu-vpp
1825def4c47SEmmanuel Vadot
1835def4c47SEmmanuel Vadot    then:
1845def4c47SEmmanuel Vadot      required:
1855def4c47SEmmanuel Vadot        - power-domains
1865def4c47SEmmanuel Vadot
187b97ee269SEmmanuel Vadot  - if:
188b97ee269SEmmanuel Vadot      properties:
189b97ee269SEmmanuel Vadot        compatible:
190b97ee269SEmmanuel Vadot          contains:
191b97ee269SEmmanuel Vadot            enum:
192b97ee269SEmmanuel Vadot              - mediatek,mt2712-m4u
1937ef62cebSEmmanuel Vadot              - mediatek,mt6795-m4u
194b97ee269SEmmanuel Vadot              - mediatek,mt8173-m4u
195b97ee269SEmmanuel Vadot
196b97ee269SEmmanuel Vadot    then:
197b97ee269SEmmanuel Vadot      required:
198b97ee269SEmmanuel Vadot        - mediatek,infracfg
199b97ee269SEmmanuel Vadot
200d5b0e70fSEmmanuel Vadot  - if: # The IOMMUs don't have larbs.
201d5b0e70fSEmmanuel Vadot      not:
202d5b0e70fSEmmanuel Vadot        properties:
203d5b0e70fSEmmanuel Vadot          compatible:
204d5b0e70fSEmmanuel Vadot            contains:
205*aa1a8ff2SEmmanuel Vadot              enum:
206*aa1a8ff2SEmmanuel Vadot                - mediatek,mt8188-iommu-infra
207*aa1a8ff2SEmmanuel Vadot                - mediatek,mt8195-iommu-infra
208d5b0e70fSEmmanuel Vadot
209d5b0e70fSEmmanuel Vadot    then:
210d5b0e70fSEmmanuel Vadot      required:
211d5b0e70fSEmmanuel Vadot        - mediatek,larbs
212d5b0e70fSEmmanuel Vadot
2135def4c47SEmmanuel VadotadditionalProperties: false
2145def4c47SEmmanuel Vadot
2155def4c47SEmmanuel Vadotexamples:
2165def4c47SEmmanuel Vadot  - |
2175def4c47SEmmanuel Vadot    #include <dt-bindings/clock/mt8173-clk.h>
2185def4c47SEmmanuel Vadot    #include <dt-bindings/interrupt-controller/arm-gic.h>
2195def4c47SEmmanuel Vadot
2205def4c47SEmmanuel Vadot    iommu: iommu@10205000 {
2215def4c47SEmmanuel Vadot            compatible = "mediatek,mt8173-m4u";
2225def4c47SEmmanuel Vadot            reg = <0x10205000 0x1000>;
2235def4c47SEmmanuel Vadot            interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_LOW>;
2245def4c47SEmmanuel Vadot            clocks = <&infracfg CLK_INFRA_M4U>;
2255def4c47SEmmanuel Vadot            clock-names = "bclk";
226b97ee269SEmmanuel Vadot            mediatek,infracfg = <&infracfg>;
227c9ccf3a3SEmmanuel Vadot            mediatek,larbs = <&larb0>, <&larb1>, <&larb2>,
228c9ccf3a3SEmmanuel Vadot                             <&larb3>, <&larb4>, <&larb5>;
2295def4c47SEmmanuel Vadot            #iommu-cells = <1>;
2305def4c47SEmmanuel Vadot    };
231