1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2019-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.2 */
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.2 */
28 enum ipa_rsrc_group_id
{
29 /* Source resource group identifiers */
30 IPA_RSRC_GROUP_SRC_UL_DL
= 0,
31 IPA_RSRC_GROUP_SRC_COUNT
, /* Last in set; not a source group */
33 /* Destination resource group identifiers */
34 IPA_RSRC_GROUP_DST_UL_DL_DPL
= 0,
35 IPA_RSRC_GROUP_DST_COUNT
, /* Last; not a destination group */
38 /* QSB configuration data for an SoC having IPA v4.2 */
39 static const struct ipa_qsb_data ipa_qsb_data
[] = {
40 [IPA_QSB_MASTER_DDR
] = {
43 /* no outstanding read byte (beat) limit */
47 /* Endpoint configuration data for an SoC having IPA v4.2 */
48 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data
[] = {
49 [IPA_ENDPOINT_AP_COMMAND_TX
] = {
61 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
63 .dma_endpoint
= IPA_ENDPOINT_AP_LAN_RX
,
65 .seq_type
= IPA_SEQ_DMA
,
70 [IPA_ENDPOINT_AP_LAN_RX
] = {
82 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
84 .status_enable
= true,
87 .pad_align
= ilog2(sizeof(u32
)),
88 .aggr_time_limit
= 500,
93 [IPA_ENDPOINT_AP_MODEM_TX
] = {
104 .filter_support
= true,
106 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
109 .status_enable
= true,
111 .seq_type
= IPA_SEQ_1_PASS_SKIP_LAST_UC
,
112 .seq_rep_type
= IPA_SEQ_REP_DMA_PARSER
,
114 IPA_ENDPOINT_MODEM_AP_RX
,
119 [IPA_ENDPOINT_AP_MODEM_RX
] = {
131 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
137 .aggr_time_limit
= 500,
138 .aggr_close_eof
= true,
143 [IPA_ENDPOINT_MODEM_COMMAND_TX
] = {
144 .ee_id
= GSI_EE_MODEM
,
149 [IPA_ENDPOINT_MODEM_LAN_RX
] = {
150 .ee_id
= GSI_EE_MODEM
,
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
,
172 /* Source resource configuration data for an SoC having IPA v4.2 */
173 static const struct ipa_resource ipa_resource_src
[] = {
174 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
] = {
175 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
179 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS
] = {
180 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
184 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
] = {
185 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
186 .min
= 10, .max
= 10,
189 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS
] = {
190 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
194 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
] = {
195 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
201 /* Destination resource configuration data for an SoC having IPA v4.2 */
202 static const struct ipa_resource ipa_resource_dst
[] = {
203 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS
] = {
204 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
208 [IPA_RESOURCE_TYPE_DST_DPS_DMARS
] = {
209 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
215 /* Resource configuration data for an SoC having IPA v4.2 */
216 static const struct ipa_resource_data ipa_resource_data
= {
217 .rsrc_group_src_count
= IPA_RSRC_GROUP_SRC_COUNT
,
218 .rsrc_group_dst_count
= IPA_RSRC_GROUP_DST_COUNT
,
219 .resource_src_count
= ARRAY_SIZE(ipa_resource_src
),
220 .resource_src
= ipa_resource_src
,
221 .resource_dst_count
= ARRAY_SIZE(ipa_resource_dst
),
222 .resource_dst
= ipa_resource_dst
,
225 /* IPA-resident memory region data for an SoC having IPA v4.2 */
226 static const struct ipa_mem ipa_mem_local_data
[] = {
228 .id
= IPA_MEM_UC_SHARED
,
234 .id
= IPA_MEM_UC_INFO
,
240 .id
= IPA_MEM_V4_FILTER_HASHED
,
246 .id
= IPA_MEM_V4_FILTER
,
252 .id
= IPA_MEM_V6_FILTER_HASHED
,
258 .id
= IPA_MEM_V6_FILTER
,
264 .id
= IPA_MEM_V4_ROUTE_HASHED
,
270 .id
= IPA_MEM_V4_ROUTE
,
276 .id
= IPA_MEM_V6_ROUTE_HASHED
,
282 .id
= IPA_MEM_V6_ROUTE
,
288 .id
= IPA_MEM_MODEM_HEADER
,
294 .id
= IPA_MEM_MODEM_PROC_CTX
,
300 .id
= IPA_MEM_AP_PROC_CTX
,
306 .id
= IPA_MEM_PDN_CONFIG
,
312 .id
= IPA_MEM_STATS_QUOTA_MODEM
,
318 .id
= IPA_MEM_STATS_TETHERING
,
330 .id
= IPA_MEM_END_MARKER
,
337 /* Memory configuration data for an SoC having IPA v4.2 */
338 static const struct ipa_mem_data ipa_mem_data
= {
339 .local_count
= ARRAY_SIZE(ipa_mem_local_data
),
340 .local
= ipa_mem_local_data
,
341 .imem_addr
= 0x146a8000,
342 .imem_size
= 0x00002000,
344 .smem_size
= 0x00002000,
347 /* Interconnect rates are in 1000 byte/second units */
348 static const struct ipa_interconnect_data ipa_interconnect_data
[] = {
351 .peak_bandwidth
= 465000, /* 465 MBps */
352 .average_bandwidth
= 80000, /* 80 MBps */
354 /* Average bandwidth is unused for the next two interconnects */
357 .peak_bandwidth
= 68570, /* 68.570 MBps */
358 .average_bandwidth
= 0, /* unused */
362 .peak_bandwidth
= 30000, /* 30 MBps */
363 .average_bandwidth
= 0, /* unused */
367 /* Clock and interconnect configuration data for an SoC having IPA v4.2 */
368 static const struct ipa_power_data ipa_power_data
= {
369 .core_clock_rate
= 100 * 1000 * 1000, /* Hz */
370 .interconnect_count
= ARRAY_SIZE(ipa_interconnect_data
),
371 .interconnect_data
= ipa_interconnect_data
,
374 /* Configuration data for an SoC having IPA v4.2 */
375 const struct ipa_data ipa_data_v4_2
= {
376 .version
= IPA_VERSION_4_2
,
377 /* backward_compat value is 0 */
378 .qsb_count
= ARRAY_SIZE(ipa_qsb_data
),
379 .qsb_data
= ipa_qsb_data
,
380 .modem_route_count
= 8,
381 .endpoint_count
= ARRAY_SIZE(ipa_gsi_endpoint_data
),
382 .endpoint_data
= ipa_gsi_endpoint_data
,
383 .resource_data
= &ipa_resource_data
,
384 .mem_data
= &ipa_mem_data
,
385 .power_data
= &ipa_power_data
,