1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (c) 2021 MediaTek Inc.
4 * Copyright (c) 2024 Collabora Ltd.
5 * AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
8 #include <linux/device.h>
9 #include <linux/interconnect.h>
10 #include <linux/interconnect-provider.h>
11 #include <linux/mod_devicetable.h>
12 #include <linux/module.h>
13 #include <linux/platform_device.h>
14 #include <dt-bindings/interconnect/mediatek,mt8195.h>
18 static struct mtk_icc_node ddr_emi
= {
24 static struct mtk_icc_node mcusys
= {
29 .links
= { SLAVE_DDR_EMI
}
32 static struct mtk_icc_node gpu
= {
37 .links
= { SLAVE_DDR_EMI
}
40 static struct mtk_icc_node mmsys
= {
45 .links
= { SLAVE_DDR_EMI
}
48 static struct mtk_icc_node mm_vpu
= {
53 .links
= { MASTER_MMSYS
}
56 static struct mtk_icc_node mm_disp
= {
61 .links
= { MASTER_MMSYS
}
64 static struct mtk_icc_node mm_vdec
= {
69 .links
= { MASTER_MMSYS
}
72 static struct mtk_icc_node mm_venc
= {
77 .links
= { MASTER_MMSYS
}
80 static struct mtk_icc_node mm_cam
= {
85 .links
= { MASTER_MMSYS
}
88 static struct mtk_icc_node mm_img
= {
93 .links
= { MASTER_MMSYS
}
96 static struct mtk_icc_node mm_mdp
= {
101 .links
= { MASTER_MMSYS
}
104 static struct mtk_icc_node vpusys
= {
109 .links
= { SLAVE_DDR_EMI
}
112 static struct mtk_icc_node vpu_port0
= {
117 .links
= { MASTER_VPUSYS
}
120 static struct mtk_icc_node vpu_port1
= {
125 .links
= { MASTER_VPUSYS
}
128 static struct mtk_icc_node mdlasys
= {
130 .id
= MASTER_MDLASYS
,
133 .links
= { SLAVE_DDR_EMI
}
136 static struct mtk_icc_node mdla_port0
= {
137 .name
= "mdla-port0",
141 .links
= { MASTER_MDLASYS
}
144 static struct mtk_icc_node ufs
= {
149 .links
= { SLAVE_DDR_EMI
}
152 static struct mtk_icc_node pcie0
= {
157 .links
= { SLAVE_DDR_EMI
}
160 static struct mtk_icc_node pcie1
= {
165 .links
= { SLAVE_DDR_EMI
}
168 static struct mtk_icc_node usb
= {
173 .links
= { SLAVE_DDR_EMI
}
176 static struct mtk_icc_node wifi
= {
181 .links
= { SLAVE_DDR_EMI
}
184 static struct mtk_icc_node bt
= {
189 .links
= { SLAVE_DDR_EMI
}
192 static struct mtk_icc_node netsys
= {
197 .links
= { SLAVE_DDR_EMI
}
200 static struct mtk_icc_node dbgif
= {
205 .links
= { SLAVE_DDR_EMI
}
208 static struct mtk_icc_node hrt_ddr_emi
= {
209 .name
= "hrt-ddr-emi",
210 .id
= SLAVE_HRT_DDR_EMI
,
214 static struct mtk_icc_node hrt_mmsys
= {
216 .id
= MASTER_HRT_MMSYS
,
219 .links
= { SLAVE_HRT_DDR_EMI
}
222 static struct mtk_icc_node hrt_mm_disp
= {
223 .name
= "hrt-mm-disp",
224 .id
= MASTER_HRT_MM_DISP
,
227 .links
= { MASTER_HRT_MMSYS
}
230 static struct mtk_icc_node hrt_mm_vdec
= {
231 .name
= "hrt-mm-vdec",
232 .id
= MASTER_HRT_MM_VDEC
,
235 .links
= { MASTER_HRT_MMSYS
}
238 static struct mtk_icc_node hrt_mm_venc
= {
239 .name
= "hrt-mm-venc",
240 .id
= MASTER_HRT_MM_VENC
,
243 .links
= { MASTER_HRT_MMSYS
}
246 static struct mtk_icc_node hrt_mm_cam
= {
247 .name
= "hrt-mm-cam",
248 .id
= MASTER_HRT_MM_CAM
,
251 .links
= { MASTER_HRT_MMSYS
}
254 static struct mtk_icc_node hrt_mm_img
= {
255 .name
= "hrt-mm-img",
256 .id
= MASTER_HRT_MM_IMG
,
259 .links
= { MASTER_HRT_MMSYS
}
262 static struct mtk_icc_node hrt_mm_mdp
= {
263 .name
= "hrt-mm-mdp",
264 .id
= MASTER_HRT_MM_MDP
,
267 .links
= { MASTER_HRT_MMSYS
}
270 static struct mtk_icc_node hrt_dbgif
= {
272 .id
= MASTER_HRT_DBGIF
,
275 .links
= { SLAVE_HRT_DDR_EMI
}
278 static struct mtk_icc_node
*mt8195_emi_icc_nodes
[] = {
279 [SLAVE_DDR_EMI
] = &ddr_emi
,
280 [MASTER_MCUSYS
] = &mcusys
,
281 [MASTER_GPUSYS
] = &gpu
,
282 [MASTER_MMSYS
] = &mmsys
,
283 [MASTER_MM_VPU
] = &mm_vpu
,
284 [MASTER_MM_DISP
] = &mm_disp
,
285 [MASTER_MM_VDEC
] = &mm_vdec
,
286 [MASTER_MM_VENC
] = &mm_venc
,
287 [MASTER_MM_CAM
] = &mm_cam
,
288 [MASTER_MM_IMG
] = &mm_img
,
289 [MASTER_MM_MDP
] = &mm_mdp
,
290 [MASTER_VPUSYS
] = &vpusys
,
291 [MASTER_VPU_0
] = &vpu_port0
,
292 [MASTER_VPU_1
] = &vpu_port1
,
293 [MASTER_MDLASYS
] = &mdlasys
,
294 [MASTER_MDLA_0
] = &mdla_port0
,
296 [MASTER_PCIE_0
] = &pcie0
,
297 [MASTER_PCIE_1
] = &pcie1
,
299 [MASTER_WIFI
] = &wifi
,
301 [MASTER_NETSYS
] = &netsys
,
302 [MASTER_DBGIF
] = &dbgif
,
303 [SLAVE_HRT_DDR_EMI
] = &hrt_ddr_emi
,
304 [MASTER_HRT_MMSYS
] = &hrt_mmsys
,
305 [MASTER_HRT_MM_DISP
] = &hrt_mm_disp
,
306 [MASTER_HRT_MM_VDEC
] = &hrt_mm_vdec
,
307 [MASTER_HRT_MM_VENC
] = &hrt_mm_venc
,
308 [MASTER_HRT_MM_CAM
] = &hrt_mm_cam
,
309 [MASTER_HRT_MM_IMG
] = &hrt_mm_img
,
310 [MASTER_HRT_MM_MDP
] = &hrt_mm_mdp
,
311 [MASTER_HRT_DBGIF
] = &hrt_dbgif
314 static struct mtk_icc_desc mt8195_emi_icc
= {
315 .nodes
= mt8195_emi_icc_nodes
,
316 .num_nodes
= ARRAY_SIZE(mt8195_emi_icc_nodes
),
319 static const struct of_device_id mtk_mt8195_emi_icc_of_match
[] = {
320 { .compatible
= "mediatek,mt8195-emi", .data
= &mt8195_emi_icc
},
323 MODULE_DEVICE_TABLE(of
, mtk_mt8195_emi_icc_of_match
);
325 static struct platform_driver mtk_emi_icc_mt8195_driver
= {
327 .name
= "emi-icc-mt8195",
328 .of_match_table
= mtk_mt8195_emi_icc_of_match
,
329 .sync_state
= icc_sync_state
,
331 .probe
= mtk_emi_icc_probe
,
332 .remove
= mtk_emi_icc_remove
,
335 module_platform_driver(mtk_emi_icc_mt8195_driver
);
337 MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>");
338 MODULE_DESCRIPTION("MediaTek MT8195 EMI ICC driver");
339 MODULE_LICENSE("GPL");