1*4882a593Smuzhiyun# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2*4882a593Smuzhiyun%YAML 1.2 3*4882a593Smuzhiyun--- 4*4882a593Smuzhiyun$id: http://devicetree.org/schemas/iommu/mediatek,iommu.yaml# 5*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml# 6*4882a593Smuzhiyun 7*4882a593Smuzhiyuntitle: MediaTek IOMMU Architecture Implementation 8*4882a593Smuzhiyun 9*4882a593Smuzhiyunmaintainers: 10*4882a593Smuzhiyun - Yong Wu <yong.wu@mediatek.com> 11*4882a593Smuzhiyun 12*4882a593Smuzhiyundescription: |+ 13*4882a593Smuzhiyun Some MediaTek SOCs contain a Multimedia Memory Management Unit (M4U), and 14*4882a593Smuzhiyun this M4U have two generations of HW architecture. Generation one uses flat 15*4882a593Smuzhiyun pagetable, and only supports 4K size page mapping. Generation two uses the 16*4882a593Smuzhiyun ARM Short-Descriptor translation table format for address translation. 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun About the M4U Hardware Block Diagram, please check below: 19*4882a593Smuzhiyun 20*4882a593Smuzhiyun EMI (External Memory Interface) 21*4882a593Smuzhiyun | 22*4882a593Smuzhiyun m4u (Multimedia Memory Management Unit) 23*4882a593Smuzhiyun | 24*4882a593Smuzhiyun +--------+ 25*4882a593Smuzhiyun | | 26*4882a593Smuzhiyun gals0-rx gals1-rx (Global Async Local Sync rx) 27*4882a593Smuzhiyun | | 28*4882a593Smuzhiyun | | 29*4882a593Smuzhiyun gals0-tx gals1-tx (Global Async Local Sync tx) 30*4882a593Smuzhiyun | | Some SoCs may have GALS. 31*4882a593Smuzhiyun +--------+ 32*4882a593Smuzhiyun | 33*4882a593Smuzhiyun SMI Common(Smart Multimedia Interface Common) 34*4882a593Smuzhiyun | 35*4882a593Smuzhiyun +----------------+------- 36*4882a593Smuzhiyun | | 37*4882a593Smuzhiyun | gals-rx There may be GALS in some larbs. 38*4882a593Smuzhiyun | | 39*4882a593Smuzhiyun | | 40*4882a593Smuzhiyun | gals-tx 41*4882a593Smuzhiyun | | 42*4882a593Smuzhiyun SMI larb0 SMI larb1 ... SoCs have several SMI local arbiter(larb). 43*4882a593Smuzhiyun (display) (vdec) 44*4882a593Smuzhiyun | | 45*4882a593Smuzhiyun | | 46*4882a593Smuzhiyun +-----+-----+ +----+----+ 47*4882a593Smuzhiyun | | | | | | 48*4882a593Smuzhiyun | | |... | | | ... There are different ports in each larb. 49*4882a593Smuzhiyun | | | | | | 50*4882a593Smuzhiyun OVL0 RDMA0 WDMA0 MC PP VLD 51*4882a593Smuzhiyun 52*4882a593Smuzhiyun As above, The Multimedia HW will go through SMI and M4U while it 53*4882a593Smuzhiyun access EMI. SMI is a bridge between m4u and the Multimedia HW. It contain 54*4882a593Smuzhiyun smi local arbiter and smi common. It will control whether the Multimedia 55*4882a593Smuzhiyun HW should go though the m4u for translation or bypass it and talk 56*4882a593Smuzhiyun directly with EMI. And also SMI help control the power domain and clocks for 57*4882a593Smuzhiyun each local arbiter. 58*4882a593Smuzhiyun 59*4882a593Smuzhiyun Normally we specify a local arbiter(larb) for each multimedia HW 60*4882a593Smuzhiyun like display, video decode, and camera. And there are different ports 61*4882a593Smuzhiyun in each larb. Take a example, There are many ports like MC, PP, VLD in the 62*4882a593Smuzhiyun video decode local arbiter, all these ports are according to the video HW. 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun In some SoCs, there may be a GALS(Global Async Local Sync) module between 65*4882a593Smuzhiyun smi-common and m4u, and additional GALS module between smi-larb and 66*4882a593Smuzhiyun smi-common. GALS can been seen as a "asynchronous fifo" which could help 67*4882a593Smuzhiyun synchronize for the modules in different clock frequency. 68*4882a593Smuzhiyun 69*4882a593Smuzhiyunproperties: 70*4882a593Smuzhiyun compatible: 71*4882a593Smuzhiyun oneOf: 72*4882a593Smuzhiyun - enum: 73*4882a593Smuzhiyun - mediatek,mt2701-m4u # generation one 74*4882a593Smuzhiyun - mediatek,mt2712-m4u # generation two 75*4882a593Smuzhiyun - mediatek,mt6779-m4u # generation two 76*4882a593Smuzhiyun - mediatek,mt8167-m4u # generation two 77*4882a593Smuzhiyun - mediatek,mt8173-m4u # generation two 78*4882a593Smuzhiyun - mediatek,mt8183-m4u # generation two 79*4882a593Smuzhiyun - mediatek,mt8192-m4u # generation two 80*4882a593Smuzhiyun 81*4882a593Smuzhiyun - description: mt7623 generation one 82*4882a593Smuzhiyun items: 83*4882a593Smuzhiyun - const: mediatek,mt7623-m4u 84*4882a593Smuzhiyun - const: mediatek,mt2701-m4u 85*4882a593Smuzhiyun 86*4882a593Smuzhiyun reg: 87*4882a593Smuzhiyun maxItems: 1 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun interrupts: 90*4882a593Smuzhiyun maxItems: 1 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun clocks: 93*4882a593Smuzhiyun items: 94*4882a593Smuzhiyun - description: bclk is the block clock. 95*4882a593Smuzhiyun 96*4882a593Smuzhiyun clock-names: 97*4882a593Smuzhiyun items: 98*4882a593Smuzhiyun - const: bclk 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun mediatek,larbs: 101*4882a593Smuzhiyun $ref: /schemas/types.yaml#/definitions/phandle-array 102*4882a593Smuzhiyun minItems: 1 103*4882a593Smuzhiyun maxItems: 32 104*4882a593Smuzhiyun description: | 105*4882a593Smuzhiyun List of phandle to the local arbiters in the current Socs. 106*4882a593Smuzhiyun Refer to bindings/memory-controllers/mediatek,smi-larb.yaml. It must sort 107*4882a593Smuzhiyun according to the local arbiter index, like larb0, larb1, larb2... 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun '#iommu-cells': 110*4882a593Smuzhiyun const: 1 111*4882a593Smuzhiyun description: | 112*4882a593Smuzhiyun This is the mtk_m4u_id according to the HW. Specifies the mtk_m4u_id as 113*4882a593Smuzhiyun defined in 114*4882a593Smuzhiyun dt-binding/memory/mt2701-larb-port.h for mt2701 and mt7623, 115*4882a593Smuzhiyun dt-binding/memory/mt2712-larb-port.h for mt2712, 116*4882a593Smuzhiyun dt-binding/memory/mt6779-larb-port.h for mt6779, 117*4882a593Smuzhiyun dt-binding/memory/mt8167-larb-port.h for mt8167, 118*4882a593Smuzhiyun dt-binding/memory/mt8173-larb-port.h for mt8173, 119*4882a593Smuzhiyun dt-binding/memory/mt8183-larb-port.h for mt8183, 120*4882a593Smuzhiyun dt-binding/memory/mt8192-larb-port.h for mt8192. 121*4882a593Smuzhiyun 122*4882a593Smuzhiyun power-domains: 123*4882a593Smuzhiyun maxItems: 1 124*4882a593Smuzhiyun 125*4882a593Smuzhiyunrequired: 126*4882a593Smuzhiyun - compatible 127*4882a593Smuzhiyun - reg 128*4882a593Smuzhiyun - interrupts 129*4882a593Smuzhiyun - mediatek,larbs 130*4882a593Smuzhiyun - '#iommu-cells' 131*4882a593Smuzhiyun 132*4882a593SmuzhiyunallOf: 133*4882a593Smuzhiyun - if: 134*4882a593Smuzhiyun properties: 135*4882a593Smuzhiyun compatible: 136*4882a593Smuzhiyun contains: 137*4882a593Smuzhiyun enum: 138*4882a593Smuzhiyun - mediatek,mt2701-m4u 139*4882a593Smuzhiyun - mediatek,mt2712-m4u 140*4882a593Smuzhiyun - mediatek,mt8173-m4u 141*4882a593Smuzhiyun - mediatek,mt8192-m4u 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun then: 144*4882a593Smuzhiyun required: 145*4882a593Smuzhiyun - clocks 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun - if: 148*4882a593Smuzhiyun properties: 149*4882a593Smuzhiyun compatible: 150*4882a593Smuzhiyun enum: 151*4882a593Smuzhiyun - mediatek,mt8192-m4u 152*4882a593Smuzhiyun 153*4882a593Smuzhiyun then: 154*4882a593Smuzhiyun required: 155*4882a593Smuzhiyun - power-domains 156*4882a593Smuzhiyun 157*4882a593SmuzhiyunadditionalProperties: false 158*4882a593Smuzhiyun 159*4882a593Smuzhiyunexamples: 160*4882a593Smuzhiyun - | 161*4882a593Smuzhiyun #include <dt-bindings/clock/mt8173-clk.h> 162*4882a593Smuzhiyun #include <dt-bindings/interrupt-controller/arm-gic.h> 163*4882a593Smuzhiyun 164*4882a593Smuzhiyun iommu: iommu@10205000 { 165*4882a593Smuzhiyun compatible = "mediatek,mt8173-m4u"; 166*4882a593Smuzhiyun reg = <0x10205000 0x1000>; 167*4882a593Smuzhiyun interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_LOW>; 168*4882a593Smuzhiyun clocks = <&infracfg CLK_INFRA_M4U>; 169*4882a593Smuzhiyun clock-names = "bclk"; 170*4882a593Smuzhiyun mediatek,larbs = <&larb0 &larb1 &larb2 171*4882a593Smuzhiyun &larb3 &larb4 &larb5>; 172*4882a593Smuzhiyun #iommu-cells = <1>; 173*4882a593Smuzhiyun }; 174*4882a593Smuzhiyun 175*4882a593Smuzhiyun - | 176*4882a593Smuzhiyun #include <dt-bindings/memory/mt8173-larb-port.h> 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun /* Example for a client device */ 179*4882a593Smuzhiyun display { 180*4882a593Smuzhiyun compatible = "mediatek,mt8173-disp"; 181*4882a593Smuzhiyun iommus = <&iommu M4U_PORT_DISP_OVL0>, 182*4882a593Smuzhiyun <&iommu M4U_PORT_DISP_RDMA0>; 183*4882a593Smuzhiyun }; 184