drivers/hwtracing/coresight/coresight-catu.h

Source file repositories/reference/linux-study-clean/drivers/hwtracing/coresight/coresight-catu.h

File Facts

System
Linux kernel
Corpus path
drivers/hwtracing/coresight/coresight-catu.h
Extension
.h
Size
3152 bytes
Lines
115
Domain
Driver Families
Bucket
drivers/hwtracing
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

struct catu_drvdata {
	struct clk *pclk;
	struct clk *atclk;
	void __iomem *base;
	struct coresight_device *csdev;
	int irq;
	raw_spinlock_t spinlock;
};

#define CATU_REG32(name, offset)					\
static inline u32							\
catu_read_##name(struct catu_drvdata *drvdata)				\
{									\
	return csdev_access_relaxed_read32(&drvdata->csdev->access, offset); \
}									\
static inline void							\
catu_write_##name(struct catu_drvdata *drvdata, u32 val)		\
{									\
	csdev_access_relaxed_write32(&drvdata->csdev->access, val, offset); \
}

#define CATU_REG_PAIR(name, lo_off, hi_off)				\
static inline u64							\
catu_read_##name(struct catu_drvdata *drvdata)				\
{									\
	return csdev_access_relaxed_read_pair(&drvdata->csdev->access, lo_off, hi_off); \
}									\
static inline void							\
catu_write_##name(struct catu_drvdata *drvdata, u64 val)		\
{									\
	csdev_access_relaxed_write_pair(&drvdata->csdev->access, val, lo_off, hi_off); \
}

CATU_REG32(control, CATU_CONTROL);
CATU_REG32(mode, CATU_MODE);
CATU_REG32(irqen, CATU_IRQEN);
CATU_REG32(axictrl, CATU_AXICTRL);
CATU_REG_PAIR(sladdr, CATU_SLADDRLO, CATU_SLADDRHI)
CATU_REG_PAIR(inaddr, CATU_INADDRLO, CATU_INADDRHI)

static inline bool coresight_is_catu_device(struct coresight_device *csdev)
{
	if (!IS_ENABLED(CONFIG_CORESIGHT_CATU))
		return false;
	if (csdev->type != CORESIGHT_DEV_TYPE_HELPER)
		return false;
	if (csdev->subtype.helper_subtype != CORESIGHT_DEV_SUBTYPE_HELPER_CATU)
		return false;
	return true;
}

#endif

Annotation

Implementation Notes