ipa_data-v4.2.c 8.8 KB
Newer Older
A
Alex Elder 已提交
1 2
// SPDX-License-Identifier: GPL-2.0

A
Alex Elder 已提交
3
/* Copyright (C) 2019-2021 Linaro Ltd. */
A
Alex Elder 已提交
4 5 6 7 8 9 10 11

#include <linux/log2.h>

#include "gsi.h"
#include "ipa_data.h"
#include "ipa_endpoint.h"
#include "ipa_mem.h"

12
/** enum ipa_resource_type - IPA resource types for an SoC having IPA v4.2 */
13 14 15 16 17 18 19 20 21 22 23 24 25
enum ipa_resource_type {
	/* Source resource types; first must have value 0 */
	IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS		= 0,
	IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS,
	IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF,
	IPA_RESOURCE_TYPE_SRC_HPS_DMARS,
	IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES,

	/* Destination resource types; first must have value 0 */
	IPA_RESOURCE_TYPE_DST_DATA_SECTORS		= 0,
	IPA_RESOURCE_TYPE_DST_DPS_DMARS,
};

26
/* Resource groups used for an SoC having IPA v4.2 */
A
Alex Elder 已提交
27 28 29
enum ipa_rsrc_group_id {
	/* Source resource group identifiers */
	IPA_RSRC_GROUP_SRC_UL_DL	= 0,
30
	IPA_RSRC_GROUP_SRC_COUNT,	/* Last in set; not a source group */
A
Alex Elder 已提交
31 32 33

	/* Destination resource group identifiers */
	IPA_RSRC_GROUP_DST_UL_DL_DPL	= 0,
34
	IPA_RSRC_GROUP_DST_COUNT,	/* Last; not a destination group */
A
Alex Elder 已提交
35 36
};

37
/* QSB configuration data for an SoC having IPA v4.2 */
38 39 40 41
static const struct ipa_qsb_data ipa_qsb_data[] = {
	[IPA_QSB_MASTER_DDR] = {
		.max_writes	= 8,
		.max_reads	= 12,
42
		/* no outstanding read byte (beat) limit */
43 44 45
	},
};

