1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2022 Linaro Ltd. */
5 #include <linux/log2.h>
8 #include "../ipa_data.h"
9 #include "../ipa_endpoint.h"
10 #include "../ipa_mem.h"
12 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.7 */
13 enum ipa_resource_type {
14 /* Source resource types; first must have value 0 */
15 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
16 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
17 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
18 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
19 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
21 /* Destination resource types; first must have value 0 */
22 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
23 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
26 /* Resource groups used for an SoC having IPA v4.7 */
27 enum ipa_rsrc_group_id {
28 /* Source resource group identifiers */
29 IPA_RSRC_GROUP_SRC_UL_DL = 0,
30 IPA_RSRC_GROUP_SRC_UC_RX_Q,
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_UNUSED_1,
36 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
39 /* QSB configuration data for an SoC having IPA v4.7 */
40 static const struct ipa_qsb_data ipa_qsb_data[] = {
41 [IPA_QSB_MASTER_DDR] = {
43 .max_reads = 0, /* no limit (hardware max) */
44 .max_reads_beats = 120,
48 /* Endpoint configuration data for an SoC having IPA v4.7 */
49 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
50 [IPA_ENDPOINT_AP_COMMAND_TX] = {
62 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
64 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
66 .seq_type = IPA_SEQ_DMA,
71 [IPA_ENDPOINT_AP_LAN_RX] = {
83 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
85 .status_enable = true,
88 .pad_align = ilog2(sizeof(u32)),
89 .aggr_time_limit = 500,
94 [IPA_ENDPOINT_AP_MODEM_TX] = {
105 .filter_support = true,
107 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
109 .status_enable = true,
111 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
113 IPA_ENDPOINT_MODEM_AP_RX,
118 [IPA_ENDPOINT_AP_MODEM_RX] = {
130 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
135 .aggr_time_limit = 500,
136 .aggr_close_eof = true,
141 [IPA_ENDPOINT_MODEM_AP_TX] = {
142 .ee_id = GSI_EE_MODEM,
147 .filter_support = true,
150 [IPA_ENDPOINT_MODEM_AP_RX] = {
151 .ee_id = GSI_EE_MODEM,
156 [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
157 .ee_id = GSI_EE_MODEM,
162 .filter_support = true,
167 /* Source resource configuration data for an SoC having IPA v4.7 */
168 static const struct ipa_resource ipa_resource_src[] = {
169 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
170 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
174 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
175 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
179 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
180 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
181 .min = 18, .max = 18,
184 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
185 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
189 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
190 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
191 .min = 15, .max = 15,
196 /* Destination resource configuration data for an SoC having IPA v4.7 */
197 static const struct ipa_resource ipa_resource_dst[] = {
198 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
199 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
203 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
204 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
210 /* Resource configuration data for an SoC having IPA v4.7 */
211 static const struct ipa_resource_data ipa_resource_data = {
212 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
213 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
214 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
215 .resource_src = ipa_resource_src,
216 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
217 .resource_dst = ipa_resource_dst,
220 /* IPA-resident memory region data for an SoC having IPA v4.7 */
221 static const struct ipa_mem ipa_mem_local_data[] = {
223 .id = IPA_MEM_UC_SHARED,
229 .id = IPA_MEM_UC_INFO,
235 .id = IPA_MEM_V4_FILTER_HASHED,
241 .id = IPA_MEM_V4_FILTER,
247 .id = IPA_MEM_V6_FILTER_HASHED,
253 .id = IPA_MEM_V6_FILTER,
259 .id = IPA_MEM_V4_ROUTE_HASHED,
265 .id = IPA_MEM_V4_ROUTE,
271 .id = IPA_MEM_V6_ROUTE_HASHED,
277 .id = IPA_MEM_V6_ROUTE,
283 .id = IPA_MEM_MODEM_HEADER,
289 .id = IPA_MEM_AP_HEADER,
295 .id = IPA_MEM_MODEM_PROC_CTX,
301 .id = IPA_MEM_AP_PROC_CTX,
307 .id = IPA_MEM_NAT_TABLE,
313 .id = IPA_MEM_PDN_CONFIG,
319 .id = IPA_MEM_STATS_QUOTA_MODEM,
325 .id = IPA_MEM_STATS_QUOTA_AP,
331 .id = IPA_MEM_STATS_TETHERING,
337 .id = IPA_MEM_STATS_DROP,
349 .id = IPA_MEM_END_MARKER,
356 /* Memory configuration data for an SoC having IPA v4.7 */
357 static const struct ipa_mem_data ipa_mem_data = {
358 .local_count = ARRAY_SIZE(ipa_mem_local_data),
359 .local = ipa_mem_local_data,
360 .imem_addr = 0x146a9000,
361 .imem_size = 0x00002000,
363 .smem_size = 0x00009000,
366 /* Interconnect rates are in 1000 byte/second units */
367 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
370 .peak_bandwidth = 600000, /* 600 MBps */
371 .average_bandwidth = 150000, /* 150 MBps */
373 /* Average rate is unused for the next two interconnects */
376 .peak_bandwidth = 450000, /* 450 MBps */
377 .average_bandwidth = 75000, /* 75 MBps (unused?) */
381 .peak_bandwidth = 171400, /* 171.4 MBps */
382 .average_bandwidth = 0, /* unused */
386 /* Clock and interconnect configuration data for an SoC having IPA v4.7 */
387 static const struct ipa_power_data ipa_power_data = {
388 /* XXX Downstream code says 150 MHz (DT SVS2), 60 MHz (code) */
389 .core_clock_rate = 100 * 1000 * 1000, /* Hz (150? 60?) */
390 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
391 .interconnect_data = ipa_interconnect_data,
394 /* Configuration data for an SoC having IPA v4.7 */
395 const struct ipa_data ipa_data_v4_7 = {
396 .version = IPA_VERSION_4_7,
397 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
398 .qsb_data = ipa_qsb_data,
399 .modem_route_count = 8,
400 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
401 .endpoint_data = ipa_gsi_endpoint_data,
402 .resource_data = &ipa_resource_data,
403 .mem_data = &ipa_mem_data,
404 .power_data = &ipa_power_data,