arch/mips/ralink/of.c
Source file repositories/reference/linux-study-clean/arch/mips/ralink/of.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/ralink/of.c- Extension
.c- Size
- 3006 bytes
- Lines
- 121
- 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/clk.hlinux/export.hlinux/init.hlinux/sizes.hlinux/of_fdt.hlinux/kernel.hlinux/memblock.hlinux/of.hlinux/of_address.hasm/reboot.hasm/bootinfo.hasm/addrspace.hasm/prom.hasm/mach-ralink/ralink_regs.hcommon.h
Detected Declarations
function mtmips_of_remap_nodefunction ralink_of_remapfunction plat_mem_setupfunction plat_of_setupexport rt_sysc_membase
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
*
* Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
* Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
* Copyright (C) 2013 John Crispin <john@phrozen.org>
*/
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/export.h>
#include <linux/init.h>
#include <linux/sizes.h>
#include <linux/of_fdt.h>
#include <linux/kernel.h>
#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <asm/reboot.h>
#include <asm/bootinfo.h>
#include <asm/addrspace.h>
#include <asm/prom.h>
#include <asm/mach-ralink/ralink_regs.h>
#include "common.h"
__iomem void *rt_sysc_membase;
__iomem void *rt_memc_membase;
EXPORT_SYMBOL_GPL(rt_sysc_membase);
static const struct of_device_id mtmips_memc_match[] = {
{ .compatible = "mediatek,mt7621-memc" },
{ .compatible = "ralink,mt7620a-memc" },
{ .compatible = "ralink,rt2880-memc" },
{ .compatible = "ralink,rt3050-memc" },
{ .compatible = "ralink,rt3883-memc" },
{}
};
static const struct of_device_id mtmips_sysc_match[] = {
{ .compatible = "mediatek,mt7621-sysc" },
{ .compatible = "ralink,mt7620-sysc" },
{ .compatible = "ralink,mt7628-sysc" },
{ .compatible = "ralink,mt7688-sysc" },
{ .compatible = "ralink,rt2880-sysc" },
{ .compatible = "ralink,rt3050-sysc" },
{ .compatible = "ralink,rt3052-sysc" },
{ .compatible = "ralink,rt3352-sysc" },
{ .compatible = "ralink,rt3883-sysc" },
{ .compatible = "ralink,rt5350-sysc" },
{}
};
static __iomem void *
mtmips_of_remap_node(const struct of_device_id *match, const char *type)
{
struct resource res;
struct device_node *np;
np = of_find_matching_node(NULL, match);
if (!np)
panic("Failed to find %s controller node", type);
if (of_address_to_resource(np, 0, &res))
panic("Failed to get resource for %s node", np->name);
if (!request_mem_region(res.start,
resource_size(&res),
res.name))
panic("Failed to request resources for %s node", np->name);
of_node_put(np);
return ioremap(res.start, resource_size(&res));
}
void __init ralink_of_remap(void)
{
rt_sysc_membase = mtmips_of_remap_node(mtmips_sysc_match, "system");
rt_memc_membase = mtmips_of_remap_node(mtmips_memc_match, "memory");
if (!rt_sysc_membase || !rt_memc_membase)
panic("Failed to remap core resources");
}
void __init plat_mem_setup(void)
{
void *dtb;
Annotation
- Immediate include surface: `linux/io.h`, `linux/clk.h`, `linux/export.h`, `linux/init.h`, `linux/sizes.h`, `linux/of_fdt.h`, `linux/kernel.h`, `linux/memblock.h`.
- Detected declarations: `function mtmips_of_remap_node`, `function ralink_of_remap`, `function plat_mem_setup`, `function plat_of_setup`, `export rt_sysc_membase`.
- 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.