drivers/irqchip/irq-csky-apb-intc.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-csky-apb-intc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-csky-apb-intc.c- Extension
.c- Size
- 6737 bytes
- Lines
- 281
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/init.hlinux/of.hlinux/of_address.hlinux/module.hlinux/irqdomain.hlinux/irqchip.hlinux/irq.hlinux/interrupt.hlinux/io.hasm/irq.h
Detected Declarations
function irq_ck_mask_set_bitfunction ck_set_gcfunction build_channel_valfunction setup_irq_channelfunction ck_intc_init_commfunction handle_irq_perbitfunction gx_irq_handlerfunction gx_intc_initfunction ck_irq_handlerfunction ck_intc_initfunction ck_dual_intc_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/module.h>
#include <linux/irqdomain.h>
#include <linux/irqchip.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/irq.h>
#define INTC_IRQS 64
#define CK_INTC_ICR 0x00
#define CK_INTC_PEN31_00 0x14
#define CK_INTC_PEN63_32 0x2c
#define CK_INTC_NEN31_00 0x10
#define CK_INTC_NEN63_32 0x28
#define CK_INTC_SOURCE 0x40
#define CK_INTC_DUAL_BASE 0x100
#define GX_INTC_PEN31_00 0x00
#define GX_INTC_PEN63_32 0x04
#define GX_INTC_NEN31_00 0x40
#define GX_INTC_NEN63_32 0x44
#define GX_INTC_NMASK31_00 0x50
#define GX_INTC_NMASK63_32 0x54
#define GX_INTC_SOURCE 0x60
static void __iomem *reg_base;
static struct irq_domain *root_domain;
static int nr_irq = INTC_IRQS;
/*
* When controller support pulse signal, the PEN_reg will hold on signal
* without software trigger.
*
* So, to support pulse signal we need to clear IFR_reg and the address of
* IFR_offset is NEN_offset - 8.
*/
static void irq_ck_mask_set_bit(struct irq_data *d)
{
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct irq_chip_type *ct = irq_data_get_chip_type(d);
unsigned long ifr = ct->regs.mask - 8;
u32 mask = d->mask;
guard(raw_spinlock)(&gc->lock);
*ct->mask_cache |= mask;
irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask);
irq_reg_writel(gc, irq_reg_readl(gc, ifr) & ~mask, ifr);
}
static void __init ck_set_gc(struct device_node *node, void __iomem *reg_base,
u32 mask_reg, u32 irq_base)
{
struct irq_chip_generic *gc;
gc = irq_get_domain_generic_chip(root_domain, irq_base);
gc->reg_base = reg_base;
gc->chip_types[0].regs.mask = mask_reg;
gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
if (of_property_read_bool(node, "csky,support-pulse-signal"))
gc->chip_types[0].chip.irq_unmask = irq_ck_mask_set_bit;
}
static inline u32 build_channel_val(u32 idx, u32 magic)
{
u32 res;
/*
* Set the same index for each channel
*/
res = idx | (idx << 8) | (idx << 16) | (idx << 24);
/*
* Set the channel magic number in descending order.
* The magic is 0x00010203 for ck-intc
* The magic is 0x03020100 for gx6605s-intc
*/
return res | magic;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/init.h`, `linux/of.h`, `linux/of_address.h`, `linux/module.h`, `linux/irqdomain.h`, `linux/irqchip.h`, `linux/irq.h`.
- Detected declarations: `function irq_ck_mask_set_bit`, `function ck_set_gc`, `function build_channel_val`, `function setup_irq_channel`, `function ck_intc_init_comm`, `function handle_irq_perbit`, `function gx_irq_handler`, `function gx_intc_init`, `function ck_irq_handler`, `function ck_intc_init`.
- 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.