drivers/irqchip/irq-renesas-rzg2l.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-renesas-rzg2l.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-renesas-rzg2l.c- Extension
.c- Size
- 26955 bytes
- Lines
- 953
- 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/bitfield.hlinux/clk.hlinux/err.hlinux/io.hlinux/irqchip.hlinux/irqdomain.hlinux/of_address.hlinux/of_platform.hlinux/pm_runtime.hlinux/reset.hlinux/spinlock.hlinux/syscore_ops.h
Detected Declarations
struct rzg2l_irqc_reg_cachestruct rzg2l_hw_infofunction rzg2l_clear_nmi_intfunction rzg2l_clear_irq_intfunction rzg2l_clear_tint_intfunction rzg2l_irqc_nmi_eoifunction rzg2l_irqc_irq_eoifunction rzg2l_irqc_tint_eoifunction rzfive_irqc_mask_irq_interruptfunction rzfive_irqc_unmask_irq_interruptfunction rzfive_irqc_mask_tint_interruptfunction rzfive_irqc_unmask_tint_interruptfunction rzfive_irqc_irq_maskfunction rzfive_irqc_tint_maskfunction rzfive_irqc_irq_unmaskfunction rzfive_irqc_tint_unmaskfunction rzfive_irq_endisablefunction rzfive_tint_endisablefunction rzfive_irqc_irq_disablefunction rzfive_irqc_irq_enablefunction rzfive_irqc_tint_disablefunction rzfive_irqc_tint_enablefunction rzg2l_tint_irq_endisablefunction rzg2l_irqc_tint_disablefunction rzg2l_irqc_tint_enablefunction rzg2l_nmi_set_typefunction rzg2l_irq_set_typefunction rzg2l_disable_tint_and_set_tint_sourcefunction rzg2l_tint_set_edgefunction rzg2l_irqc_irq_set_typefunction rzg2l_irqc_tint_set_typefunction rzg2l_irqc_nmi_set_typefunction rzg2l_irqc_irq_suspendfunction rzg2l_irqc_irq_resumefunction rzg2l_irqc_is_shared_irqcfunction rzg2l_irqc_is_shared_tintfunction rzg2l_irqc_is_shared_and_get_irq_numfunction rzg2l_irqc_set_inttselfunction rzg2l_irqc_shared_irq_allocfunction rzg2l_irqc_shared_irq_freefunction rzg2l_irqc_allocfunction rzg2l_irqc_freefunction rzg2l_irqc_parse_interruptsfunction rzg2l_irqc_common_probefunction rzg2l_irqc_probefunction rzg3l_irqc_probefunction rzfive_irqc_probe
Annotated Snippet
struct rzg2l_irqc_reg_cache {
u32 nitsr;
u32 iitsr;
u32 inttsel;
u32 titsr[2];
};
/**
* struct rzg2l_hw_info - Interrupt Control Unit controller hardware info structure.
* @tssel_lut: TINT lookup table
* @irq_count: Number of IRQC interrupts
* @tint_start: Start of TINT interrupts
* @num_irq: Total Number of interrupts
* @shared_irq_cnt: Number of shared interrupts
*/
struct rzg2l_hw_info {
const u8 *tssel_lut;
unsigned int irq_count;
unsigned int tint_start;
unsigned int num_irq;
unsigned int shared_irq_cnt;
};
/**
* struct rzg2l_irqc_priv - IRQ controller private data structure
* @base: Controller's base address
* @irq_chip: Pointer to struct irq_chip for irq
* @tint_chip: Pointer to struct irq_chip for tint
* @fwspec: IRQ firmware specific data
* @lock: Lock to serialize access to hardware registers
* @info: Hardware specific data
* @cache: Registers cache for suspend/resume
* @used_irqs: Bitmap to manage the shared interrupts
*/
static struct rzg2l_irqc_priv {
void __iomem *base;
const struct irq_chip *irq_chip;
const struct irq_chip *tint_chip;
struct irq_fwspec *fwspec;
raw_spinlock_t lock;
struct rzg2l_hw_info info;
struct rzg2l_irqc_reg_cache cache;
DECLARE_BITMAP(used_irqs, IRQC_SHARED_IRQ_COUNT);
} *rzg2l_irqc_data;
static struct rzg2l_irqc_priv *irq_data_to_priv(struct irq_data *data)
{
return data->domain->host_data;
}
static void rzg2l_clear_nmi_int(struct rzg2l_irqc_priv *priv)
{
u32 bit = BIT(NSCR_NSTAT);
u32 reg;
/*
* No locking required as the register is not shared
* with other interrupts.
*
* Writing is allowed only when NSTAT is 1
*/
reg = readl_relaxed(priv->base + NSCR);
if (reg & bit) {
writel_relaxed(reg & ~bit, priv->base + NSCR);
/*
* Enforce that the posted write is flushed to prevent that the
* just handled interrupt is raised again.
*/
readl_relaxed(priv->base + NSCR);
}
}
static void rzg2l_clear_irq_int(struct rzg2l_irqc_priv *priv, unsigned int hwirq)
{
unsigned int hw_irq = hwirq - IRQC_IRQ_START;
u32 bit = BIT(hw_irq);
u32 iitsr, iscr;
iscr = readl_relaxed(priv->base + ISCR);
iitsr = readl_relaxed(priv->base + IITSR);
/*
* ISCR can only be cleared if the type is falling-edge, rising-edge or
* falling/rising-edge.
*/
if ((iscr & bit) && (iitsr & IITSR_IITSEL_MASK(hw_irq))) {
writel_relaxed(iscr & ~bit, priv->base + ISCR);
/*
* Enforce that the posted write is flushed to prevent that the
* just handled interrupt is raised again.
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/err.h`, `linux/io.h`, `linux/irqchip.h`, `linux/irqdomain.h`, `linux/of_address.h`, `linux/of_platform.h`.
- Detected declarations: `struct rzg2l_irqc_reg_cache`, `struct rzg2l_hw_info`, `function rzg2l_clear_nmi_int`, `function rzg2l_clear_irq_int`, `function rzg2l_clear_tint_int`, `function rzg2l_irqc_nmi_eoi`, `function rzg2l_irqc_irq_eoi`, `function rzg2l_irqc_tint_eoi`, `function rzfive_irqc_mask_irq_interrupt`, `function rzfive_irqc_unmask_irq_interrupt`.
- 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.