accel/ivpu: Move recovery work to system_unbound_wq
[drm/drm-misc.git] / drivers / net / ipa / data / ipa_data-v3.5.1.c
blobf632aab56f4c346e5cfc406034fce1b4b5cc67b3
1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2024 Linaro Ltd.
5 */
7 #include <linux/array_size.h>
8 #include <linux/log2.h>
10 #include "../ipa_data.h"
11 #include "../ipa_endpoint.h"
12 #include "../ipa_mem.h"
13 #include "../ipa_version.h"
15 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v3.5.1 */
16 enum ipa_resource_type {
17 /* Source resource types; first must have value 0 */
18 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
19 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
20 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
21 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
22 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
24 /* Destination resource types; first must have value 0 */
25 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
26 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
29 /* Resource groups used for an SoC having IPA v3.5.1 */
30 enum ipa_rsrc_group_id {
31 /* Source resource group identifiers */
32 IPA_RSRC_GROUP_SRC_LWA_DL = 0,
33 IPA_RSRC_GROUP_SRC_UL_DL,
34 IPA_RSRC_GROUP_SRC_MHI_DMA,
35 IPA_RSRC_GROUP_SRC_UC_RX_Q,
36 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
38 /* Destination resource group identifiers */
39 IPA_RSRC_GROUP_DST_LWA_DL = 0,
40 IPA_RSRC_GROUP_DST_UL_DL_DPL,
41 IPA_RSRC_GROUP_DST_UNUSED_2,
42 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
45 /* QSB configuration data for an SoC having IPA v3.5.1 */
46 static const struct ipa_qsb_data ipa_qsb_data[] = {
47 [IPA_QSB_MASTER_DDR] = {
48 .max_writes = 8,
49 .max_reads = 8,
51 [IPA_QSB_MASTER_PCIE] = {
52 .max_writes = 4,
53 .max_reads = 12,
57 /* Endpoint datdata for an SoC having IPA v3.5.1 */
58 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
59 [IPA_ENDPOINT_AP_COMMAND_TX] = {
60 .ee_id = GSI_EE_AP,
61 .channel_id = 4,
62 .endpoint_id = 5,
63 .toward_ipa = true,
64 .channel = {
65 .tre_count = 512,
66 .event_count = 256,
67 .tlv_count = 20,
69 .endpoint = {
70 .config = {
71 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
72 .dma_mode = true,
73 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
74 .tx = {
75 .seq_type = IPA_SEQ_DMA,
80 [IPA_ENDPOINT_AP_LAN_RX] = {
81 .ee_id = GSI_EE_AP,
82 .channel_id = 5,
83 .endpoint_id = 9,
84 .toward_ipa = false,
85 .channel = {
86 .tre_count = 256,
87 .event_count = 256,
88 .tlv_count = 8,
90 .endpoint = {
91 .config = {
92 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
93 .aggregation = true,
94 .status_enable = true,
95 .rx = {
96 .buffer_size = 8192,
97 .pad_align = ilog2(sizeof(u32)),
98 .aggr_time_limit = 500,
103 [IPA_ENDPOINT_AP_MODEM_TX] = {
104 .ee_id = GSI_EE_AP,
105 .channel_id = 3,
106 .endpoint_id = 2,
107 .toward_ipa = true,
108 .channel = {
109 .tre_count = 512,
110 .event_count = 512,
111 .tlv_count = 16,
113 .endpoint = {
114 .filter_support = true,
115 .config = {
116 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
117 .checksum = true,
118 .qmap = true,
119 .status_enable = true,
120 .tx = {
121 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
122 .seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
123 .status_endpoint =
124 IPA_ENDPOINT_MODEM_AP_RX,
129 [IPA_ENDPOINT_AP_MODEM_RX] = {
130 .ee_id = GSI_EE_AP,
131 .channel_id = 6,
132 .endpoint_id = 10,
133 .toward_ipa = false,
134 .channel = {
135 .tre_count = 256,
136 .event_count = 256,
137 .tlv_count = 8,
139 .endpoint = {
140 .config = {
141 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
142 .checksum = true,
143 .qmap = true,
144 .aggregation = true,
145 .rx = {
146 .buffer_size = 8192,
147 .aggr_time_limit = 500,
148 .aggr_close_eof = true,
153 [IPA_ENDPOINT_MODEM_LAN_TX] = {
154 .ee_id = GSI_EE_MODEM,
155 .channel_id = 0,
156 .endpoint_id = 3,
157 .toward_ipa = true,
158 .endpoint = {
159 .filter_support = true,
162 [IPA_ENDPOINT_MODEM_AP_TX] = {
163 .ee_id = GSI_EE_MODEM,
164 .channel_id = 4,
165 .endpoint_id = 6,
166 .toward_ipa = true,
167 .endpoint = {
168 .filter_support = true,
171 [IPA_ENDPOINT_MODEM_AP_RX] = {
172 .ee_id = GSI_EE_MODEM,
173 .channel_id = 2,
174 .endpoint_id = 12,
175 .toward_ipa = false,
179 /* Source resource configuration data for an SoC having IPA v3.5.1 */
180 static const struct ipa_resource ipa_resource_src[] = {
181 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
182 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
183 .min = 1, .max = 63,
185 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
186 .min = 1, .max = 63,
188 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
189 .min = 1, .max = 63,
192 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
193 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
194 .min = 10, .max = 10,
196 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
197 .min = 10, .max = 10,
199 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
200 .min = 8, .max = 8,
203 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
204 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
205 .min = 12, .max = 12,
207 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
208 .min = 14, .max = 14,
210 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
211 .min = 8, .max = 8,
214 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
215 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
216 .min = 0, .max = 63,
218 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
219 .min = 0, .max = 63,
221 .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = {
222 .min = 0, .max = 63,
224 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
225 .min = 0, .max = 63,
228 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
229 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
230 .min = 14, .max = 14,
232 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
233 .min = 20, .max = 20,
235 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
236 .min = 14, .max = 14,
241 /* Destination resource configuration data for an SoC having IPA v3.5.1 */
242 static const struct ipa_resource ipa_resource_dst[] = {
243 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
244 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
245 .min = 4, .max = 4,
247 .limits[1] = {
248 .min = 4, .max = 4,
250 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
251 .min = 3, .max = 3,
254 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
255 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
256 .min = 2, .max = 63,
258 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
259 .min = 1, .max = 63,
261 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
262 .min = 1, .max = 2,
267 /* Resource configuration data for an SoC having IPA v3.5.1 */
268 static const struct ipa_resource_data ipa_resource_data = {
269 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
270 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
271 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
272 .resource_src = ipa_resource_src,
273 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
274 .resource_dst = ipa_resource_dst,
277 /* IPA-resident memory region data for an SoC having IPA v3.5.1 */
278 static const struct ipa_mem ipa_mem_local_data[] = {
280 .id = IPA_MEM_UC_SHARED,
281 .offset = 0x0000,
282 .size = 0x0080,
283 .canary_count = 0,
286 .id = IPA_MEM_UC_INFO,
287 .offset = 0x0080,
288 .size = 0x0200,
289 .canary_count = 0,
292 .id = IPA_MEM_V4_FILTER_HASHED,
293 .offset = 0x0288,
294 .size = 0x0078,
295 .canary_count = 2,
298 .id = IPA_MEM_V4_FILTER,
299 .offset = 0x0308,
300 .size = 0x0078,
301 .canary_count = 2,
304 .id = IPA_MEM_V6_FILTER_HASHED,
305 .offset = 0x0388,
306 .size = 0x0078,
307 .canary_count = 2,
310 .id = IPA_MEM_V6_FILTER,
311 .offset = 0x0408,
312 .size = 0x0078,
313 .canary_count = 2,
316 .id = IPA_MEM_V4_ROUTE_HASHED,
317 .offset = 0x0488,
318 .size = 0x0078,
319 .canary_count = 2,
322 .id = IPA_MEM_V4_ROUTE,
323 .offset = 0x0508,
324 .size = 0x0078,
325 .canary_count = 2,
328 .id = IPA_MEM_V6_ROUTE_HASHED,
329 .offset = 0x0588,
330 .size = 0x0078,
331 .canary_count = 2,
334 .id = IPA_MEM_V6_ROUTE,
335 .offset = 0x0608,
336 .size = 0x0078,
337 .canary_count = 2,
340 .id = IPA_MEM_MODEM_HEADER,
341 .offset = 0x0688,
342 .size = 0x0140,
343 .canary_count = 2,
346 .id = IPA_MEM_MODEM_PROC_CTX,
347 .offset = 0x07d0,
348 .size = 0x0200,
349 .canary_count = 2,
352 .id = IPA_MEM_AP_PROC_CTX,
353 .offset = 0x09d0,
354 .size = 0x0200,
355 .canary_count = 0,
358 .id = IPA_MEM_MODEM,
359 .offset = 0x0bd8,
360 .size = 0x1024,
361 .canary_count = 0,
364 .id = IPA_MEM_UC_EVENT_RING,
365 .offset = 0x1c00,
366 .size = 0x0400,
367 .canary_count = 1,
371 /* Memory configuration data for an SoC having IPA v3.5.1 */
372 static const struct ipa_mem_data ipa_mem_data = {
373 .local_count = ARRAY_SIZE(ipa_mem_local_data),
374 .local = ipa_mem_local_data,
375 .imem_addr = 0x146bd000,
376 .imem_size = 0x00002000,
377 .smem_id = 497,
378 .smem_size = 0x00002000,
381 /* Interconnect bandwidths are in 1000 byte/second units */
382 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
384 .name = "memory",
385 .peak_bandwidth = 600000, /* 600 MBps */
386 .average_bandwidth = 80000, /* 80 MBps */
388 /* Average bandwidth is unused for the next two interconnects */
390 .name = "imem",
391 .peak_bandwidth = 350000, /* 350 MBps */
392 .average_bandwidth = 0, /* unused */
395 .name = "config",
396 .peak_bandwidth = 40000, /* 40 MBps */
397 .average_bandwidth = 0, /* unused */
401 /* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */
402 static const struct ipa_power_data ipa_power_data = {
403 .core_clock_rate = 75 * 1000 * 1000, /* Hz */
404 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
405 .interconnect_data = ipa_interconnect_data,
408 /* Configuration data for an SoC having IPA v3.5.1 */
409 const struct ipa_data ipa_data_v3_5_1 = {
410 .version = IPA_VERSION_3_5_1,
411 .backward_compat = BIT(BCR_CMDQ_L_LACK_ONE_ENTRY) |
412 BIT(BCR_TX_NOT_USING_BRESP) |
413 BIT(BCR_SUSPEND_L2_IRQ) |
414 BIT(BCR_HOLB_DROP_L2_IRQ) |
415 BIT(BCR_DUAL_TX),
416 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
417 .qsb_data = ipa_qsb_data,
418 .modem_route_count = 8,
419 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
420 .endpoint_data = ipa_gsi_endpoint_data,
421 .resource_data = &ipa_resource_data,
422 .mem_data = &ipa_mem_data,
423 .power_data = &ipa_power_data,