arch/mips/ath25/ar2315.c
Source file repositories/reference/linux-study-clean/arch/mips/ath25/ar2315.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/ath25/ar2315.c- Extension
.c- Size
- 9548 bytes
- Lines
- 363
- Domain
- Architecture Layer
- Bucket
- arch/mips
- Inferred role
- Architecture Layer: implementation source
- Status
- source 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/bitops.hlinux/irqdomain.hlinux/interrupt.hlinux/memblock.hlinux/platform_device.hlinux/reboot.hasm/bootinfo.hasm/reboot.hasm/time.hath25_platform.hdevices.har2315.har2315_regs.h
Detected Declarations
function ar2315_rst_reg_readfunction ar2315_rst_reg_writefunction ar2315_rst_reg_maskfunction ar2315_ahb_err_handlerfunction ar2315_misc_irq_handlerfunction ar2315_misc_irq_unmaskfunction ar2315_misc_irq_maskfunction ar2315_misc_irq_mapfunction ar2315_irq_dispatchfunction ar2315_arch_init_irqfunction ar2315_init_devicesfunction ar2315_restartfunction ar2315_sys_clkfunction ar2315_cpu_frequencyfunction ar2315_apb_frequencyfunction ar2315_plat_time_initfunction ar2315_plat_mem_setupfunction ar2315_arch_init
Annotated Snippet
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/bitops.h>
#include <linux/irqdomain.h>
#include <linux/interrupt.h>
#include <linux/memblock.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
#include <ath25_platform.h>
#include "devices.h"
#include "ar2315.h"
#include "ar2315_regs.h"
static void __iomem *ar2315_rst_base;
static struct irq_domain *ar2315_misc_irq_domain;
static inline u32 ar2315_rst_reg_read(u32 reg)
{
return __raw_readl(ar2315_rst_base + reg);
}
static inline void ar2315_rst_reg_write(u32 reg, u32 val)
{
__raw_writel(val, ar2315_rst_base + reg);
}
static inline void ar2315_rst_reg_mask(u32 reg, u32 mask, u32 val)
{
u32 ret = ar2315_rst_reg_read(reg);
ret &= ~mask;
ret |= val;
ar2315_rst_reg_write(reg, ret);
}
static irqreturn_t ar2315_ahb_err_handler(int cpl, void *dev_id)
{
ar2315_rst_reg_write(AR2315_AHB_ERR0, AR2315_AHB_ERROR_DET);
ar2315_rst_reg_read(AR2315_AHB_ERR1);
pr_emerg("AHB fatal error\n");
machine_restart("AHB error"); /* Catastrophic failure */
return IRQ_HANDLED;
}
static void ar2315_misc_irq_handler(struct irq_desc *desc)
{
u32 pending = ar2315_rst_reg_read(AR2315_ISR) &
ar2315_rst_reg_read(AR2315_IMR);
unsigned nr;
int ret = 0;
if (pending) {
struct irq_domain *domain = irq_desc_get_handler_data(desc);
nr = __ffs(pending);
if (nr == AR2315_MISC_IRQ_GPIO)
ar2315_rst_reg_write(AR2315_ISR, AR2315_ISR_GPIO);
else if (nr == AR2315_MISC_IRQ_WATCHDOG)
ar2315_rst_reg_write(AR2315_ISR, AR2315_ISR_WD);
ret = generic_handle_domain_irq(domain, nr);
}
if (!pending || ret)
spurious_interrupt();
}
static void ar2315_misc_irq_unmask(struct irq_data *d)
{
ar2315_rst_reg_mask(AR2315_IMR, 0, BIT(d->hwirq));
}
static void ar2315_misc_irq_mask(struct irq_data *d)
{
ar2315_rst_reg_mask(AR2315_IMR, BIT(d->hwirq), 0);
}
static struct irq_chip ar2315_misc_irq_chip = {
.name = "ar2315-misc",
.irq_unmask = ar2315_misc_irq_unmask,
.irq_mask = ar2315_misc_irq_mask,
};
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/bitops.h`, `linux/irqdomain.h`, `linux/interrupt.h`, `linux/memblock.h`, `linux/platform_device.h`, `linux/reboot.h`.
- Detected declarations: `function ar2315_rst_reg_read`, `function ar2315_rst_reg_write`, `function ar2315_rst_reg_mask`, `function ar2315_ahb_err_handler`, `function ar2315_misc_irq_handler`, `function ar2315_misc_irq_unmask`, `function ar2315_misc_irq_mask`, `function ar2315_misc_irq_map`, `function ar2315_irq_dispatch`, `function ar2315_arch_init_irq`.
- Atlas domain: Architecture Layer / arch/mips.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.