drivers/irqchip/irq-brcmstb-l2.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-brcmstb-l2.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-brcmstb-l2.c- Extension
.c- Size
- 7611 bytes
- Lines
- 277
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/init.hlinux/slab.hlinux/module.hlinux/platform_device.hlinux/spinlock.hlinux/of.hlinux/of_irq.hlinux/of_address.hlinux/interrupt.hlinux/irq.hlinux/io.hlinux/irqdomain.hlinux/irqchip.hlinux/irqchip/chained_irq.h
Detected Declarations
struct brcmstb_intc_init_paramsstruct brcmstb_l2_intc_datafunction brcmstb_l2_intc_irq_handlefunction __brcmstb_l2_intc_suspendfunction brcmstb_l2_intc_shutdownfunction brcmstb_l2_intc_suspendfunction brcmstb_l2_intc_resumefunction brcmstb_l2_intc_probefunction brcmstb_l2_edge_intc_probefunction brcmstb_l2_lvl_intc_probe
Annotated Snippet
struct brcmstb_intc_init_params {
irq_flow_handler_t handler;
int cpu_status;
int cpu_clear;
int cpu_mask_status;
int cpu_mask_set;
int cpu_mask_clear;
};
/* Register offsets in the L2 latched interrupt controller */
static const struct brcmstb_intc_init_params l2_edge_intc_init = {
.handler = handle_edge_irq,
.cpu_status = 0x00,
.cpu_clear = 0x08,
.cpu_mask_status = 0x0c,
.cpu_mask_set = 0x10,
.cpu_mask_clear = 0x14
};
/* Register offsets in the L2 level interrupt controller */
static const struct brcmstb_intc_init_params l2_lvl_intc_init = {
.handler = handle_level_irq,
.cpu_status = 0x00,
.cpu_clear = -1, /* Register not present */
.cpu_mask_status = 0x04,
.cpu_mask_set = 0x08,
.cpu_mask_clear = 0x0C
};
/* L2 intc private data structure */
struct brcmstb_l2_intc_data {
struct irq_domain *domain;
struct irq_chip_generic *gc;
int status_offset;
int mask_offset;
bool can_wake;
u32 saved_mask; /* for suspend/resume */
};
static void brcmstb_l2_intc_irq_handle(struct irq_desc *desc)
{
struct brcmstb_l2_intc_data *b = irq_desc_get_handler_data(desc);
struct irq_chip *chip = irq_desc_get_chip(desc);
unsigned int irq;
u32 status;
chained_irq_enter(chip, desc);
status = irq_reg_readl(b->gc, b->status_offset) &
~(irq_reg_readl(b->gc, b->mask_offset));
if (status == 0) {
raw_spin_lock(&desc->lock);
handle_bad_irq(desc);
raw_spin_unlock(&desc->lock);
goto out;
}
do {
irq = ffs(status) - 1;
status &= ~(1 << irq);
generic_handle_domain_irq(b->domain, irq);
} while (status);
out:
/* Don't ack parent before all device writes are done */
wmb();
chained_irq_exit(chip, desc);
}
static void __brcmstb_l2_intc_suspend(struct irq_data *d, bool save)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct irq_chip_type *ct = irq_data_get_chip_type(d);
struct brcmstb_l2_intc_data *b = gc->private;
guard(raw_spinlock_irqsave)(&gc->lock);
/* Save the current mask */
if (save)
b->saved_mask = irq_reg_readl(gc, ct->regs.mask);
if (b->can_wake) {
/* Program the wakeup mask */
irq_reg_writel(gc, ~gc->wake_active, ct->regs.disable);
irq_reg_writel(gc, gc->wake_active, ct->regs.enable);
}
}
static void brcmstb_l2_intc_shutdown(struct irq_data *d)
{
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/module.h`, `linux/platform_device.h`, `linux/spinlock.h`, `linux/of.h`, `linux/of_irq.h`, `linux/of_address.h`.
- Detected declarations: `struct brcmstb_intc_init_params`, `struct brcmstb_l2_intc_data`, `function brcmstb_l2_intc_irq_handle`, `function __brcmstb_l2_intc_suspend`, `function brcmstb_l2_intc_shutdown`, `function brcmstb_l2_intc_suspend`, `function brcmstb_l2_intc_resume`, `function brcmstb_l2_intc_probe`, `function brcmstb_l2_edge_intc_probe`, `function brcmstb_l2_lvl_intc_probe`.
- Atlas domain: Driver Families / drivers/irqchip.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.