1 // SPDX-License-Identifier: GPL-2.0
3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2021 Linaro Ltd.
7 #include <linux/log2.h>
11 #include "ipa_endpoint.h"
14 /** enum ipa_resource_type - IPA resource types */
15 enum ipa_resource_type {
16 /* Source resource types; first must have value 0 */
17 IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS = 0,
18 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
19 IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
20 IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
21 IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,
23 /* Destination resource types; first must have value 0 */
24 IPA_RESOURCE_TYPE_DST_DATA_SECTORS = 0,
25 IPA_RESOURCE_TYPE_DST_DPS_DMARS,
28 /* Resource groups used for the SDM845 SoC */
29 enum ipa_rsrc_group_id {
30 /* Source resource group identifiers */
31 IPA_RSRC_GROUP_SRC_LWA_DL = 0,
32 IPA_RSRC_GROUP_SRC_UL_DL,
33 IPA_RSRC_GROUP_SRC_MHI_DMA,
34 IPA_RSRC_GROUP_SRC_UC_RX_Q,
36 /* Destination resource group identifiers */
37 IPA_RSRC_GROUP_DST_LWA_DL = 0,
38 IPA_RSRC_GROUP_DST_UL_DL_DPL,
39 IPA_RSRC_GROUP_DST_UNUSED_2,
42 /* QSB configuration for the SDM845 SoC. */
43 static const struct ipa_qsb_data ipa_qsb_data[] = {
44 [IPA_QSB_MASTER_DDR] = {
48 [IPA_QSB_MASTER_PCIE] = {
54 /* Endpoint configuration for the SDM845 SoC. */
55 static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
56 [IPA_ENDPOINT_AP_COMMAND_TX] = {
68 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
70 .dma_endpoint = IPA_ENDPOINT_AP_LAN_RX,
72 .seq_type = IPA_SEQ_DMA,
77 [IPA_ENDPOINT_AP_LAN_RX] = {
89 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
91 .status_enable = true,
93 .pad_align = ilog2(sizeof(u32)),
98 [IPA_ENDPOINT_AP_MODEM_TX] = {
109 .filter_support = true,
111 .resource_group = IPA_RSRC_GROUP_SRC_UL_DL,
114 .status_enable = true,
116 .seq_type = IPA_SEQ_2_PASS_SKIP_LAST_UC,
118 IPA_ENDPOINT_MODEM_AP_RX,
123 [IPA_ENDPOINT_AP_MODEM_RX] = {
135 .resource_group = IPA_RSRC_GROUP_DST_UL_DL_DPL,
140 .aggr_close_eof = true,
145 [IPA_ENDPOINT_MODEM_COMMAND_TX] = {
146 .ee_id = GSI_EE_MODEM,
151 [IPA_ENDPOINT_MODEM_LAN_TX] = {
152 .ee_id = GSI_EE_MODEM,
157 .filter_support = true,
160 [IPA_ENDPOINT_MODEM_LAN_RX] = {
161 .ee_id = GSI_EE_MODEM,
166 [IPA_ENDPOINT_MODEM_AP_TX] = {
167 .ee_id = GSI_EE_MODEM,
172 .filter_support = true,
175 [IPA_ENDPOINT_MODEM_AP_RX] = {
176 .ee_id = GSI_EE_MODEM,
183 /* Source resource configuration data for the SDM845 SoC */
184 static const struct ipa_resource ipa_resource_src[] = {
185 [IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
186 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
187 .min = 1, .max = 255,
189 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
190 .min = 1, .max = 255,
192 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
196 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
197 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
198 .min = 10, .max = 10,
200 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
201 .min = 10, .max = 10,
203 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
207 [IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
208 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
209 .min = 12, .max = 12,
211 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
212 .min = 14, .max = 14,
214 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
218 [IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
219 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
222 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
225 .limits[IPA_RSRC_GROUP_SRC_MHI_DMA] = {
228 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
232 [IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
233 .limits[IPA_RSRC_GROUP_SRC_LWA_DL] = {
234 .min = 14, .max = 14,
236 .limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
237 .min = 20, .max = 20,
239 .limits[IPA_RSRC_GROUP_SRC_UC_RX_Q] = {
240 .min = 14, .max = 14,
245 /* Destination resource configuration data for the SDM845 SoC */
246 static const struct ipa_resource ipa_resource_dst[] = {
247 [IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
248 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
254 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
258 [IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
259 .limits[IPA_RSRC_GROUP_DST_LWA_DL] = {
262 .limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
265 .limits[IPA_RSRC_GROUP_DST_UNUSED_2] = {
271 /* Resource configuration for the SDM845 SoC. */
272 static const struct ipa_resource_data ipa_resource_data = {
273 .resource_src_count = ARRAY_SIZE(ipa_resource_src),
274 .resource_src = ipa_resource_src,
275 .resource_dst_count = ARRAY_SIZE(ipa_resource_dst),
276 .resource_dst = ipa_resource_dst,
279 /* IPA-resident memory region configuration for the SDM845 SoC. */
280 static const struct ipa_mem ipa_mem_local_data[] = {
281 [IPA_MEM_UC_SHARED] = {
286 [IPA_MEM_UC_INFO] = {
291 [IPA_MEM_V4_FILTER_HASHED] = {
296 [IPA_MEM_V4_FILTER] = {
301 [IPA_MEM_V6_FILTER_HASHED] = {
306 [IPA_MEM_V6_FILTER] = {
311 [IPA_MEM_V4_ROUTE_HASHED] = {
316 [IPA_MEM_V4_ROUTE] = {
321 [IPA_MEM_V6_ROUTE_HASHED] = {
326 [IPA_MEM_V6_ROUTE] = {
331 [IPA_MEM_MODEM_HEADER] = {
336 [IPA_MEM_MODEM_PROC_CTX] = {
341 [IPA_MEM_AP_PROC_CTX] = {
351 [IPA_MEM_UC_EVENT_RING] = {
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 = 0x146bd000,
362 .imem_size = 0x00002000,
364 .smem_size = 0x00002000,
367 /* Interconnect bandwidths 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 = 80000, /* 80 MBps */
374 /* Average bandwidth is unused for the next two interconnects */
377 .peak_bandwidth = 350000, /* 350 MBps */
378 .average_bandwidth = 0, /* unused */
382 .peak_bandwidth = 40000, /* 40 MBps */
383 .average_bandwidth = 0, /* unused */
387 static const struct ipa_clock_data ipa_clock_data = {
388 .core_clock_rate = 75 * 1000 * 1000, /* Hz */
389 .interconnect_count = ARRAY_SIZE(ipa_interconnect_data),
390 .interconnect_data = ipa_interconnect_data,
393 /* Configuration data for the SDM845 SoC. */
394 const struct ipa_data ipa_data_sdm845 = {
395 .version = IPA_VERSION_3_5_1,
396 .qsb_count = ARRAY_SIZE(ipa_qsb_data),
397 .qsb_data = ipa_qsb_data,
398 .endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
399 .endpoint_data = ipa_gsi_endpoint_data,
400 .resource_data = &ipa_resource_data,
401 .mem_data = &ipa_mem_data,
402 .clock_data = &ipa_clock_data,