• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1* Mediatek IOMMU Architecture Implementation
2
3  Some Mediatek SOCs contain a Multimedia Memory Management Unit (M4U), and
4this M4U have two generations of HW architecture. Generation one uses flat
5pagetable, and only supports 4K size page mapping. Generation two uses the
6ARM Short-Descriptor translation table format for address translation.
7
8  About the M4U Hardware Block Diagram, please check below:
9
10              EMI (External Memory Interface)
11               |
12              m4u (Multimedia Memory Management Unit)
13               |
14          +--------+
15          |        |
16      gals0-rx   gals1-rx    (Global Async Local Sync rx)
17          |        |
18          |        |
19      gals0-tx   gals1-tx    (Global Async Local Sync tx)
20          |        |          Some SoCs may have GALS.
21          +--------+
22               |
23           SMI Common(Smart Multimedia Interface Common)
24               |
25       +----------------+-------
26       |                |
27       |             gals-rx        There may be GALS in some larbs.
28       |                |
29       |                |
30       |             gals-tx
31       |                |
32   SMI larb0        SMI larb1   ... SoCs have several SMI local arbiter(larb).
33   (display)         (vdec)
34       |                |
35       |                |
36 +-----+-----+     +----+----+
37 |     |     |     |    |    |
38 |     |     |...  |    |    |  ... There are different ports in each larb.
39 |     |     |     |    |    |
40OVL0 RDMA0 WDMA0  MC   PP   VLD
41
42  As above, The Multimedia HW will go through SMI and M4U while it
43access EMI. SMI is a bridge between m4u and the Multimedia HW. It contain
44smi local arbiter and smi common. It will control whether the Multimedia
45HW should go though the m4u for translation or bypass it and talk
46directly with EMI. And also SMI help control the power domain and clocks for
47each local arbiter.
48  Normally we specify a local arbiter(larb) for each multimedia HW
49like display, video decode, and camera. And there are different ports
50in each larb. Take a example, There are many ports like MC, PP, VLD in the
51video decode local arbiter, all these ports are according to the video HW.
52  In some SoCs, there may be a GALS(Global Async Local Sync) module between
53smi-common and m4u, and additional GALS module between smi-larb and
54smi-common. GALS can been seen as a "asynchronous fifo" which could help
55synchronize for the modules in different clock frequency.
56
57Required properties:
58- compatible : must be one of the following string:
59	"mediatek,mt2701-m4u" for mt2701 which uses generation one m4u HW.
60	"mediatek,mt2712-m4u" for mt2712 which uses generation two m4u HW.
61	"mediatek,mt6779-m4u" for mt6779 which uses generation two m4u HW.
62	"mediatek,mt7623-m4u", "mediatek,mt2701-m4u" for mt7623 which uses
63						     generation one m4u HW.
64	"mediatek,mt8167-m4u" for mt8167 which uses generation two m4u HW.
65	"mediatek,mt8173-m4u" for mt8173 which uses generation two m4u HW.
66	"mediatek,mt8183-m4u" for mt8183 which uses generation two m4u HW.
67- reg : m4u register base and size.
68- interrupts : the interrupt of m4u.
69- clocks : must contain one entry for each clock-names.
70- clock-names : Only 1 optional clock:
71  - "bclk": the block clock of m4u.
72  Here is the list which require this "bclk":
73  - mt2701, mt2712, mt7623 and mt8173.
74  Note that m4u use the EMI clock which always has been enabled before kernel
75  if there is no this "bclk".
76- mediatek,larbs : List of phandle to the local arbiters in the current Socs.
77	Refer to bindings/memory-controllers/mediatek,smi-larb.txt. It must sort
78	according to the local arbiter index, like larb0, larb1, larb2...
79- iommu-cells : must be 1. This is the mtk_m4u_id according to the HW.
80	Specifies the mtk_m4u_id as defined in
81	dt-binding/memory/mt2701-larb-port.h for mt2701, mt7623
82	dt-binding/memory/mt2712-larb-port.h for mt2712,
83	dt-binding/memory/mt6779-larb-port.h for mt6779,
84	dt-binding/memory/mt8167-larb-port.h for mt8167,
85	dt-binding/memory/mt8173-larb-port.h for mt8173, and
86	dt-binding/memory/mt8183-larb-port.h for mt8183.
87
88Example:
89	iommu: iommu@10205000 {
90		compatible = "mediatek,mt8173-m4u";
91		reg = <0 0x10205000 0 0x1000>;
92		interrupts = <GIC_SPI 139 IRQ_TYPE_LEVEL_LOW>;
93		clocks = <&infracfg CLK_INFRA_M4U>;
94		clock-names = "bclk";
95		mediatek,larbs = <&larb0 &larb1 &larb2 &larb3 &larb4 &larb5>;
96		#iommu-cells = <1>;
97	};
98
99Example for a client device:
100	display {
101		compatible = "mediatek,mt8173-disp";
102		iommus = <&iommu M4U_PORT_DISP_OVL0>,
103			 <&iommu M4U_PORT_DISP_RDMA0>;
104		...
105	};
106