drivers/irqchip/irq-stm32mp-exti.c

Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-stm32mp-exti.c

File Facts

System
Linux kernel
Corpus path
drivers/irqchip/irq-stm32mp-exti.c
Extension
.c
Size
18300 bytes
Lines
726
Domain
Driver Families
Bucket
drivers/irqchip
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 stm32mp_exti_bank {
	u32 imr_ofst;
	u32 rtsr_ofst;
	u32 ftsr_ofst;
	u32 swier_ofst;
	u32 rpr_ofst;
	u32 fpr_ofst;
	u32 trg_ofst;
	u32 seccfgr_ofst;
};

struct stm32mp_exti_drv_data {
	const struct stm32mp_exti_bank	**exti_banks;
	const u8			*desc_irqs;
	u32				bank_nr;
};

struct stm32mp_exti_chip_data {
	struct stm32mp_exti_host_data	*host_data;
	const struct stm32mp_exti_bank	*reg_bank;
	struct raw_spinlock		rlock;
	u32				wake_active;
	u32				mask_cache;
	u32				rtsr_cache;
	u32				ftsr_cache;
	u32				event_reserved;
};

struct stm32mp_exti_host_data {
	void __iomem				*base;
	struct device				*dev;
	struct stm32mp_exti_chip_data		*chips_data;
	const struct stm32mp_exti_drv_data	*drv_data;
	struct hwspinlock			*hwlock;
	/* skip internal desc_irqs array and get it from DT */
	bool dt_has_irqs_desc;
};

static const struct stm32mp_exti_bank stm32mp_exti_b1 = {
	.imr_ofst	= 0x80,
	.rtsr_ofst	= 0x00,
	.ftsr_ofst	= 0x04,
	.swier_ofst	= 0x08,
	.rpr_ofst	= 0x0C,
	.fpr_ofst	= 0x10,
	.trg_ofst	= 0x3EC,
	.seccfgr_ofst	= 0x14,
};

static const struct stm32mp_exti_bank stm32mp_exti_b2 = {
	.imr_ofst	= 0x90,
	.rtsr_ofst	= 0x20,
	.ftsr_ofst	= 0x24,
	.swier_ofst	= 0x28,
	.rpr_ofst	= 0x2C,
	.fpr_ofst	= 0x30,
	.trg_ofst	= 0x3E8,
	.seccfgr_ofst	= 0x34,
};

static const struct stm32mp_exti_bank stm32mp_exti_b3 = {
	.imr_ofst	= 0xA0,
	.rtsr_ofst	= 0x40,
	.ftsr_ofst	= 0x44,
	.swier_ofst	= 0x48,
	.rpr_ofst	= 0x4C,
	.fpr_ofst	= 0x50,
	.trg_ofst	= 0x3E4,
	.seccfgr_ofst	= 0x54,
};

static const struct stm32mp_exti_bank *stm32mp_exti_banks[] = {
	&stm32mp_exti_b1,
	&stm32mp_exti_b2,
	&stm32mp_exti_b3,
};

static struct irq_chip stm32mp_exti_chip;
static struct irq_chip stm32mp_exti_chip_direct;

#define EXTI_INVALID_IRQ       U8_MAX
#define STM32MP_DESC_IRQ_SIZE  (ARRAY_SIZE(stm32mp_exti_banks) * IRQS_PER_BANK)

/*
 * Use some intentionally tricky logic here to initialize the whole array to
 * EXTI_INVALID_IRQ, but then override certain fields, requiring us to indicate
 * that we "know" that there are overrides in this structure, and we'll need to
 * disable that warning from W=1 builds.
 */
__diag_push();

Annotation

Implementation Notes