drivers/net/ipa/ipa_reg.c

Source file repositories/reference/linux-study-clean/drivers/net/ipa/ipa_reg.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ipa/ipa_reg.c
Extension
.c
Size
3898 bytes
Lines
171
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0

/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
 * Copyright (C) 2019-2024 Linaro Ltd.
 */

#include <linux/io.h>
#include <linux/platform_device.h>

#include "ipa.h"
#include "ipa_reg.h"

/* Is this register ID valid for the current IPA version? */
static bool ipa_reg_id_valid(struct ipa *ipa, enum ipa_reg_id reg_id)
{
	enum ipa_version version = ipa->version;

	switch (reg_id) {
	case FILT_ROUT_HASH_EN:
		return version == IPA_VERSION_4_2;

	case FILT_ROUT_HASH_FLUSH:
		return version < IPA_VERSION_5_0 && version != IPA_VERSION_4_2;

	case FILT_ROUT_CACHE_FLUSH:
	case ENDP_FILTER_CACHE_CFG:
	case ENDP_ROUTER_CACHE_CFG:
		return version >= IPA_VERSION_5_0;

	case IPA_BCR:
	case COUNTER_CFG:
		return version < IPA_VERSION_4_5;

	case IPA_TX_CFG:
	case FLAVOR_0:
	case IDLE_INDICATION_CFG:
		return version >= IPA_VERSION_3_5;

	case QTIME_TIMESTAMP_CFG:
	case TIMERS_XO_CLK_DIV_CFG:
	case TIMERS_PULSE_GRAN_CFG:
		return version >= IPA_VERSION_4_5;

	case SRC_RSRC_GRP_45_RSRC_TYPE:
	case DST_RSRC_GRP_45_RSRC_TYPE:
		return version <= IPA_VERSION_3_1 ||
		       version == IPA_VERSION_4_5 ||
		       version >= IPA_VERSION_5_0;

	case SRC_RSRC_GRP_67_RSRC_TYPE:
	case DST_RSRC_GRP_67_RSRC_TYPE:
		return version <= IPA_VERSION_3_1 ||
		       version >= IPA_VERSION_5_0;

	case ENDP_FILTER_ROUTER_HSH_CFG:
		return version < IPA_VERSION_5_0 &&
			version != IPA_VERSION_4_2;

	case IRQ_SUSPEND_EN:
	case IRQ_SUSPEND_CLR:
		return version >= IPA_VERSION_3_1;

	case COMP_CFG:
	case CLKON_CFG:
	case ROUTE:
	case SHARED_MEM_SIZE:
	case QSB_MAX_WRITES:
	case QSB_MAX_READS:
	case STATE_AGGR_ACTIVE:
	case LOCAL_PKT_PROC_CNTXT:
	case AGGR_FORCE_CLOSE:
	case SRC_RSRC_GRP_01_RSRC_TYPE:
	case SRC_RSRC_GRP_23_RSRC_TYPE:
	case DST_RSRC_GRP_01_RSRC_TYPE:
	case DST_RSRC_GRP_23_RSRC_TYPE:
	case ENDP_INIT_CTRL:
	case ENDP_INIT_CFG:
	case ENDP_INIT_NAT:
	case ENDP_INIT_HDR:
	case ENDP_INIT_HDR_EXT:
	case ENDP_INIT_HDR_METADATA_MASK:
	case ENDP_INIT_MODE:
	case ENDP_INIT_AGGR:
	case ENDP_INIT_HOL_BLOCK_EN:
	case ENDP_INIT_HOL_BLOCK_TIMER:
	case ENDP_INIT_DEAGGR:
	case ENDP_INIT_RSRC_GRP:
	case ENDP_INIT_SEQ:
	case ENDP_STATUS:
	case IPA_IRQ_STTS:

Annotation

Implementation Notes