1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2023 Linaro Ltd. */
5 #include <linux/kernel.h>
6 #include <linux/log2.h>
8 #include "../ipa_data.h"
9 #include "../ipa_endpoint.h"
10 #include "../ipa_mem.h"
12 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v5.5 */
13 enum ipa_resource_type {
14 /* Source resource types; first must have value 0 */
15 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
16 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
17 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
18 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
19 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
21 /* Destination resource types; first must have value 0 */
22 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
23 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
24 IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS,
27 /* Resource groups used for an SoC having IPA v5.5 */
28 enum ipa_rsrc_group_id {
29 /* Source resource group identifiers */
30 IPA_RSRC_GROUP_SRC_UL = 0,
31 IPA_RSRC_GROUP_SRC_DL,
32 IPA_RSRC_GROUP_SRC_UNUSED_2,
33 IPA_RSRC_GROUP_SRC_UNUSED_3,
34 IPA_RSRC_GROUP_SRC_URLLC,
35 IPA_RSRC_GROUP_SRC_U_RX_QC,
36 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
38 /* Destination resource group identifiers */
39 IPA_RSRC_GROUP_DST_UL = 0,
40 IPA_RSRC_GROUP_DST_DL,
41 IPA_RSRC_GROUP_DST_UNUSED_2,
42 IPA_RSRC_GROUP_DST_UNUSED_3,
43 IPA_RSRC_GROUP_DST_UNUSED_4,
44 IPA_RSRC_GROUP_DST_UC,
45 IPA_RSRC_GROUP_DST_DRB_IP,
46 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
49 /* QSB configuration data for an SoC having IPA v5.5 */
50 static const struct ipa_qsb_data ipa_qsb_data[] = {
51 [IPA_QSB_MASTER_DDR] = {
52 .max_writes = 0, /* Unlimited */
56 [IPA_QSB_MASTER_PCIE] = {
57 .max_writes = 0, /* Unlimited */
63 /* Endpoint configuration data for an SoC having IPA v5.5 */
64 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
65 [IPA_ENDPOINT_AP_COMMAND_TX] = {
77 .resource_group = IPA_RSRC_GROUP_SRC_UL,
79 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
81 .seq_type = IPA_SEQ_DMA,
86 [IPA_ENDPOINT_AP_LAN_RX] = {
98 .resource_group = IPA_RSRC_GROUP_DST_UL,
100 .status_enable = true,
103 .pad_align = ilog2(sizeof(u32)),
104 .aggr_time_limit = 500,
109 [IPA_ENDPOINT_AP_MODEM_TX] = {
120 .filter_support = true,
122 .resource_group = IPA_RSRC_GROUP_SRC_UL,
125 .status_enable = true,
127 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
129 IPA_ENDPOINT_MODEM_AP_RX,
134 [IPA_ENDPOINT_AP_MODEM_RX] = {
146 .resource_group = IPA_RSRC_GROUP_DST_DL,
152 .aggr_time_limit = 500,
153 .aggr_close_eof = true,
158 [IPA_ENDPOINT_MODEM_AP_TX] = {
159 .ee_id = GSI_EE_MODEM,
164 .filter_support = true,
167 [IPA_ENDPOINT_MODEM_AP_RX] = {
168 .ee_id = GSI_EE_MODEM,
173 [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
174 .ee_id = GSI_EE_MODEM,
179 .filter_support = true,
184 /* Source resource configuration data for an SoC having IPA v5.5 */
185 static const struct ipa_resource ipa_resource_src[] = {
186 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
187 .limits[IPA_RSRC_GROUP_SRC_UL] = {
190 .limits[IPA_RSRC_GROUP_SRC_DL] = {
193 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
196 .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
200 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
201 .limits[IPA_RSRC_GROUP_SRC_UL] = {
204 .limits[IPA_RSRC_GROUP_SRC_DL] = {
205 .min = 12, .max = 12,
207 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
208 .min = 10, .max = 10,
211 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
212 .limits[IPA_RSRC_GROUP_SRC_UL] = {
215 .limits[IPA_RSRC_GROUP_SRC_DL] = {
216 .min = 24, .max = 24,
218 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
219 .min = 20, .max = 20,
222 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
223 .limits[IPA_RSRC_GROUP_SRC_UL] = {
226 .limits[IPA_RSRC_GROUP_SRC_DL] = {
229 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
232 .limits[IPA_RSRC_GROUP_SRC_U_RX_QC] = {
236 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
237 .limits[IPA_RSRC_GROUP_SRC_UL] = {
238 .min = 22, .max = 22,
240 .limits[IPA_RSRC_GROUP_SRC_DL] = {
241 .min = 16, .max = 16,
243 .limits[IPA_RSRC_GROUP_SRC_URLLC] = {
244 .min = 16, .max = 16,
249 /* Destination resource configuration data for an SoC having IPA v5.5 */
250 static const struct ipa_resource ipa_resource_dst[] = {
251 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
252 .limits[IPA_RSRC_GROUP_DST_UL] = {
255 .limits[IPA_RSRC_GROUP_DST_DL] = {
258 .limits[IPA_RSRC_GROUP_DST_DRB_IP] = {
259 .min = 39, .max = 39,
262 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
263 .limits[IPA_RSRC_GROUP_DST_UL] = {
266 .limits[IPA_RSRC_GROUP_DST_DL] = {
270 [IPA_RESOURCE_TYPE_DST_ULSO_SEGMENTS] = {
271 .limits[IPA_RSRC_GROUP_DST_UL] = {
274 .limits[IPA_RSRC_GROUP_DST_DL] = {
280 /* Resource configuration data for an SoC having IPA v5.5 */
281 static const struct ipa_resource_data ipa_resource_data = {
282 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
283 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
284 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
285 .resource_src = ipa_resource_src,
286 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
287 .resource_dst = ipa_resource_dst,
290 /* IPA-resident memory region data for an SoC having IPA v5.5 */
291 static const struct ipa_mem ipa_mem_local_data[] = {
293 .id = IPA_MEM_UC_EVENT_RING,
299 .id = IPA_MEM_UC_SHARED,
305 .id = IPA_MEM_UC_INFO,
311 .id = IPA_MEM_V4_FILTER_HASHED,
317 .id = IPA_MEM_V4_FILTER,
323 .id = IPA_MEM_V6_FILTER_HASHED,
329 .id = IPA_MEM_V6_FILTER,
335 .id = IPA_MEM_V4_ROUTE_HASHED,
341 .id = IPA_MEM_V4_ROUTE,
347 .id = IPA_MEM_V6_ROUTE_HASHED,
353 .id = IPA_MEM_V6_ROUTE,
359 .id = IPA_MEM_MODEM_HEADER,
365 .id = IPA_MEM_AP_HEADER,
371 .id = IPA_MEM_MODEM_PROC_CTX,
377 .id = IPA_MEM_AP_PROC_CTX,
383 .id = IPA_MEM_STATS_QUOTA_MODEM,
389 .id = IPA_MEM_STATS_QUOTA_AP,
395 .id = IPA_MEM_STATS_TETHERING,
401 .id = IPA_MEM_AP_V4_FILTER,
407 .id = IPA_MEM_AP_V6_FILTER,
413 .id = IPA_MEM_STATS_FILTER_ROUTE,
419 .id = IPA_MEM_STATS_DROP,
431 .id = IPA_MEM_NAT_TABLE,
437 .id = IPA_MEM_PDN_CONFIG,
444 /* Memory configuration data for an SoC having IPA v5.5 */
445 static const struct ipa_mem_data ipa_mem_data = {
446 .local_count = ARRAY_SIZE(ipa_mem_local_data),
447 .local = ipa_mem_local_data,
448 .imem_addr = 0x14688000,
449 .imem_size = 0x00002000,
451 .smem_size = 0x0000b000,
454 /* Interconnect rates are in 1000 byte/second units */
455 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
458 .peak_bandwidth = 1900000, /* 1.9 GBps */
459 .average_bandwidth = 600000, /* 600 MBps */
461 /* Average rate is unused for the next interconnect */
464 .peak_bandwidth = 76800, /* 76.8 MBps */
465 .average_bandwidth = 0, /* unused */
469 /* Clock and interconnect configuration data for an SoC having IPA v5.5 */
470 static const struct ipa_power_data ipa_power_data = {
471 .core_clock_rate = 120 * 1000 * 1000, /* Hz */
472 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
473 .interconnect_data = ipa_interconnect_data,
476 /* Configuration data for an SoC having IPA v5.5. */
477 const struct ipa_data ipa_data_v5_5 = {
478 .version = IPA_VERSION_5_5,
479 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
480 .qsb_data = ipa_qsb_data,
481 .modem_route_count = 11,
482 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
483 .endpoint_data = ipa_gsi_endpoint_data,
484 .resource_data = &ipa_resource_data,
485 .mem_data = &ipa_mem_data,
486 .power_data = &ipa_power_data,