46
/* Endpoint configuration data for an SoC having IPA v4.2 */
A
Alex Elder 已提交
47 48 49 50 51 52 53 54 55 56 57 58 59
static const struct ipa_gsi_endpoint_data ipa_gsi_endpoint_data[] = {
	[IPA_ENDPOINT_AP_COMMAND_TX] = {
		.ee_id		= GSI_EE_AP,
		.channel_id	= 1,
		.endpoint_id	= 6,
		.toward_ipa	= true,
		.channel = {
			.tre_count	= 256,
			.event_count	= 256,
			.tlv_count	= 20,
		},
		.endpoint = {
			.config = {
A
Alex Elder 已提交
60
				.resource_group	= IPA_RSRC_GROUP_SRC_UL_DL,
A
Alex Elder 已提交
61 62
				.dma_mode	= true,
				.dma_endpoint	= IPA_ENDPOINT_AP_LAN_RX,
63 64 65
				.tx = {
					.seq_type = IPA_SEQ_DMA,
				},
A
Alex Elder 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
			},
		},
	},
	[IPA_ENDPOINT_AP_LAN_RX] = {
		.ee_id		= GSI_EE_AP,
		.channel_id	= 2,
		.endpoint_id	= 8,
		.toward_ipa	= false,
		.channel = {
			.tre_count	= 256,
			.event_count	= 256,
			.tlv_count	= 6,
		},
		.endpoint = {
			.config = {
A
Alex Elder 已提交
81
				.resource_group	= IPA_RSRC_GROUP_DST_UL_DL_DPL,
A
Alex Elder 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
				.aggregation	= true,
				.status_enable	= true,
				.rx = {
					.pad_align	= ilog2(sizeof(u32)),
				},
			},
		},
	},
	[IPA_ENDPOINT_AP_MODEM_TX] = {
		.ee_id		= GSI_EE_AP,
		.channel_id	= 0,
		.endpoint_id	= 1,
		.toward_ipa	= true,
		.channel = {
			.tre_count	= 512,
			.event_count	= 512,
			.tlv_count	= 8,
		},
		.endpoint = {
			.filter_support	= true,
			.config = {
A
Alex Elder 已提交
103
				.resource_group	= IPA_RSRC_GROUP_SRC_UL_DL,
A
Alex Elder 已提交
104 105 106 107
				.checksum	= true,
				.qmap		= true,
				.status_enable	= true,
				.tx = {
108 109
					.seq_type = IPA_SEQ_1_PASS_SKIP_LAST_UC,
					.seq_rep_type = IPA_SEQ_REP_DMA_PARSER,
A
Alex Elder 已提交
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127
					.status_endpoint =
						IPA_ENDPOINT_MODEM_AP_RX,
				},
			},
		},
	},
	[IPA_ENDPOINT_AP_MODEM_RX] = {
		.ee_id		= GSI_EE_AP,
		.channel_id	= 3,
		.endpoint_id	= 9,
		.toward_ipa	= false,
		.channel = {
			.tre_count	= 256,
			.event_count	= 256,
			.tlv_count	= 6,
		},
		.endpoint = {
			.config = {
A
Alex Elder 已提交
128
				.resource_group	= IPA_RSRC_GROUP_DST_UL_DL_DPL,
A
Alex Elder 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
				.checksum	= true,
				.qmap		= true,
				.aggregation	= true,
				.rx = {
					.aggr_close_eof	= true,
				},
			},
		},
	},
	[IPA_ENDPOINT_MODEM_COMMAND_TX] = {
		.ee_id		= GSI_EE_MODEM,
		.channel_id	= 1,
		.endpoint_id	= 5,
		.toward_ipa	= true,
	},
	[IPA_ENDPOINT_MODEM_LAN_RX] = {
		.ee_id		= GSI_EE_MODEM,
		.channel_id	= 3,
147
		.endpoint_id	= 11,
A
Alex Elder 已提交
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
		.toward_ipa	= false,
	},
	[IPA_ENDPOINT_MODEM_AP_TX] = {
		.ee_id		= GSI_EE_MODEM,
		.channel_id	= 0,
		.endpoint_id	= 4,
		.toward_ipa	= true,
		.endpoint = {
			.filter_support	= true,
		},
	},
	[IPA_ENDPOINT_MODEM_AP_RX] = {
		.ee_id		= GSI_EE_MODEM,
		.channel_id	= 2,
		.endpoint_id	= 10,
		.toward_ipa	= false,
	},
};

167
/* Source resource configuration data for an SoC having IPA v4.2 */
168
static const struct ipa_resource ipa_resource_src[] = {
169
	[IPA_RESOURCE_TYPE_SRC_PKT_CONTEXTS] = {
A
Alex Elder 已提交
170
		.limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
171
			.min = 3,	.max = 63,
A
Alex Elder 已提交
172 173
		},
	},
174
	[IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_LISTS] = {
A
Alex Elder 已提交
175
		.limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
176
			.min = 3,	.max = 3,
A
Alex Elder 已提交
177 178
		},
	},
179
	[IPA_RESOURCE_TYPE_SRC_DESCRIPTOR_BUFF] = {
A
Alex Elder 已提交
180
		.limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
181
			.min = 10,	.max = 10,
A
Alex Elder 已提交
182 183
		},
	},
184
	[IPA_RESOURCE_TYPE_SRC_HPS_DMARS] = {
A
Alex Elder 已提交
185
		.limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
186
			.min = 1,	.max = 1,
A
Alex Elder 已提交
187 188
		},
	},
189
	[IPA_RESOURCE_TYPE_SRC_ACK_ENTRIES] = {
A
Alex Elder 已提交
190
		.limits[IPA_RSRC_GROUP_SRC_UL_DL] = {
191
			.min = 5,	.max = 5,
A
Alex Elder 已提交
192 193 194 195
		},
	},
};

196
/* Destination resource configuration data for an SoC having IPA v4.2 */
197
static const struct ipa_resource ipa_resource_dst[] = {
198
	[IPA_RESOURCE_TYPE_DST_DATA_SECTORS] = {
A
Alex Elder 已提交
199
		.limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
200
			.min = 3,	.max = 3,
A
Alex Elder 已提交
201 202
		},
	},
