drivers/irqchip/irq-pic32-evic.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-pic32-evic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-pic32-evic.c- Extension
.c- Size
- 8373 bytes
- Lines
- 324
- 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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/interrupt.hlinux/irqdomain.hlinux/of_address.hlinux/slab.hlinux/io.hlinux/irqchip.hlinux/irq.hlinux/platform_data/pic32.hasm/irq.hasm/traps.h
Detected Declarations
struct evic_chip_datafunction plat_irq_dispatchfunction pic32_set_ext_polarityfunction pic32_set_type_edgefunction pic32_bind_evic_interruptfunction pic32_set_irq_priorityfunction pic32_irq_domain_mapfunction pic32_irq_domain_xlatefunction pic32_ext_irq_of_initfunction of_property_for_each_u32function pic32_of_init
Annotated Snippet
struct evic_chip_data {
u32 irq_types[NR_IRQS];
u32 ext_irqs[8];
};
static struct irq_domain *evic_irq_domain;
static void __iomem *evic_base;
#ifdef CONFIG_MIPS
asmlinkage void __weak plat_irq_dispatch(void)
{
unsigned int hwirq;
hwirq = readl(evic_base + REG_INTSTAT) & 0xFF;
do_domain_IRQ(evic_irq_domain, hwirq);
}
#else
static __maybe_unused void (*board_bind_eic_interrupt)(int irq, int regset);
#endif
static struct evic_chip_data *irqd_to_priv(struct irq_data *data)
{
return (struct evic_chip_data *)data->domain->host_data;
}
static int pic32_set_ext_polarity(int bit, u32 type)
{
/*
* External interrupts can be either edge rising or edge falling,
* but not both.
*/
switch (type) {
case IRQ_TYPE_EDGE_RISING:
writel(BIT(bit), evic_base + PIC32_SET(REG_INTCON));
break;
case IRQ_TYPE_EDGE_FALLING:
writel(BIT(bit), evic_base + PIC32_CLR(REG_INTCON));
break;
default:
return -EINVAL;
}
return 0;
}
static int pic32_set_type_edge(struct irq_data *data,
unsigned int flow_type)
{
struct evic_chip_data *priv = irqd_to_priv(data);
int ret;
int i;
if (!(flow_type & IRQ_TYPE_EDGE_BOTH))
return -EBADR;
/* set polarity for external interrupts only */
for (i = 0; i < ARRAY_SIZE(priv->ext_irqs); i++) {
if (priv->ext_irqs[i] == data->hwirq) {
ret = pic32_set_ext_polarity(i, flow_type);
if (ret)
return ret;
}
}
irqd_set_trigger_type(data, flow_type);
return IRQ_SET_MASK_OK;
}
static void pic32_bind_evic_interrupt(int irq, int set)
{
writel(set, evic_base + REG_OFF_OFFSET + irq * 4);
}
static void pic32_set_irq_priority(int irq, int priority)
{
u32 reg, shift;
reg = irq / 4;
shift = (irq % 4) * 8;
writel(PRIORITY_MASK << shift,
evic_base + PIC32_CLR(REG_IPC_OFFSET + reg * 0x10));
writel(priority << shift,
evic_base + PIC32_SET(REG_IPC_OFFSET + reg * 0x10));
}
#define IRQ_REG_MASK(_hwirq, _reg, _mask) \
do { \
_reg = _hwirq / 32; \
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/interrupt.h`, `linux/irqdomain.h`, `linux/of_address.h`, `linux/slab.h`, `linux/io.h`, `linux/irqchip.h`.
- Detected declarations: `struct evic_chip_data`, `function plat_irq_dispatch`, `function pic32_set_ext_polarity`, `function pic32_set_type_edge`, `function pic32_bind_evic_interrupt`, `function pic32_set_irq_priority`, `function pic32_irq_domain_map`, `function pic32_irq_domain_xlate`, `function pic32_ext_irq_of_init`, `function of_property_for_each_u32`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.