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>
11 #include "ipa_endpoint.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,
95 .pad_align = ilog2(sizeof(u32)),
100 [IPA_ENDPOINT_AP_MODEM_TX] = {
111 .filter_support = true,
113 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
116 .status_enable = true,
118 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
119 .seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
121 IPA_ENDPOINT_MODEM_AP_RX,
126 [IPA_ENDPOINT_AP_MODEM_RX] = {
138 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
143 .aggr_close_eof = true,
148 [IPA_ENDPOINT_MODEM_LAN_TX] = {
149 .ee_id = GSI_EE_MODEM,
154 .filter_support = true,
157 [IPA_ENDPOINT_MODEM_AP_TX] = {
158 .ee_id = GSI_EE_MODEM,
163 .filter_support = true,
166 [IPA_ENDPOINT_MODEM_AP_RX] = {
167 .ee_id = GSI_EE_MODEM,
174 /* Source resource configuration data for an SoC having IPA v3.5.1 */
175 static const struct ipa_resource ipa_resource_src[] = {
176 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
177 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
178 .min = 1, .max = 255,
180 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
181 .min = 1, .max = 255,
183 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
187 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
188 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
189 .min = 10, .max = 10,
191 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
192 .min = 10, .max = 10,
194 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
198 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
199 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
200 .min = 12, .max = 12,
202 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
203 .min = 14, .max = 14,
205 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
209 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
210 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
213 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
216 .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = {
219 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
223 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
224 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
225 .min = 14, .max = 14,
227 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
228 .min = 20, .max = 20,
230 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
231 .min = 14, .max = 14,
236 /* Destination resource configuration data for an SoC having IPA v3.5.1 */
237 static const struct ipa_resource ipa_resource_dst[] = {
238 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
239 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
245 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
249 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
250 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
253 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
256 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
262 /* Resource configuration data for an SoC having IPA v3.5.1 */
263 static const struct ipa_resource_data ipa_resource_data = {
264 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
265 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
266 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
267 .resource_src = ipa_resource_src,
268 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
269 .resource_dst = ipa_resource_dst,
272 /* IPA-resident memory region data for an SoC having IPA v3.5.1 */
273 static const struct ipa_mem ipa_mem_local_data[] = {
275 .id = IPA_MEM_UC_SHARED,
281 .id = IPA_MEM_UC_INFO,
287 .id = IPA_MEM_V4_FILTER_HASHED,
293 .id = IPA_MEM_V4_FILTER,
299 .id = IPA_MEM_V6_FILTER_HASHED,
305 .id = IPA_MEM_V6_FILTER,
311 .id = IPA_MEM_V4_ROUTE_HASHED,
317 .id = IPA_MEM_V4_ROUTE,
323 .id = IPA_MEM_V6_ROUTE_HASHED,
329 .id = IPA_MEM_V6_ROUTE,
335 .id = IPA_MEM_MODEM_HEADER,
341 .id = IPA_MEM_MODEM_PROC_CTX,
347 .id = IPA_MEM_AP_PROC_CTX,
359 .id = IPA_MEM_UC_EVENT_RING,
366 /* Memory configuration data for an SoC having IPA v3.5.1 */
367 static const struct ipa_mem_data ipa_mem_data = {
368 .local_count = ARRAY_SIZE(ipa_mem_local_data),
369 .local = ipa_mem_local_data,
370 .imem_addr = 0x146bd000,
371 .imem_size = 0x00002000,
373 .smem_size = 0x00002000,
376 /* Interconnect bandwidths are in 1000 byte/second units */
377 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
380 .peak_bandwidth = 600000, /* 600 MBps */
381 .average_bandwidth = 80000, /* 80 MBps */
383 /* Average bandwidth is unused for the next two interconnects */
386 .peak_bandwidth = 350000, /* 350 MBps */
387 .average_bandwidth = 0, /* unused */
391 .peak_bandwidth = 40000, /* 40 MBps */
392 .average_bandwidth = 0, /* unused */
396 /* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */
397 static const struct ipa_clock_data ipa_clock_data = {
398 .core_clock_rate = 75 * 1000 * 1000, /* Hz */
399 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
400 .interconnect_data = ipa_interconnect_data,
403 /* Configuration data for an SoC having IPA v3.5.1 */
404 const struct ipa_data ipa_data_v3_5_1 = {
405 .version = IPA_VERSION_3_5_1,
406 .backward_compat = BCR_CMDQ_L_LACK_ONE_ENTRY_FMASK |
407 BCR_TX_NOT_USING_BRESP_FMASK |
408 BCR_SUSPEND_L2_IRQ_FMASK |
409 BCR_HOLB_DROP_L2_IRQ_FMASK |
411 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
412 .qsb_data = ipa_qsb_data,
413 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
414 .endpoint_data = ipa_gsi_endpoint_data,
415 .resource_data = &ipa_resource_data,
416 .mem_data = &ipa_mem_data,
417 .clock_data = &ipa_clock_data,