203
	[IPA_RESOURCE_TYPE_DST_DPS_DMARS] = {
A
Alex Elder 已提交
204
		.limits[IPA_RSRC_GROUP_DST_UL_DL_DPL] = {
205
			.min = 1,	.max = 63,
A
Alex Elder 已提交
206 207 208 209
		},
	},
};

210
/* Resource configuration data for an SoC having IPA v4.2 */
A
Alex Elder 已提交
211
static const struct ipa_resource_data ipa_resource_data = {
212 213
	.rsrc_group_src_count	= IPA_RSRC_GROUP_SRC_COUNT,
	.rsrc_group_dst_count	= IPA_RSRC_GROUP_DST_COUNT,
A
Alex Elder 已提交
214 215 216 217 218 219
	.resource_src_count	= ARRAY_SIZE(ipa_resource_src),
	.resource_src		= ipa_resource_src,
	.resource_dst_count	= ARRAY_SIZE(ipa_resource_dst),
	.resource_dst		= ipa_resource_dst,
};

220
/* IPA-resident memory region data for an SoC having IPA v4.2 */
221
static const struct ipa_mem ipa_mem_local_data[] = {
A
Alex Elder 已提交
222
	[IPA_MEM_UC_SHARED] = {
223
		.id		= IPA_MEM_UC_SHARED,
A
Alex Elder 已提交
224 225 226 227 228
		.offset		= 0x0000,
		.size		= 0x0080,
		.canary_count	= 0,
	},
	[IPA_MEM_UC_INFO] = {
229
		.id		= IPA_MEM_UC_INFO,
A
Alex Elder 已提交
230 231
		.offset		= 0x0080,
		.size		= 0x0200,
232
		.canary_count	= 0,
A
Alex Elder 已提交
233 234
	},
	[IPA_MEM_V4_FILTER_HASHED] = {
235
		.id		= IPA_MEM_V4_FILTER_HASHED,
A
Alex Elder 已提交
236 237 238 239 240
		.offset		= 0x0288,
		.size		= 0,
		.canary_count	= 2,
	},
	[IPA_MEM_V4_FILTER] = {
241
		.id		= IPA_MEM_V4_FILTER,
A
Alex Elder 已提交
242 243 244 245 246
		.offset		= 0x0290,
		.size		= 0x0078,
		.canary_count	= 2,
	},
	[IPA_MEM_V6_FILTER_HASHED] = {
247
		.id		= IPA_MEM_V6_FILTER_HASHED,
A
Alex Elder 已提交
248 249 250 251 252
		.offset		= 0x0310,
		.size		= 0,
		.canary_count	= 2,
	},
	[IPA_MEM_V6_FILTER] = {
253
		.id		= IPA_MEM_V6_FILTER,
A
Alex Elder 已提交
254 255 256 257 258
		.offset		= 0x0318,
		.size		= 0x0078,
		.canary_count	= 2,
	},
	[IPA_MEM_V4_ROUTE_HASHED] = {
259
		.id		= IPA_MEM_V4_ROUTE_HASHED,
A
Alex Elder 已提交
260 261 262 263 264
		.offset		= 0x0398,
		.size		= 0,
		.canary_count	= 2,
	},
	[IPA_MEM_V4_ROUTE] = {
265
		.id		= IPA_MEM_V4_ROUTE,
A
Alex Elder 已提交
266 267 268 269 270
		.offset		= 0x03a0,
		.size		= 0x0078,
		.canary_count	= 2,
	},
	[IPA_MEM_V6_ROUTE_HASHED] = {
271
		.id		= IPA_MEM_V6_ROUTE_HASHED,
A
Alex Elder 已提交
272 273 274 275 276
		.offset		= 0x0420,
		.size		= 0,
		.canary_count	= 2,
	},
	[IPA_MEM_V6_ROUTE] = {
277
		.id		= IPA_MEM_V6_ROUTE,
A
Alex Elder 已提交
278 279 280 281 282
		.offset		= 0x0428,
		.size		= 0x0078,
		.canary_count	= 2,
	},
	[IPA_MEM_MODEM_HEADER] = {
283
		.id		= IPA_MEM_MODEM_HEADER,
A
Alex Elder 已提交
284 285 286 287 288
		.offset		= 0x04a8,
		.size		= 0x0140,
		.canary_count	= 2,
	},
	[IPA_MEM_MODEM_PROC_CTX] = {
289
		.id		= IPA_MEM_MODEM_PROC_CTX,
A
Alex Elder 已提交
290 291 292 293 294
		.offset		= 0x05f0,
		.size		= 0x0200,
		.canary_count	= 2,
	},
	[IPA_MEM_AP_PROC_CTX] = {
295
		.id		= IPA_MEM_AP_PROC_CTX,
A
Alex Elder 已提交
296 297 298 299 300
		.offset		= 0x07f0,
		.size		= 0x0200,
		.canary_count	= 0,
	},
	[IPA_MEM_PDN_CONFIG] = {
301
		.id		= IPA_MEM_PDN_CONFIG,
A
Alex Elder 已提交
302 303 304 305
		.offset		= 0x09f8,
		.size		= 0x0050,
		.canary_count	= 2,
	},
306
	[IPA_MEM_STATS_QUOTA_MODEM] = {
307
		.id		= IPA_MEM_STATS_QUOTA_MODEM,
A
Alex Elder 已提交
308 309 310 311 312
		.offset		= 0x0a50,
		.size		= 0x0060,
		.canary_count	= 2,
	},
	[IPA_MEM_STATS_TETHERING] = {
313
		.id		= IPA_MEM_STATS_TETHERING,
A
Alex Elder 已提交
314 315 316 317 318
		.offset		= 0x0ab0,
		.size		= 0x0140,
		.canary_count	= 0,
	},
	[IPA_MEM_MODEM] = {
319
		.id		= IPA_MEM_MODEM,
A
Alex Elder 已提交
320 321 322 323
		.offset		= 0x0bf0,
		.size		= 0x140c,
		.canary_count	= 0,
	},
A
Alex Elder 已提交
324
	[IPA_MEM_END_MARKER] = {
325
		.id		= IPA_MEM_END_MARKER,
A
Alex Elder 已提交
326 327 328 329 330 331
		.offset		= 0x2000,
		.size		= 0,
		.canary_count	= 1,
	},
};

