1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2024 Linaro Ltd.
7 #include <linux/array_size.h>
8 #include <linux/log2.h>
10 #include "../ipa_data.h"
11 #include "../ipa_endpoint.h"
12 #include "../ipa_mem.h"
13 #include "../ipa_version.h"
15 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v3.5.1 */
16 enum ipa_resource_type
{
17 /* Source resource types; first must have value 0 */
18 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
= 0,
19 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS
,
20 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
,
21 IPA_RESOURCE_TYPE_SRC_HPS_DMARS
,
22 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
,
24 /* Destination resource types; first must have value 0 */
25 IPA_RESOURCE_TYPE_DST_DATA_SECTORS
= 0,
26 IPA_RESOURCE_TYPE_DST_DPS_DMARS
,
29 /* Resource groups used for an SoC having IPA v3.5.1 */
30 enum ipa_rsrc_group_id
{
31 /* Source resource group identifiers */
32 IPA_RSRC_GROUP_SRC_LWA_DL
= 0,
33 IPA_RSRC_GROUP_SRC_UL_DL
,
34 IPA_RSRC_GROUP_SRC_MHI_DMA
,
35 IPA_RSRC_GROUP_SRC_UC_RX_Q
,
36 IPA_RSRC_GROUP_SRC_COUNT
, /* Last in set; not a source group */
38 /* Destination resource group identifiers */
39 IPA_RSRC_GROUP_DST_LWA_DL
= 0,
40 IPA_RSRC_GROUP_DST_UL_DL_DPL
,
41 IPA_RSRC_GROUP_DST_UNUSED_2
,
42 IPA_RSRC_GROUP_DST_COUNT
, /* Last; not a destination group */
45 /* QSB configuration data for an SoC having IPA v3.5.1 */
46 static const struct ipa_qsb_data ipa_qsb_data
[] = {
47 [IPA_QSB_MASTER_DDR
] = {
51 [IPA_QSB_MASTER_PCIE
] = {
57 /* Endpoint datdata for an SoC having IPA v3.5.1 */
58 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data
[] = {
59 [IPA_ENDPOINT_AP_COMMAND_TX
] = {
71 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
73 .dma_endpoint
= IPA_ENDPOINT_AP_LAN_RX
,
75 .seq_type
= IPA_SEQ_DMA
,
80 [IPA_ENDPOINT_AP_LAN_RX
] = {
92 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
94 .status_enable
= true,
97 .pad_align
= ilog2(sizeof(u32
)),
98 .aggr_time_limit
= 500,
103 [IPA_ENDPOINT_AP_MODEM_TX
] = {
114 .filter_support
= true,
116 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
119 .status_enable
= true,
121 .seq_type
= IPA_SEQ_2_PASS_SKIP_LAST_UC
,
122 .seq_rep_type
= IPA_SEQ_REP_DMA_PARSER
,
124 IPA_ENDPOINT_MODEM_AP_RX
,
129 [IPA_ENDPOINT_AP_MODEM_RX
] = {
141 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
147 .aggr_time_limit
= 500,
148 .aggr_close_eof
= true,
153 [IPA_ENDPOINT_MODEM_LAN_TX
] = {
154 .ee_id
= GSI_EE_MODEM
,
159 .filter_support
= true,
162 [IPA_ENDPOINT_MODEM_AP_TX
] = {
163 .ee_id
= GSI_EE_MODEM
,
168 .filter_support
= true,
171 [IPA_ENDPOINT_MODEM_AP_RX
] = {
172 .ee_id
= GSI_EE_MODEM
,
179 /* Source resource configuration data for an SoC having IPA v3.5.1 */
180 static const struct ipa_resource ipa_resource_src
[] = {
181 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
] = {
182 .limits
[IPA_RSRC_GROUP_SRC_LWA_DL
] = {
185 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
188 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
192 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS
] = {
193 .limits
[IPA_RSRC_GROUP_SRC_LWA_DL
] = {
194 .min
= 10, .max
= 10,
196 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
197 .min
= 10, .max
= 10,
199 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
203 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
] = {
204 .limits
[IPA_RSRC_GROUP_SRC_LWA_DL
] = {
205 .min
= 12, .max
= 12,
207 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
208 .min
= 14, .max
= 14,
210 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
214 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS
] = {
215 .limits
[IPA_RSRC_GROUP_SRC_LWA_DL
] = {
218 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
221 .limits
[IPA_RSRC_GROUP_SRC_MHI_DMA
] = {
224 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
228 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
] = {
229 .limits
[IPA_RSRC_GROUP_SRC_LWA_DL
] = {
230 .min
= 14, .max
= 14,
232 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
233 .min
= 20, .max
= 20,
235 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
236 .min
= 14, .max
= 14,
241 /* Destination resource configuration data for an SoC having IPA v3.5.1 */
242 static const struct ipa_resource ipa_resource_dst
[] = {
243 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS
] = {
244 .limits
[IPA_RSRC_GROUP_DST_LWA_DL
] = {
250 .limits
[IPA_RSRC_GROUP_DST_UNUSED_2
] = {
254 [IPA_RESOURCE_TYPE_DST_DPS_DMARS
] = {
255 .limits
[IPA_RSRC_GROUP_DST_LWA_DL
] = {
258 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
261 .limits
[IPA_RSRC_GROUP_DST_UNUSED_2
] = {
267 /* Resource configuration data for an SoC having IPA v3.5.1 */
268 static const struct ipa_resource_data ipa_resource_data
= {
269 .rsrc_group_src_count
= IPA_RSRC_GROUP_SRC_COUNT
,
270 .rsrc_group_dst_count
= IPA_RSRC_GROUP_DST_COUNT
,
271 .resource_src_count
= ARRAY_SIZE(ipa_resource_src
),
272 .resource_src
= ipa_resource_src
,
273 .resource_dst_count
= ARRAY_SIZE(ipa_resource_dst
),
274 .resource_dst
= ipa_resource_dst
,
277 /* IPA-resident memory region data for an SoC having IPA v3.5.1 */
278 static const struct ipa_mem ipa_mem_local_data
[] = {
280 .id
= IPA_MEM_UC_SHARED
,
286 .id
= IPA_MEM_UC_INFO
,
292 .id
= IPA_MEM_V4_FILTER_HASHED
,
298 .id
= IPA_MEM_V4_FILTER
,
304 .id
= IPA_MEM_V6_FILTER_HASHED
,
310 .id
= IPA_MEM_V6_FILTER
,
316 .id
= IPA_MEM_V4_ROUTE_HASHED
,
322 .id
= IPA_MEM_V4_ROUTE
,
328 .id
= IPA_MEM_V6_ROUTE_HASHED
,
334 .id
= IPA_MEM_V6_ROUTE
,
340 .id
= IPA_MEM_MODEM_HEADER
,
346 .id
= IPA_MEM_MODEM_PROC_CTX
,
352 .id
= IPA_MEM_AP_PROC_CTX
,
364 .id
= IPA_MEM_UC_EVENT_RING
,
371 /* Memory configuration data for an SoC having IPA v3.5.1 */
372 static const struct ipa_mem_data ipa_mem_data
= {
373 .local_count
= ARRAY_SIZE(ipa_mem_local_data
),
374 .local
= ipa_mem_local_data
,
375 .imem_addr
= 0x146bd000,
376 .imem_size
= 0x00002000,
378 .smem_size
= 0x00002000,
381 /* Interconnect bandwidths are in 1000 byte/second units */
382 static const struct ipa_interconnect_data ipa_interconnect_data
[] = {
385 .peak_bandwidth
= 600000, /* 600 MBps */
386 .average_bandwidth
= 80000, /* 80 MBps */
388 /* Average bandwidth is unused for the next two interconnects */
391 .peak_bandwidth
= 350000, /* 350 MBps */
392 .average_bandwidth
= 0, /* unused */
396 .peak_bandwidth
= 40000, /* 40 MBps */
397 .average_bandwidth
= 0, /* unused */
401 /* Clock and interconnect configuration data for an SoC having IPA v3.5.1 */
402 static const struct ipa_power_data ipa_power_data
= {
403 .core_clock_rate
= 75 * 1000 * 1000, /* Hz */
404 .interconnect_count
= ARRAY_SIZE(ipa_interconnect_data
),
405 .interconnect_data
= ipa_interconnect_data
,
408 /* Configuration data for an SoC having IPA v3.5.1 */
409 const struct ipa_data ipa_data_v3_5_1
= {
410 .version
= IPA_VERSION_3_5_1
,
411 .backward_compat
= BIT(BCR_CMDQ_L_LACK_ONE_ENTRY
) |
412 BIT(BCR_TX_NOT_USING_BRESP
) |
413 BIT(BCR_SUSPEND_L2_IRQ
) |
414 BIT(BCR_HOLB_DROP_L2_IRQ
) |
416 .qsb_count
= ARRAY_SIZE(ipa_qsb_data
),
417 .qsb_data
= ipa_qsb_data
,
418 .modem_route_count
= 8,
419 .endpoint_count
= ARRAY_SIZE(ipa_gsi_endpoint_data
),
420 .endpoint_data
= ipa_gsi_endpoint_data
,
421 .resource_data
= &ipa_resource_data
,
422 .mem_data
= &ipa_mem_data
,
423 .power_data
= &ipa_power_data
,