1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2023-2024 Linaro Ltd. */
5 #include <linux/array_size.h>
6 #include <linux/log2.h>
8 #include "../ipa_data.h"
9 #include "../ipa_endpoint.h"
10 #include "../ipa_mem.h"
11 #include "../ipa_version.h"
13 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v5.0 */
14 enum ipa_resource_type {
15 /* Source resource types; first must have value 0 */
16 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
17 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
18 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
19 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
20 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
22 /* Destination resource types; first must have value 0 */
23 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
24 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
25 IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS,
28 /* Resource groups used for an SoC having IPA v5.0 */
29 enum ipa_rsrc_group_id {
30 /* Source resource group identifiers */
31 IPA_RSRC_GROUP_SRC_UL = 0,
32 IPA_RSRC_GROUP_SRC_DL,
33 IPA_RSRC_GROUP_SRC_UNUSED_2,
34 IPA_RSRC_GROUP_SRC_UNUSED_3,
35 IPA_RSRC_GROUP_SRC_URLLC,
36 IPA_RSRC_GROUP_SRC_U_RX_QC,
37 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
39 /* Destination resource group identifiers */
40 IPA_RSRC_GROUP_DST_UL = 0,
41 IPA_RSRC_GROUP_DST_DL,
42 IPA_RSRC_GROUP_DST_DMA,
43 IPA_RSRC_GROUP_DST_QDSS,
44 IPA_RSRC_GROUP_DST_CV2X,
45 IPA_RSRC_GROUP_DST_UC,
46 IPA_RSRC_GROUP_DST_DRB_IP,
47 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
50 /* QSB configuration data for an SoC having IPA v5.0 */
51 static const struct ipa_qsb_data ipa_qsb_data[] = {
52 [IPA_QSB_MASTER_DDR] = {
54 .max_reads = 0, /* no limit (hardware max) */
57 [IPA_QSB_MASTER_PCIE] = {
59 .max_reads = 0, /* no limit (hardware max) */
64 /* Endpoint configuration data for an SoC having IPA v5.0 */
65 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
66 [IPA_ENDPOINT_AP_COMMAND_TX] = {
78 .resource_group = IPA_RSRC_GROUP_SRC_UL,
80 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
82 .seq_type = IPA_SEQ_DMA,
87 [IPA_ENDPOINT_AP_LAN_RX] = {
99 .resource_group = IPA_RSRC_GROUP_DST_UL,
101 .status_enable = true,
104 .pad_align = ilog2(sizeof(u32)),
105 .aggr_time_limit = 500,
110 [IPA_ENDPOINT_AP_MODEM_TX] = {
121 .filter_support = true,
123 .resource_group = IPA_RSRC_GROUP_SRC_UL,
126 .status_enable = true,
128 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
130 IPA_ENDPOINT_MODEM_AP_RX,
135 [IPA_ENDPOINT_AP_MODEM_RX] = {
147 .resource_group = IPA_RSRC_GROUP_DST_DL,
153 .aggr_time_limit = 500,
154 .aggr_close_eof = true,
159 [IPA_ENDPOINT_MODEM_AP_TX] = {
160 .ee_id = GSI_EE_MODEM,
165 .filter_support = true,
168 [IPA_ENDPOINT_MODEM_AP_RX] = {
169 .ee_id = GSI_EE_MODEM,
174 [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
175 .ee_id = GSI_EE_MODEM,
180 .filter_support = true,
185 /* Source resource configuration data for an SoC having IPA v5.0 */
186 static const struct ipa_resource ipa_resource_src[] = {
187 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
188 .limits[IPA_RSRC_GROUP_SRC_UL] = {
191 .limits[IPA_RSRC_GROUP_SRC_DL] = {
194 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
197 .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
201 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
202 .limits[IPA_RSRC_GROUP_SRC_UL] = {
205 .limits[IPA_RSRC_GROUP_SRC_DL] = {
206 .min = 12, .max = 12,
208 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
209 .min = 10, .max = 10,
212 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
213 .limits[IPA_RSRC_GROUP_SRC_UL] = {
216 .limits[IPA_RSRC_GROUP_SRC_DL] = {
217 .min = 24, .max = 24,
219 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
220 .min = 20, .max = 20,
223 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
224 .limits[IPA_RSRC_GROUP_SRC_UL] = {
227 .limits[IPA_RSRC_GROUP_SRC_DL] = {
230 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
233 .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
237 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
238 .limits[IPA_RSRC_GROUP_SRC_UL] = {
239 .min = 22, .max = 22,
241 .limits[IPA_RSRC_GROUP_SRC_DL] = {
242 .min = 16, .max = 16,
244 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
245 .min = 16, .max = 16,
250 /* Destination resource configuration data for an SoC having IPA v5.0 */
251 static const struct ipa_resource ipa_resource_dst[] = {
252 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
253 .limits[IPA_RSRC_GROUP_DST_UL] = {
256 .limits[IPA_RSRC_GROUP_DST_DL] = {
259 .limits[IPA_RSRC_GROUP_DST_DRB_IP] = {
260 .min = 39, .max = 39,
263 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
264 .limits[IPA_RSRC_GROUP_DST_UL] = {
267 .limits[IPA_RSRC_GROUP_DST_DL] = {
271 [IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS] = {
272 .limits[IPA_RSRC_GROUP_DST_UL] = {
275 .limits[IPA_RSRC_GROUP_DST_DL] = {
281 /* Resource configuration data for an SoC having IPA v5.0 */
282 static const struct ipa_resource_data ipa_resource_data = {
283 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
284 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
285 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
286 .resource_src = ipa_resource_src,
287 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
288 .resource_dst = ipa_resource_dst,
291 /* IPA-resident memory region data for an SoC having IPA v5.0 */
292 static const struct ipa_mem ipa_mem_local_data[] = {
294 .id = IPA_MEM_UC_EVENT_RING,
300 .id = IPA_MEM_UC_SHARED,
306 .id = IPA_MEM_UC_INFO,
312 .id = IPA_MEM_V4_FILTER_HASHED,
318 .id = IPA_MEM_V4_FILTER,
324 .id = IPA_MEM_V6_FILTER_HASHED,
330 .id = IPA_MEM_V6_FILTER,
336 .id = IPA_MEM_V4_ROUTE_HASHED,
342 .id = IPA_MEM_V4_ROUTE,
348 .id = IPA_MEM_V6_ROUTE_HASHED,
354 .id = IPA_MEM_V6_ROUTE,
360 .id = IPA_MEM_MODEM_HEADER,
366 .id = IPA_MEM_AP_HEADER,
372 .id = IPA_MEM_MODEM_PROC_CTX,
378 .id = IPA_MEM_AP_PROC_CTX,
384 .id = IPA_MEM_STATS_QUOTA_MODEM,
390 .id = IPA_MEM_STATS_QUOTA_AP,
396 .id = IPA_MEM_AP_V4_FILTER,
402 .id = IPA_MEM_AP_V6_FILTER,
408 .id = IPA_MEM_STATS_FILTER_ROUTE,
414 .id = IPA_MEM_STATS_DROP,
426 .id = IPA_MEM_NAT_TABLE,
432 .id = IPA_MEM_PDN_CONFIG,
439 /* Memory configuration data for an SoC having IPA v5.0 */
440 static const struct ipa_mem_data ipa_mem_data = {
441 .local_count = ARRAY_SIZE(ipa_mem_local_data),
442 .local = ipa_mem_local_data,
443 .imem_addr = 0x14688000,
444 .imem_size = 0x00003000,
446 .smem_size = 0x00009000,
449 /* Interconnect rates are in 1000 byte/second units */
450 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
453 .peak_bandwidth = 1900000, /* 1.9 GBps */
454 .average_bandwidth = 600000, /* 600 MBps */
456 /* Average rate is unused for the next interconnect */
459 .peak_bandwidth = 76800, /* 76.8 MBps */
460 .average_bandwidth = 0, /* unused */
464 /* Clock and interconnect configuration data for an SoC having IPA v5.0 */
465 static const struct ipa_power_data ipa_power_data = {
466 .core_clock_rate = 120 * 1000 * 1000, /* Hz */
467 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
468 .interconnect_data = ipa_interconnect_data,
471 /* Configuration data for an SoC having IPA v5.0. */
472 const struct ipa_data ipa_data_v5_0 = {
473 .version = IPA_VERSION_5_0,
474 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
475 .qsb_data = ipa_qsb_data,
476 .modem_route_count = 11,
477 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
478 .endpoint_data = ipa_gsi_endpoint_data,
479 .resource_data = &ipa_resource_data,
480 .mem_data = &ipa_mem_data,
481 .power_data = &ipa_power_data,