1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2021-2024 Linaro Ltd. */
5 #include <linux/array_size.h>
6 #include <linux/log2.h>
8 #include "../ipa_data.h"
9 #include "../ipa_endpoint.h"
10 #include "../ipa_mem.h"
11 #include "../ipa_version.h"
13 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.5 */
14 enum ipa_resource_type
{
15 /* Source resource types; first must have value 0 */
16 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
= 0,
17 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS
,
18 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
,
19 IPA_RESOURCE_TYPE_SRC_HPS_DMARS
,
20 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
,
22 /* Destination resource types; first must have value 0 */
23 IPA_RESOURCE_TYPE_DST_DATA_SECTORS
= 0,
24 IPA_RESOURCE_TYPE_DST_DPS_DMARS
,
27 /* Resource groups used for an SoC having IPA v4.5 */
28 enum ipa_rsrc_group_id
{
29 /* Source resource group identifiers */
30 IPA_RSRC_GROUP_SRC_UNUSED_0
= 0,
31 IPA_RSRC_GROUP_SRC_UL_DL
,
32 IPA_RSRC_GROUP_SRC_UNUSED_2
,
33 IPA_RSRC_GROUP_SRC_UNUSED_3
,
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_UNUSED_0
= 0,
39 IPA_RSRC_GROUP_DST_UL_DL_DPL
,
40 IPA_RSRC_GROUP_DST_UNUSED_2
,
41 IPA_RSRC_GROUP_DST_UNUSED_3
,
42 IPA_RSRC_GROUP_DST_UC
,
43 IPA_RSRC_GROUP_DST_COUNT
, /* Last; not a destination group */
46 /* QSB configuration data for an SoC having IPA v4.5 */
47 static const struct ipa_qsb_data ipa_qsb_data
[] = {
48 [IPA_QSB_MASTER_DDR
] = {
50 .max_reads
= 0, /* no limit (hardware max) */
51 .max_reads_beats
= 120,
53 [IPA_QSB_MASTER_PCIE
] = {
56 /* no outstanding read byte (beat) limit */
60 /* Endpoint configuration data for an SoC having IPA v4.5 */
61 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data
[] = {
62 [IPA_ENDPOINT_AP_COMMAND_TX
] = {
74 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
76 .dma_endpoint
= IPA_ENDPOINT_AP_LAN_RX
,
78 .seq_type
= IPA_SEQ_DMA
,
83 [IPA_ENDPOINT_AP_LAN_RX
] = {
95 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
97 .status_enable
= true,
100 .pad_align
= ilog2(sizeof(u32
)),
101 .aggr_time_limit
= 500,
106 [IPA_ENDPOINT_AP_MODEM_TX
] = {
117 .filter_support
= true,
119 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
122 .status_enable
= true,
124 .seq_type
= IPA_SEQ_2_PASS_SKIP_LAST_UC
,
126 IPA_ENDPOINT_MODEM_AP_RX
,
131 [IPA_ENDPOINT_AP_MODEM_RX
] = {
143 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
149 .aggr_time_limit
= 500,
150 .aggr_close_eof
= true,
155 [IPA_ENDPOINT_MODEM_AP_TX
] = {
156 .ee_id
= GSI_EE_MODEM
,
161 .filter_support
= true,
164 [IPA_ENDPOINT_MODEM_AP_RX
] = {
165 .ee_id
= GSI_EE_MODEM
,
170 [IPA_ENDPOINT_MODEM_DL_NLO_TX
] = {
171 .ee_id
= GSI_EE_MODEM
,
176 .filter_support
= true,
181 /* Source resource configuration data for an SoC having IPA v4.5 */
182 static const struct ipa_resource ipa_resource_src
[] = {
183 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
] = {
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_UL_DL
] = {
193 .min
= 14, .max
= 14,
195 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
199 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
] = {
200 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
201 .min
= 18, .max
= 18,
203 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
207 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS
] = {
208 .limits
[IPA_RSRC_GROUP_SRC_UNUSED_0
] = {
211 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
214 .limits
[IPA_RSRC_GROUP_SRC_UNUSED_2
] = {
217 .limits
[IPA_RSRC_GROUP_SRC_UNUSED_3
] = {
220 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
224 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
] = {
225 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
226 .min
= 24, .max
= 24,
228 .limits
[IPA_RSRC_GROUP_SRC_UC_RX_Q
] = {
234 /* Destination resource configuration data for an SoC having IPA v4.5 */
235 static const struct ipa_resource ipa_resource_dst
[] = {
236 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS
] = {
237 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
238 .min
= 16, .max
= 16,
240 .limits
[IPA_RSRC_GROUP_DST_UNUSED_2
] = {
243 .limits
[IPA_RSRC_GROUP_DST_UNUSED_3
] = {
247 [IPA_RESOURCE_TYPE_DST_DPS_DMARS
] = {
248 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
251 .limits
[IPA_RSRC_GROUP_DST_UNUSED_2
] = {
254 .limits
[IPA_RSRC_GROUP_DST_UNUSED_3
] = {
257 .limits
[IPA_RSRC_GROUP_DST_UC
] = {
263 /* Resource configuration data for an SoC having IPA v4.5 */
264 static const struct ipa_resource_data ipa_resource_data
= {
265 .rsrc_group_src_count
= IPA_RSRC_GROUP_SRC_COUNT
,
266 .rsrc_group_dst_count
= IPA_RSRC_GROUP_DST_COUNT
,
267 .resource_src_count
= ARRAY_SIZE(ipa_resource_src
),
268 .resource_src
= ipa_resource_src
,
269 .resource_dst_count
= ARRAY_SIZE(ipa_resource_dst
),
270 .resource_dst
= ipa_resource_dst
,
273 /* IPA-resident memory region data for an SoC having IPA v4.5 */
274 static const struct ipa_mem ipa_mem_local_data
[] = {
276 .id
= IPA_MEM_UC_SHARED
,
282 .id
= IPA_MEM_UC_INFO
,
288 .id
= IPA_MEM_V4_FILTER_HASHED
,
294 .id
= IPA_MEM_V4_FILTER
,
300 .id
= IPA_MEM_V6_FILTER_HASHED
,
306 .id
= IPA_MEM_V6_FILTER
,
312 .id
= IPA_MEM_V4_ROUTE_HASHED
,
318 .id
= IPA_MEM_V4_ROUTE
,
324 .id
= IPA_MEM_V6_ROUTE_HASHED
,
330 .id
= IPA_MEM_V6_ROUTE
,
336 .id
= IPA_MEM_MODEM_HEADER
,
342 .id
= IPA_MEM_AP_HEADER
,
348 .id
= IPA_MEM_MODEM_PROC_CTX
,
354 .id
= IPA_MEM_AP_PROC_CTX
,
360 .id
= IPA_MEM_NAT_TABLE
,
366 .id
= IPA_MEM_STATS_QUOTA_MODEM
,
372 .id
= IPA_MEM_STATS_QUOTA_AP
,
378 .id
= IPA_MEM_STATS_TETHERING
,
384 .id
= IPA_MEM_STATS_FILTER_ROUTE
,
390 .id
= IPA_MEM_STATS_DROP
,
402 .id
= IPA_MEM_UC_EVENT_RING
,
408 .id
= IPA_MEM_PDN_CONFIG
,
415 /* Memory configuration data for an SoC having IPA v4.5 */
416 static const struct ipa_mem_data ipa_mem_data
= {
417 .local_count
= ARRAY_SIZE(ipa_mem_local_data
),
418 .local
= ipa_mem_local_data
,
419 .imem_addr
= 0x14688000,
420 .imem_size
= 0x00003000,
422 .smem_size
= 0x00009000,
425 /* Interconnect rates are in 1000 byte/second units */
426 static const struct ipa_interconnect_data ipa_interconnect_data
[] = {
429 .peak_bandwidth
= 600000, /* 600 MBps */
430 .average_bandwidth
= 150000, /* 150 MBps */
432 /* Average rate is unused for the next two interconnects */
435 .peak_bandwidth
= 450000, /* 450 MBps */
436 .average_bandwidth
= 75000, /* 75 MBps (unused?) */
440 .peak_bandwidth
= 171400, /* 171.4 MBps */
441 .average_bandwidth
= 0, /* unused */
445 /* Clock and interconnect configuration data for an SoC having IPA v4.5 */
446 static const struct ipa_power_data ipa_power_data
= {
447 .core_clock_rate
= 150 * 1000 * 1000, /* Hz (150? 60?) */
448 .interconnect_count
= ARRAY_SIZE(ipa_interconnect_data
),
449 .interconnect_data
= ipa_interconnect_data
,
452 /* Configuration data for an SoC having IPA v4.5 */
453 const struct ipa_data ipa_data_v4_5
= {
454 .version
= IPA_VERSION_4_5
,
455 .qsb_count
= ARRAY_SIZE(ipa_qsb_data
),
456 .qsb_data
= ipa_qsb_data
,
457 .modem_route_count
= 8,
458 .endpoint_count
= ARRAY_SIZE(ipa_gsi_endpoint_data
),
459 .endpoint_data
= ipa_gsi_endpoint_data
,
460 .resource_data
= &ipa_resource_data
,
461 .mem_data
= &ipa_mem_data
,
462 .power_data
= &ipa_power_data
,