1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (C) 2021 Linaro Ltd. */
5 #include <linux/log2.h>
9 #include "ipa_endpoint.h"
12 /** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.5 */
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.5 */
27 enum ipa_rsrc_group_id {
28 /* Source resource group identifiers */
29 IPA_RSRC_GROUP_SRC_UNUSED_0 = 0,
30 IPA_RSRC_GROUP_SRC_UL_DL,
31 IPA_RSRC_GROUP_SRC_UNUSED_2,
32 IPA_RSRC_GROUP_SRC_UNUSED_3,
33 IPA_RSRC_GROUP_SRC_UC_RX_Q,
34 IPA_RSRC_GROUP_SRC_COUNT, /* Last in set; not a source group */
36 /* Destination resource group identifiers */
37 IPA_RSRC_GROUP_DST_UNUSED_0 = 0,
38 IPA_RSRC_GROUP_DST_UL_DL_DPL,
39 IPA_RSRC_GROUP_DST_UNUSED_2,
40 IPA_RSRC_GROUP_DST_UNUSED_3,
41 IPA_RSRC_GROUP_DST_UC,
42 IPA_RSRC_GROUP_DST_COUNT, /* Last; not a destination group */
45 /* QSB configuration data for an SoC having IPA v4.5 */
46 static const struct ipa_qsb_data ipa_qsb_data[] = {
47 [IPA_QSB_MASTER_DDR] = {
49 .max_reads = 0, /* no limit (hardware max) */
50 .max_reads_beats = 120,
52 [IPA_QSB_MASTER_PCIE] = {
55 /* no outstanding read byte (beat) limit */
59 /* Endpoint configuration data for an SoC having IPA v4.5 */
60 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
61 [IPA_ENDPOINT_AP_COMMAND_TX] = {
73 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
75 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
77 .seq_type = IPA_SEQ_DMA,
82 [IPA_ENDPOINT_AP_LAN_RX] = {
94 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
96 .status_enable = true,
98 .pad_align = ilog2(sizeof(u32)),
103 [IPA_ENDPOINT_AP_MODEM_TX] = {
114 .filter_support = true,
116 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
118 .status_enable = true,
120 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
122 IPA_ENDPOINT_MODEM_AP_RX,
127 [IPA_ENDPOINT_AP_MODEM_RX] = {
139 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
143 .aggr_close_eof = true,
148 [IPA_ENDPOINT_MODEM_AP_TX] = {
149 .ee_id = GSI_EE_MODEM,
154 .filter_support = true,
157 [IPA_ENDPOINT_MODEM_AP_RX] = {
158 .ee_id = GSI_EE_MODEM,
163 [IPA_ENDPOINT_MODEM_DL_NLO_TX] = {
164 .ee_id = GSI_EE_MODEM,
169 .filter_support = true,
174 /* Source resource configuration data for an SoC having IPA v4.5 */
175 static const struct ipa_resource ipa_resource_src[] = {
176 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
177 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
180 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
184 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
185 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
186 .min = 14, .max = 14,
188 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
192 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
193 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
194 .min = 18, .max = 18,
196 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
200 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
201 .limits[IPA_RSRC_GROUP_SRC_UNUSED_0] = {
204 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
207 .limits[IPA_RSRC_GROUP_SRC_UNUSED_2] = {
210 .limits[IPA_RSRC_GROUP_SRC_UNUSED_3] = {
213 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
217 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
218 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
219 .min = 24, .max = 24,
221 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
227 /* Destination resource configuration data for an SoC having IPA v4.5 */
228 static const struct ipa_resource ipa_resource_dst[] = {
229 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
230 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
231 .min = 16, .max = 16,
233 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
236 .limits[IPA_RSRC_GROUP_DST_UNUSED_3] = {
240 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
241 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
244 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
247 .limits[IPA_RSRC_GROUP_DST_UNUSED_3] = {
250 .limits[IPA_RSRC_GROUP_DST_UC] = {
256 /* Resource configuration data for an SoC having IPA v4.5 */
257 static const struct ipa_resource_data ipa_resource_data = {
258 .rsrc_group_src_count = IPA_RSRC_GROUP_SRC_COUNT,
259 .rsrc_group_dst_count = IPA_RSRC_GROUP_DST_COUNT,
260 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
261 .resource_src = ipa_resource_src,
262 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
263 .resource_dst = ipa_resource_dst,
266 /* IPA-resident memory region data for an SoC having IPA v4.5 */
267 static const struct ipa_mem ipa_mem_local_data[] = {
269 .id = IPA_MEM_UC_SHARED,
275 .id = IPA_MEM_UC_INFO,
281 .id = IPA_MEM_V4_FILTER_HASHED,
287 .id = IPA_MEM_V4_FILTER,
293 .id = IPA_MEM_V6_FILTER_HASHED,
299 .id = IPA_MEM_V6_FILTER,
305 .id = IPA_MEM_V4_ROUTE_HASHED,
311 .id = IPA_MEM_V4_ROUTE,
317 .id = IPA_MEM_V6_ROUTE_HASHED,
323 .id = IPA_MEM_V6_ROUTE,
329 .id = IPA_MEM_MODEM_HEADER,
335 .id = IPA_MEM_AP_HEADER,
341 .id = IPA_MEM_MODEM_PROC_CTX,
347 .id = IPA_MEM_AP_PROC_CTX,
353 .id = IPA_MEM_NAT_TABLE,
359 .id = IPA_MEM_STATS_QUOTA_MODEM,
365 .id = IPA_MEM_STATS_QUOTA_AP,
371 .id = IPA_MEM_STATS_TETHERING,
377 .id = IPA_MEM_STATS_FILTER_ROUTE,
383 .id = IPA_MEM_STATS_DROP,
395 .id = IPA_MEM_UC_EVENT_RING,
401 .id = IPA_MEM_PDN_CONFIG,
408 /* Memory configuration data for an SoC having IPA v4.5 */
409 static const struct ipa_mem_data ipa_mem_data = {
410 .local_count = ARRAY_SIZE(ipa_mem_local_data),
411 .local = ipa_mem_local_data,
412 .imem_addr = 0x14688000,
413 .imem_size = 0x00003000,
415 .smem_size = 0x00009000,
418 /* Interconnect rates are in 1000 byte/second units */
419 static const struct ipa_interconnect_data ipa_interconnect_data[] = {
422 .peak_bandwidth = 600000, /* 600 MBps */
423 .average_bandwidth = 150000, /* 150 MBps */
427 .peak_bandwidth = 1804000, /* 1.804 GBps */
428 .average_bandwidth = 150000, /* 150 MBps */
430 /* Average rate is unused for the next two interconnects */
433 .peak_bandwidth = 450000, /* 450 MBps */
434 .average_bandwidth = 75000, /* 75 MBps (unused?) */
438 .peak_bandwidth = 171400, /* 171.4 MBps */
439 .average_bandwidth = 0, /* unused */
443 /* Clock and interconnect configuration data for an SoC having IPA v4.5 */
444 static const struct ipa_clock_data ipa_clock_data = {
445 .core_clock_rate = 150 * 1000 * 1000, /* Hz (150? 60?) */
446 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
447 .interconnect_data = ipa_interconnect_data,
450 /* Configuration data for an SoC having IPA v4.5 */
451 const struct ipa_data ipa_data_v4_5 = {
452 .version = IPA_VERSION_4_5,
453 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
454 .qsb_data = ipa_qsb_data,
455 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
456 .endpoint_data = ipa_gsi_endpoint_data,
457 .resource_data = &ipa_resource_data,
458 .mem_data = &ipa_mem_data,
459 .clock_data = &ipa_clock_data,