1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2021 Linaro Ltd. */
5 #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 v4.9 */
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,
26 /* Resource groups used for an SoC having IPA v4.9 */
27 enum ipa_rsrc_group_id {
28 /* Source resource group identifiers */
29 IPA_RSRC_GROUP_SRC_UL_DL = 0,
30 IPA_RSRC_GROUP_SRC_DMA,
31 IPA_RSRC_GROUP_SRC_UC_RX_Q,
32 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
34 /* Destination resource group identifiers */
35 IPA_RSRC_GROUP_DST_UL_DL_DPL = 0,
36 IPA_RSRC_GROUP_DST_DMA,
37 IPA_RSRC_GROUP_DST_UC,
38 IPA_RSRC_GROUP_DST_DRB_IP,
39 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
42 /* QSB configuration data for an SoC having IPA v4.9 */
43 static const struct ipa_qsb_data ipa_qsb_data[] = {
44 [IPA_QSB_MASTER_DDR] = {
46 .max_reads = 0, /* no limit (hardware max) */
47 .max_reads_beats = 120,
51 /* Endpoint configuration data for an SoC having IPA v4.9 */
52 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
53 [IPA_ENDPOINT_AP_COMMAND_TX] = {
65 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
67 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
69 .seq_type = IPA_SEQ_DMA,
74 [IPA_ENDPOINT_AP_LAN_RX] = {
86 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
88 .status_enable = true,
91 .pad_align = ilog2(sizeof(u32)),
92 .aggr_time_limit = 500,
97 [IPA_ENDPOINT_AP_MODEM_TX] = {
108 .filter_support = true,
110 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
113 .status_enable = true,
115 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
117 IPA_ENDPOINT_MODEM_AP_RX,
122 [IPA_ENDPOINT_AP_MODEM_RX] = {
134 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
140 .aggr_time_limit = 500,
141 .aggr_close_eof = true,
146 [IPA_ENDPOINT_MODEM_AP_TX] = {
147 .ee_id = GSI_EE_MODEM,
152 .filter_support = true,
155 [IPA_ENDPOINT_MODEM_AP_RX] = {
156 .ee_id = GSI_EE_MODEM,
161 [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
162 .ee_id = GSI_EE_MODEM,
167 .filter_support = true,
172 /* Source resource configuration data for an SoC having IPA v4.9 */
173 static const struct ipa_resource ipa_resource_src[] = {
174 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
175 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
178 .limits[IPA_RSRC_GROUP_SRC_DMA] = {
181 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
185 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
186 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
187 .min = 20, .max = 20,
189 .limits[IPA_RSRC_GROUP_SRC_DMA] = {
192 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
196 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
197 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
198 .min = 38, .max = 38,
200 .limits[IPA_RSRC_GROUP_SRC_DMA] = {
203 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
207 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
208 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
211 .limits[IPA_RSRC_GROUP_SRC_DMA] = {
214 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
218 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
219 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
220 .min = 30, .max = 30,
222 .limits[IPA_RSRC_GROUP_SRC_DMA] = {
225 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
231 /* Destination resource configuration data for an SoC having IPA v4.9 */
232 static const struct ipa_resource ipa_resource_dst[] = {
233 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
234 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
237 .limits[IPA_RSRC_GROUP_DST_DMA] = {
240 .limits[IPA_RSRC_GROUP_DST_UC] = {
243 .limits[IPA_RSRC_GROUP_DST_DRB_IP] = {
244 .min = 39, .max = 39,
247 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
248 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
251 .limits[IPA_RSRC_GROUP_DST_DMA] = {
254 .limits[IPA_RSRC_GROUP_DST_UC] = {
260 /* Resource configuration data for an SoC having IPA v4.9 */
261 static const struct ipa_resource_data ipa_resource_data = {
262 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
263 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
264 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
265 .resource_src = ipa_resource_src,
266 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
267 .resource_dst = ipa_resource_dst,
270 /* IPA-resident memory region data for an SoC having IPA v4.9 */
271 static const struct ipa_mem ipa_mem_local_data[] = {
273 .id = IPA_MEM_UC_SHARED,
279 .id = IPA_MEM_UC_INFO,
285 .id = IPA_MEM_V4_FILTER_HASHED,
291 .id = IPA_MEM_V4_FILTER,
297 .id = IPA_MEM_V6_FILTER_HASHED,
303 .id = IPA_MEM_V6_FILTER,
309 .id = IPA_MEM_V4_ROUTE_HASHED,
315 .id = IPA_MEM_V4_ROUTE,
321 .id = IPA_MEM_V6_ROUTE_HASHED,
327 .id = IPA_MEM_V6_ROUTE,
333 .id = IPA_MEM_MODEM_HEADER,
339 .id = IPA_MEM_AP_HEADER,
345 .id = IPA_MEM_MODEM_PROC_CTX,
351 .id = IPA_MEM_AP_PROC_CTX,
357 .id = IPA_MEM_NAT_TABLE,
363 .id = IPA_MEM_STATS_QUOTA_MODEM,
369 .id = IPA_MEM_STATS_QUOTA_AP,
375 .id = IPA_MEM_STATS_TETHERING,
381 .id = IPA_MEM_STATS_FILTER_ROUTE,
387 .id = IPA_MEM_STATS_DROP,
399 .id = IPA_MEM_UC_EVENT_RING,
405 .id = IPA_MEM_PDN_CONFIG,
412 /* Memory configuration data for an SoC having IPA v4.9 */
413 static const struct ipa_mem_data ipa_mem_data = {
414 .local_count = ARRAY_SIZE(ipa_mem_local_data),
415 .local = ipa_mem_local_data,
416 .imem_addr = 0x146bd000,
417 .imem_size = 0x00002000,
419 .smem_size = 0x00009000,
422 /* Interconnect rates are in 1000 byte/second units */
423 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
426 .peak_bandwidth = 600000, /* 600 MBps */
427 .average_bandwidth = 150000, /* 150 MBps */
429 /* Average rate is unused for the next interconnect */
432 .peak_bandwidth = 74000, /* 74 MBps */
433 .average_bandwidth = 0, /* unused */
438 /* Clock and interconnect configuration data for an SoC having IPA v4.9 */
439 static const struct ipa_power_data ipa_power_data = {
440 .core_clock_rate = 60 * 1000 * 1000, /* Hz */
441 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
442 .interconnect_data = ipa_interconnect_data,
445 /* Configuration data for an SoC having IPA v4.9. */
446 const struct ipa_data ipa_data_v4_9 = {
447 .version = IPA_VERSION_4_9,
448 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
449 .qsb_data = ipa_qsb_data,
450 .modem_route_count = 8,
451 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
452 .endpoint_data = ipa_gsi_endpoint_data,
453 .resource_data = &ipa_resource_data,
454 .mem_data = &ipa_mem_data,
455 .power_data = &ipa_power_data,