arch/mips/ralink/irq.c
Source file repositories/reference/linux-study-clean/arch/mips/ralink/irq.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/ralink/irq.c- Extension
.c- Size
- 4762 bytes
- Lines
- 206
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/bitops.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/irqdomain.hlinux/interrupt.hasm/irq_cpu.hasm/mipsregs.hasm/time.hcommon.h
Detected Declarations
enum rt_intc_regs_enumfunction rt_intc_w32function rt_intc_r32function ralink_intc_irq_unmaskfunction ralink_intc_irq_maskfunction get_c0_perfcount_intfunction get_c0_compare_intfunction ralink_intc_irq_handlerfunction plat_irq_dispatchfunction intc_mapfunction intc_of_initfunction arch_init_irqexport get_c0_perfcount_int
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
*
* Copyright (C) 2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2013 John Crispin <john@phrozen.org>
*/
#include <linux/io.h>
#include <linux/bitops.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/irqdomain.h>
#include <linux/interrupt.h>
#include <asm/irq_cpu.h>
#include <asm/mipsregs.h>
#include <asm/time.h>
#include "common.h"
#define INTC_INT_GLOBAL BIT(31)
#define RALINK_CPU_IRQ_INTC (MIPS_CPU_IRQ_BASE + 2)
#define RALINK_CPU_IRQ_PCI (MIPS_CPU_IRQ_BASE + 4)
#define RALINK_CPU_IRQ_FE (MIPS_CPU_IRQ_BASE + 5)
#define RALINK_CPU_IRQ_WIFI (MIPS_CPU_IRQ_BASE + 6)
#define RALINK_CPU_IRQ_COUNTER (MIPS_CPU_IRQ_BASE + 7)
/* we have a cascade of 8 irqs */
#define RALINK_INTC_IRQ_BASE 8
/* we have 32 SoC irqs */
#define RALINK_INTC_IRQ_COUNT 32
#define RALINK_INTC_IRQ_PERFC (RALINK_INTC_IRQ_BASE + 9)
enum rt_intc_regs_enum {
INTC_REG_STATUS0 = 0,
INTC_REG_STATUS1,
INTC_REG_TYPE,
INTC_REG_RAW_STATUS,
INTC_REG_ENABLE,
INTC_REG_DISABLE,
};
static u32 rt_intc_regs[] = {
[INTC_REG_STATUS0] = 0x00,
[INTC_REG_STATUS1] = 0x04,
[INTC_REG_TYPE] = 0x20,
[INTC_REG_RAW_STATUS] = 0x30,
[INTC_REG_ENABLE] = 0x34,
[INTC_REG_DISABLE] = 0x38,
};
static void __iomem *rt_intc_membase;
static int rt_perfcount_irq;
static inline void rt_intc_w32(u32 val, unsigned reg)
{
__raw_writel(val, rt_intc_membase + rt_intc_regs[reg]);
}
static inline u32 rt_intc_r32(unsigned reg)
{
return __raw_readl(rt_intc_membase + rt_intc_regs[reg]);
}
static void ralink_intc_irq_unmask(struct irq_data *d)
{
rt_intc_w32(BIT(d->hwirq), INTC_REG_ENABLE);
}
static void ralink_intc_irq_mask(struct irq_data *d)
{
rt_intc_w32(BIT(d->hwirq), INTC_REG_DISABLE);
}
static struct irq_chip ralink_intc_irq_chip = {
.name = "INTC",
.irq_unmask = ralink_intc_irq_unmask,
.irq_mask = ralink_intc_irq_mask,
.irq_mask_ack = ralink_intc_irq_mask,
};
int get_c0_perfcount_int(void)
{
return rt_perfcount_irq;
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/bitops.h`, `linux/of.h`, `linux/of_address.h`, `linux/of_irq.h`, `linux/irqdomain.h`, `linux/interrupt.h`, `asm/irq_cpu.h`.
- Detected declarations: `enum rt_intc_regs_enum`, `function rt_intc_w32`, `function rt_intc_r32`, `function ralink_intc_irq_unmask`, `function ralink_intc_irq_mask`, `function get_c0_perfcount_int`, `function get_c0_compare_int`, `function ralink_intc_irq_handler`, `function plat_irq_dispatch`, `function intc_map`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: integration 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.