1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2022-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.7 */
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.7 */
28 enum ipa_rsrc_group_id
{
29 /* Source resource group identifiers */
30 IPA_RSRC_GROUP_SRC_UL_DL
= 0,
31 IPA_RSRC_GROUP_SRC_UC_RX_Q
,
32 IPA_RSRC_GROUP_SRC_COUNT
, /* Last in set; not a source group */
34 /* Destination resource group identifiers */
35 IPA_RSRC_GROUP_DST_UL_DL_DPL
= 0,
36 IPA_RSRC_GROUP_DST_UNUSED_1
,
37 IPA_RSRC_GROUP_DST_COUNT
, /* Last; not a destination group */
40 /* QSB configuration data for an SoC having IPA v4.7 */
41 static const struct ipa_qsb_data ipa_qsb_data
[] = {
42 [IPA_QSB_MASTER_DDR
] = {
44 .max_reads
= 0, /* no limit (hardware max) */
45 .max_reads_beats
= 120,
49 /* Endpoint configuration data for an SoC having IPA v4.7 */
50 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data
[] = {
51 [IPA_ENDPOINT_AP_COMMAND_TX
] = {
63 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
65 .dma_endpoint
= IPA_ENDPOINT_AP_LAN_RX
,
67 .seq_type
= IPA_SEQ_DMA
,
72 [IPA_ENDPOINT_AP_LAN_RX
] = {
84 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
86 .status_enable
= true,
89 .pad_align
= ilog2(sizeof(u32
)),
90 .aggr_time_limit
= 500,
95 [IPA_ENDPOINT_AP_MODEM_TX
] = {
106 .filter_support
= true,
108 .resource_group
= IPA_RSRC_GROUP_SRC_UL_DL
,
110 .status_enable
= true,
112 .seq_type
= IPA_SEQ_2_PASS_SKIP_LAST_UC
,
114 IPA_ENDPOINT_MODEM_AP_RX
,
119 [IPA_ENDPOINT_AP_MODEM_RX
] = {
131 .resource_group
= IPA_RSRC_GROUP_DST_UL_DL_DPL
,
136 .aggr_time_limit
= 500,
137 .aggr_close_eof
= true,
142 [IPA_ENDPOINT_MODEM_AP_TX
] = {
143 .ee_id
= GSI_EE_MODEM
,
148 .filter_support
= true,
151 [IPA_ENDPOINT_MODEM_AP_RX
] = {
152 .ee_id
= GSI_EE_MODEM
,
157 [IPA_ENDPOINT_MODEM_DL_NLO_TX
] = {
158 .ee_id
= GSI_EE_MODEM
,
163 .filter_support
= true,
168 /* Source resource configuration data for an SoC having IPA v4.7 */
169 static const struct ipa_resource ipa_resource_src
[] = {
170 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS
] = {
171 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
175 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS
] = {
176 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
180 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF
] = {
181 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
182 .min
= 18, .max
= 18,
185 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS
] = {
186 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
190 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES
] = {
191 .limits
[IPA_RSRC_GROUP_SRC_UL_DL
] = {
192 .min
= 15, .max
= 15,
197 /* Destination resource configuration data for an SoC having IPA v4.7 */
198 static const struct ipa_resource ipa_resource_dst
[] = {
199 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS
] = {
200 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
204 [IPA_RESOURCE_TYPE_DST_DPS_DMARS
] = {
205 .limits
[IPA_RSRC_GROUP_DST_UL_DL_DPL
] = {
211 /* Resource configuration data for an SoC having IPA v4.7 */
212 static const struct ipa_resource_data ipa_resource_data
= {
213 .rsrc_group_dst_count
= IPA_RSRC_GROUP_DST_COUNT
,
214 .rsrc_group_src_count
= IPA_RSRC_GROUP_SRC_COUNT
,
215 .resource_src_count
= ARRAY_SIZE(ipa_resource_src
),
216 .resource_src
= ipa_resource_src
,
217 .resource_dst_count
= ARRAY_SIZE(ipa_resource_dst
),
218 .resource_dst
= ipa_resource_dst
,
221 /* IPA-resident memory region data for an SoC having IPA v4.7 */
222 static const struct ipa_mem ipa_mem_local_data
[] = {
224 .id
= IPA_MEM_UC_SHARED
,
230 .id
= IPA_MEM_UC_INFO
,
236 .id
= IPA_MEM_V4_FILTER_HASHED
,
242 .id
= IPA_MEM_V4_FILTER
,
248 .id
= IPA_MEM_V6_FILTER_HASHED
,
254 .id
= IPA_MEM_V6_FILTER
,
260 .id
= IPA_MEM_V4_ROUTE_HASHED
,
266 .id
= IPA_MEM_V4_ROUTE
,
272 .id
= IPA_MEM_V6_ROUTE_HASHED
,
278 .id
= IPA_MEM_V6_ROUTE
,
284 .id
= IPA_MEM_MODEM_HEADER
,
290 .id
= IPA_MEM_AP_HEADER
,
296 .id
= IPA_MEM_MODEM_PROC_CTX
,
302 .id
= IPA_MEM_AP_PROC_CTX
,
308 .id
= IPA_MEM_NAT_TABLE
,
314 .id
= IPA_MEM_PDN_CONFIG
,
320 .id
= IPA_MEM_STATS_QUOTA_MODEM
,
326 .id
= IPA_MEM_STATS_QUOTA_AP
,
332 .id
= IPA_MEM_STATS_TETHERING
,
338 .id
= IPA_MEM_STATS_DROP
,
350 .id
= IPA_MEM_END_MARKER
,
357 /* Memory configuration data for an SoC having IPA v4.7 */
358 static const struct ipa_mem_data ipa_mem_data
= {
359 .local_count
= ARRAY_SIZE(ipa_mem_local_data
),
360 .local
= ipa_mem_local_data
,
361 .imem_addr
= 0x146a8000,
362 .imem_size
= 0x00002000,
364 .smem_size
= 0x00009000,
367 /* Interconnect rates are in 1000 byte/second units */
368 static const struct ipa_interconnect_data ipa_interconnect_data
[] = {
371 .peak_bandwidth
= 600000, /* 600 MBps */
372 .average_bandwidth
= 150000, /* 150 MBps */
374 /* Average rate is unused for the next two interconnects */
377 .peak_bandwidth
= 450000, /* 450 MBps */
378 .average_bandwidth
= 75000, /* 75 MBps (unused?) */
382 .peak_bandwidth
= 171400, /* 171.4 MBps */
383 .average_bandwidth
= 0, /* unused */
387 /* Clock and interconnect configuration data for an SoC having IPA v4.7 */
388 static const struct ipa_power_data ipa_power_data
= {
389 /* XXX Downstream code says 150 MHz (DT SVS2), 60 MHz (code) */
390 .core_clock_rate
= 100 * 1000 * 1000, /* Hz (150? 60?) */
391 .interconnect_count
= ARRAY_SIZE(ipa_interconnect_data
),
392 .interconnect_data
= ipa_interconnect_data
,
395 /* Configuration data for an SoC having IPA v4.7 */
396 const struct ipa_data ipa_data_v4_7
= {
397 .version
= IPA_VERSION_4_7
,
398 .qsb_count
= ARRAY_SIZE(ipa_qsb_data
),
399 .qsb_data
= ipa_qsb_data
,
400 .modem_route_count
= 8,
401 .endpoint_count
= ARRAY_SIZE(ipa_gsi_endpoint_data
),
402 .endpoint_data
= ipa_gsi_endpoint_data
,
403 .resource_data
= &ipa_resource_data
,
404 .mem_data
= &ipa_mem_data
,
405 .power_data
= &ipa_power_data
,