1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2021 Linaro Ltd.
7 #include <linux/log2.h>
10 #include "../ipa_data.h"
11 #include "../ipa_endpoint.h"
12 #include "../ipa_mem.h"
14 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v3.5.1 */
15 enum ipa_resource_type {
16 /* Source resource types; first must have value 0 */
17 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
18 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
19 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
20 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
21 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
23 /* Destination resource types; first must have value 0 */
24 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
25 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
28 /* Resource groups used for an SoC having IPA v3.5.1 */
29 enum ipa_rsrc_group_id {
30 /* Source resource group identifiers */
31 IPA_RSRC_GROUP_SRC_LWA_DL = 0,
32 IPA_RSRC_GROUP_SRC_UL_DL,
33 IPA_RSRC_GROUP_SRC_MHI_DMA,
34 IPA_RSRC_GROUP_SRC_UC_RX_Q,
35 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
37 /* Destination resource group identifiers */
38 IPA_RSRC_GROUP_DST_LWA_DL = 0,
39 IPA_RSRC_GROUP_DST_UL_DL_DPL,
40 IPA_RSRC_GROUP_DST_UNUSED_2,
41 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
44 /* QSB configuration data for an SoC having IPA v3.5.1 */
45 static const struct ipa_qsb_data ipa_qsb_data[] = {
46 [IPA_QSB_MASTER_DDR] = {
50 [IPA_QSB_MASTER_PCIE] = {
56 /* Endpoint datdata for an SoC having IPA v3.5.1 */
57 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
58 [IPA_ENDPOINT_AP_COMMAND_TX] = {
70 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
72 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
74 .seq_type = IPA_SEQ_DMA,
79 [IPA_ENDPOINT_AP_LAN_RX] = {
91 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
93 .status_enable = true,
96 .pad_align = ilog2(sizeof(u32)),
97 .aggr_time_limit = 500,
102 [IPA_ENDPOINT_AP_MODEM_TX] = {
113 .filter_support = true,
115 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
118 .status_enable = true,
120 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
121 .seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
123 IPA_ENDPOINT_MODEM_AP_RX,
128 [IPA_ENDPOINT_AP_MODEM_RX] = {
140 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
146 .aggr_time_limit = 500,
147 .aggr_close_eof = true,
152 [IPA_ENDPOINT_MODEM_LAN_TX] = {
153 .ee_id = GSI_EE_MODEM,
158 .filter_support = true,
161 [IPA_ENDPOINT_MODEM_AP_TX] = {
162 .ee_id = GSI_EE_MODEM,
167 .filter_support = true,
170 [IPA_ENDPOINT_MODEM_AP_RX] = {
171 .ee_id = GSI_EE_MODEM,
178 /* Source resource configuration data for an SoC having IPA v3.5.1 */
179 static const struct ipa_resource ipa_resource_src[] = {
180 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
181 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
184 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
187 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
191 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
192 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
193 .min = 10, .max = 10,
195 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
196 .min = 10, .max = 10,
198 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
202 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
203 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
204 .min = 12, .max = 12,
206 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
207 .min = 14, .max = 14,
209 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
213 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
214 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
217 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
220 .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = {
223 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
227 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
228 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
229 .min = 14, .max = 14,
231 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
232 .min = 20, .max = 20,
234 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
235 .min = 14, .max = 14,
240 /* Destination resource configuration data for an SoC having IPA v3.5.1 */
241 static const struct ipa_resource ipa_resource_dst[] = {
242 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
243 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
249 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
253 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
254 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
257 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
260 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
266 /* Resource configuration data for an SoC having IPA v3.5.1 */
267 static const struct ipa_resource_data ipa_resource_data = {
268 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
269 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
270 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
271 .resource_src = ipa_resource_src,
272 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
273 .resource_dst = ipa_resource_dst,
276 /* IPA-resident memory region data for an SoC having IPA v3.5.1 */
277 static const struct ipa_mem ipa_mem_local_data[] = {
279 .id = IPA_MEM_UC_SHARED,
285 .id = IPA_MEM_UC_INFO,
291 .id = IPA_MEM_V4_FILTER_HASHED,
297 .id = IPA_MEM_V4_FILTER,
303 .id = IPA_MEM_V6_FILTER_HASHED,
309 .id = IPA_MEM_V6_FILTER,
315 .id = IPA_MEM_V4_ROUTE_HASHED,
321 .id = IPA_MEM_V4_ROUTE,
327 .id = IPA_MEM_V6_ROUTE_HASHED,
333 .id = IPA_MEM_V6_ROUTE,
339 .id = IPA_MEM_MODEM_HEADER,
345 .id = IPA_MEM_MODEM_PROC_CTX,
351 .id = IPA_MEM_AP_PROC_CTX,
363 .id = IPA_MEM_UC_EVENT_RING,
370 /* Memory configuration data for an SoC having IPA v3.5.1 */
371 static const struct ipa_mem_data ipa_mem_data = {
372 .local_count = ARRAY_SIZE(ipa_mem_local_data),
373 .local = ipa_mem_local_data,
374 .imem_addr = 0x146bd000,
375 .imem_size = 0x00002000,
377 .smem_size = 0x00002000,
380 /* Interconnect bandwidths are in 1000 byte/second units */
381 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
384 .peak_bandwidth = 600000, /* 600 MBps */
385 .average_bandwidth = 80000, /* 80 MBps */
387 /* Average bandwidth is unused for the next two interconnects */
390 .peak_bandwidth = 350000, /* 350 MBps */
391 .average_bandwidth = 0, /* unused */
395 .peak_bandwidth = 40000, /* 40 MBps */
396 .average_bandwidth = 0, /* unused */
400 /* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */
401 static const struct ipa_power_data ipa_power_data = {
402 .core_clock_rate = 75 * 1000 * 1000, /* Hz */
403 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
404 .interconnect_data = ipa_interconnect_data,
407 /* Configuration data for an SoC having IPA v3.5.1 */
408 const struct ipa_data ipa_data_v3_5_1 = {
409 .version = IPA_VERSION_3_5_1,
410 .backward_compat = BIT(BCR_CMDQ_L_LACK_ONE_ENTRY) |
411 BIT(BCR_TX_NOT_USING_BRESP) |
412 BIT(BCR_SUSPEND_L2_IRQ) |
413 BIT(BCR_HOLB_DROP_L2_IRQ) |
415 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
416 .qsb_data = ipa_qsb_data,
417 .modem_route_count = 8,
418 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
419 .endpoint_data = ipa_gsi_endpoint_data,
420 .resource_data = &ipa_resource_data,
421 .mem_data = &ipa_mem_data,
422 .power_data = &ipa_power_data,