summaryrefslogtreecommitdiffstats
path: root/drivers/interconnect/mediatek/mt8195.c
blob: 710e14c5447ccf8fc851f72bad0a5bae8325cc40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2021 MediaTek Inc.
 * Copyright (c) 2024 Collabora Ltd.
 *                    AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
 */

#include <linux/device.h>
#include <linux/interconnect.h>
#include <linux/interconnect-provider.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <dt-bindings/interconnect/mediatek,mt8195.h>

#include "icc-emi.h"

static struct mtk_icc_node ddr_emi = {
	.name = "ddr-emi",
	.id = SLAVE_DDR_EMI,
	.ep = 1,
};

static struct mtk_icc_node mcusys = {
	.name = "mcusys",
	.id = MASTER_MCUSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node gpu = {
	.name = "gpu",
	.id = MASTER_GPUSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node mmsys = {
	.name = "mmsys",
	.id = MASTER_MMSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node mm_vpu = {
	.name = "mm-vpu",
	.id = MASTER_MM_VPU,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_disp = {
	.name = "mm-disp",
	.id = MASTER_MM_DISP,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_vdec = {
	.name = "mm-vdec",
	.id = MASTER_MM_VDEC,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_venc = {
	.name = "mm-venc",
	.id = MASTER_MM_VENC,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_cam = {
	.name = "mm-cam",
	.id = MASTER_MM_CAM,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_img = {
	.name = "mm-img",
	.id = MASTER_MM_IMG,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node mm_mdp = {
	.name = "mm-mdp",
	.id = MASTER_MM_MDP,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MMSYS }
};

static struct mtk_icc_node vpusys = {
	.name = "vpusys",
	.id = MASTER_VPUSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node vpu_port0 = {
	.name = "vpu-port0",
	.id = MASTER_VPU_0,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_VPUSYS }
};

static struct mtk_icc_node vpu_port1 = {
	.name = "vpu-port1",
	.id = MASTER_VPU_1,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_VPUSYS }
};

static struct mtk_icc_node mdlasys = {
	.name = "mdlasys",
	.id = MASTER_MDLASYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node mdla_port0 = {
	.name = "mdla-port0",
	.id = MASTER_MDLA_0,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_MDLASYS }
};

static struct mtk_icc_node ufs = {
	.name = "ufs",
	.id = MASTER_UFS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node pcie0 = {
	.name = "pcie0",
	.id = MASTER_PCIE_0,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node pcie1 = {
	.name = "pcie1",
	.id = MASTER_PCIE_1,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node usb = {
	.name = "usb",
	.id = MASTER_USB,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node wifi = {
	.name = "wifi",
	.id = MASTER_WIFI,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node bt = {
	.name = "bt",
	.id = MASTER_BT,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node netsys = {
	.name = "netsys",
	.id = MASTER_NETSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node dbgif = {
	.name = "dbgif",
	.id = MASTER_DBGIF,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_DDR_EMI }
};

static struct mtk_icc_node hrt_ddr_emi = {
	.name = "hrt-ddr-emi",
	.id = SLAVE_HRT_DDR_EMI,
	.ep = 2,
};

static struct mtk_icc_node hrt_mmsys = {
	.name = "hrt-mmsys",
	.id = MASTER_HRT_MMSYS,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_HRT_DDR_EMI }
};

static struct mtk_icc_node hrt_mm_disp = {
	.name = "hrt-mm-disp",
	.id = MASTER_HRT_MM_DISP,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_mm_vdec = {
	.name = "hrt-mm-vdec",
	.id = MASTER_HRT_MM_VDEC,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_mm_venc = {
	.name = "hrt-mm-venc",
	.id = MASTER_HRT_MM_VENC,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_mm_cam = {
	.name = "hrt-mm-cam",
	.id = MASTER_HRT_MM_CAM,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_mm_img = {
	.name = "hrt-mm-img",
	.id = MASTER_HRT_MM_IMG,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_mm_mdp = {
	.name = "hrt-mm-mdp",
	.id = MASTER_HRT_MM_MDP,
	.ep = 0,
	.num_links = 1,
	.links = { MASTER_HRT_MMSYS }
};

static struct mtk_icc_node hrt_dbgif = {
	.name = "hrt-dbgif",
	.id = MASTER_HRT_DBGIF,
	.ep = 0,
	.num_links = 1,
	.links = { SLAVE_HRT_DDR_EMI }
};

static struct mtk_icc_node *mt8195_emi_icc_nodes[] = {
	[SLAVE_DDR_EMI] = &ddr_emi,
	[MASTER_MCUSYS] = &mcusys,
	[MASTER_GPUSYS] = &gpu,
	[MASTER_MMSYS] = &mmsys,
	[MASTER_MM_VPU] = &mm_vpu,
	[MASTER_MM_DISP] = &mm_disp,
	[MASTER_MM_VDEC] = &mm_vdec,
	[MASTER_MM_VENC] = &mm_venc,
	[MASTER_MM_CAM] = &mm_cam,
	[MASTER_MM_IMG] = &mm_img,
	[MASTER_MM_MDP] = &mm_mdp,
	[MASTER_VPUSYS] = &vpusys,
	[MASTER_VPU_0] = &vpu_port0,
	[MASTER_VPU_1] = &vpu_port1,
	[MASTER_MDLASYS] = &mdlasys,
	[MASTER_MDLA_0] = &mdla_port0,
	[MASTER_UFS] = &ufs,
	[MASTER_PCIE_0] = &pcie0,
	[MASTER_PCIE_1] = &pcie1,
	[MASTER_USB] = &usb,
	[MASTER_WIFI] = &wifi,
	[MASTER_BT] = &bt,
	[MASTER_NETSYS] = &netsys,
	[MASTER_DBGIF] = &dbgif,
	[SLAVE_HRT_DDR_EMI] = &hrt_ddr_emi,
	[MASTER_HRT_MMSYS] = &hrt_mmsys,
	[MASTER_HRT_MM_DISP] = &hrt_mm_disp,
	[MASTER_HRT_MM_VDEC] = &hrt_mm_vdec,
	[MASTER_HRT_MM_VENC] = &hrt_mm_venc,
	[MASTER_HRT_MM_CAM] = &hrt_mm_cam,
	[MASTER_HRT_MM_IMG] = &hrt_mm_img,
	[MASTER_HRT_MM_MDP] = &hrt_mm_mdp,
	[MASTER_HRT_DBGIF] = &hrt_dbgif
};

static struct mtk_icc_desc mt8195_emi_icc = {
	.nodes = mt8195_emi_icc_nodes,
	.num_nodes = ARRAY_SIZE(mt8195_emi_icc_nodes),
};

static const struct of_device_id mtk_mt8195_emi_icc_of_match[] = {
	{ .compatible = "mediatek,mt8195-emi", .data = &mt8195_emi_icc },
	{ /* sentinel */ },
};
MODULE_DEVICE_TABLE(of, mtk_mt8195_emi_icc_of_match);

static struct platform_driver mtk_emi_icc_mt8195_driver = {
	.driver = {
		.name = "emi-icc-mt8195",
		.of_match_table = mtk_mt8195_emi_icc_of_match,
		.sync_state = icc_sync_state,
	},
	.probe = mtk_emi_icc_probe,
	.remove_new = mtk_emi_icc_remove,

};
module_platform_driver(mtk_emi_icc_mt8195_driver);

MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>");
MODULE_DESCRIPTION("MediaTek MT8195 EMI ICC driver");
MODULE_LICENSE("GPL");