332
/* Memory configuration data for an SoC having IPA v4.2 */
333
static const struct ipa_mem_data ipa_mem_data = {
334 335
	.local_count	= ARRAY_SIZE(ipa_mem_local_data),
	.local		= ipa_mem_local_data,
336 337
	.imem_addr	= 0x146a8000,
	.imem_size	= 0x00002000,
338 339
	.smem_id	= 497,
	.smem_size	= 0x00002000,
340 341
};

342
/* Interconnect rates are in 1000 byte/second units */
343
static const struct ipa_interconnect_data ipa_interconnect_data[] = {
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361
	{
		.name			= "memory",
		.peak_bandwidth		= 465000,	/* 465 MBps */
		.average_bandwidth	= 80000,	/* 80 MBps */
	},
	/* Average bandwidth is unused for the next two interconnects */
	{
		.name			= "imem",
		.peak_bandwidth		= 68570,	/* 68.570 MBps */
		.average_bandwidth	= 0,		/* unused */
	},
	{
		.name			= "config",
		.peak_bandwidth		= 30000,	/* 30 MBps */
		.average_bandwidth	= 0,		/* unused */
	},
};

362
/* Clock and interconnect configuration data for an SoC having IPA v4.2 */
363
static const struct ipa_clock_data ipa_clock_data = {
364
	.core_clock_rate	= 100 * 1000 * 1000,	/* Hz */
365 366
	.interconnect_count	= ARRAY_SIZE(ipa_interconnect_data),
	.interconnect_data	= ipa_interconnect_data,
367 368
};

369 370
/* Configuration data for an SoC having IPA v4.2 */
const struct ipa_data ipa_data_v4_2 = {
A
Alex Elder 已提交
371
	.version	= IPA_VERSION_4_2,
372
	/* backward_compat value is 0 */
373 374
	.qsb_count	= ARRAY_SIZE(ipa_qsb_data),
	.qsb_data	= ipa_qsb_data,
A
Alex Elder 已提交
375 376 377
	.endpoint_count	= ARRAY_SIZE(ipa_gsi_endpoint_data),
	.endpoint_data	= ipa_gsi_endpoint_data,
	.resource_data	= &ipa_resource_data,
378
	.mem_data	= &ipa_mem_data,
379
	.clock_data	= &ipa_clock_data,
A
Alex Elder 已提交
380
};