arch/mips/ath25/ar5312.c
Source file repositories/reference/linux-study-clean/arch/mips/ath25/ar5312.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/ath25/ar5312.c- Extension
.c- Size
- 10422 bytes
- Lines
- 391
- 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/mtd/physmap.hlinux/reboot.hasm/bootinfo.hasm/reboot.hasm/time.hath25_platform.hdevices.har5312.har5312_regs.h
Detected Declarations
function ar5312_rst_reg_readfunction ar5312_rst_reg_writefunction ar5312_rst_reg_maskfunction ar5312_ahb_err_handlerfunction ar5312_misc_irq_handlerfunction ar5312_misc_irq_unmaskfunction ar5312_misc_irq_maskfunction ar5312_misc_irq_mapfunction ar5312_irq_dispatchfunction ar5312_arch_init_irqfunction ar5312_flash_initfunction ar5312_init_devicesfunction ar5312_restartfunction ar5312_cpu_frequencyfunction ar5312_sys_frequencyfunction ar5312_plat_time_initfunction ar5312_plat_mem_setupfunction ar5312_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/mtd/physmap.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 "ar5312.h"
#include "ar5312_regs.h"
static void __iomem *ar5312_rst_base;
static struct irq_domain *ar5312_misc_irq_domain;
static inline u32 ar5312_rst_reg_read(u32 reg)
{
return __raw_readl(ar5312_rst_base + reg);
}
static inline void ar5312_rst_reg_write(u32 reg, u32 val)
{
__raw_writel(val, ar5312_rst_base + reg);
}
static inline void ar5312_rst_reg_mask(u32 reg, u32 mask, u32 val)
{
u32 ret = ar5312_rst_reg_read(reg);
ret &= ~mask;
ret |= val;
ar5312_rst_reg_write(reg, ret);
}
static irqreturn_t ar5312_ahb_err_handler(int cpl, void *dev_id)
{
u32 proc1 = ar5312_rst_reg_read(AR5312_PROC1);
u32 proc_addr = ar5312_rst_reg_read(AR5312_PROCADDR); /* clears error */
u32 dma1 = ar5312_rst_reg_read(AR5312_DMA1);
u32 dma_addr = ar5312_rst_reg_read(AR5312_DMAADDR); /* clears error */
pr_emerg("AHB interrupt: PROCADDR=0x%8.8x PROC1=0x%8.8x DMAADDR=0x%8.8x DMA1=0x%8.8x\n",
proc_addr, proc1, dma_addr, dma1);
machine_restart("AHB error"); /* Catastrophic failure */
return IRQ_HANDLED;
}
static void ar5312_misc_irq_handler(struct irq_desc *desc)
{
u32 pending = ar5312_rst_reg_read(AR5312_ISR) &
ar5312_rst_reg_read(AR5312_IMR);
unsigned nr;
int ret = 0;
if (pending) {
struct irq_domain *domain = irq_desc_get_handler_data(desc);
nr = __ffs(pending);
ret = generic_handle_domain_irq(domain, nr);
if (nr == AR5312_MISC_IRQ_TIMER)
ar5312_rst_reg_read(AR5312_TIMER);
}
if (!pending || ret)
spurious_interrupt();
}
/* Enable the specified AR5312_MISC_IRQ interrupt */
static void ar5312_misc_irq_unmask(struct irq_data *d)
{
ar5312_rst_reg_mask(AR5312_IMR, 0, BIT(d->hwirq));
}
/* Disable the specified AR5312_MISC_IRQ interrupt */
static void ar5312_misc_irq_mask(struct irq_data *d)
{
ar5312_rst_reg_mask(AR5312_IMR, BIT(d->hwirq), 0);
ar5312_rst_reg_read(AR5312_IMR); /* flush write buffer */
}
static struct irq_chip ar5312_misc_irq_chip = {
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/mtd/physmap.h`.
- Detected declarations: `function ar5312_rst_reg_read`, `function ar5312_rst_reg_write`, `function ar5312_rst_reg_mask`, `function ar5312_ahb_err_handler`, `function ar5312_misc_irq_handler`, `function ar5312_misc_irq_unmask`, `function ar5312_misc_irq_mask`, `function ar5312_misc_irq_map`, `function ar5312_irq_dispatch`, `function ar5312_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.