arch/arm/mach-mstar/mstarv7.c
Source file repositories/reference/linux-study-clean/arch/arm/mach-mstar/mstarv7.c
File Facts
- System
- Linux kernel
- Corpus path
arch/arm/mach-mstar/mstarv7.c- Extension
.c- Size
- 3562 bytes
- Lines
- 130
- Domain
- Architecture Layer
- Bucket
- arch/arm
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hasm/mach/arch.hasm/mach/map.hlinux/of.hlinux/of_address.hlinux/io.h
Detected Declarations
function mbfunction mstarv7_boot_secondaryfunction mstarv7_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Device Tree support for MStar/Sigmastar Armv7 SoCs
*
* Copyright (c) 2020 thingy.jp
* Author: Daniel Palmer <daniel@thingy.jp>
*/
#include <linux/init.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/io.h>
/*
* In the u-boot code the area these registers are in is
* called "L3 bridge" and there are register descriptions
* for something in the same area called "AXI".
*
* It's not exactly known what this is but the vendor code
* for both u-boot and linux share calls to "flush the miu pipe".
* This seems to be to force pending CPU writes to memory so that
* the state is right before DMA capable devices try to read
* descriptors and data the CPU has prepared. Without doing this
* ethernet doesn't work reliably for example.
*/
#define MSTARV7_L3BRIDGE_FLUSH 0x14
#define MSTARV7_L3BRIDGE_STATUS 0x40
#define MSTARV7_L3BRIDGE_FLUSH_TRIGGER BIT(0)
#define MSTARV7_L3BRIDGE_STATUS_DONE BIT(12)
#ifdef CONFIG_SMP
#define MSTARV7_CPU1_BOOT_ADDR_HIGH 0x4c
#define MSTARV7_CPU1_BOOT_ADDR_LOW 0x50
#define MSTARV7_CPU1_UNLOCK 0x58
#define MSTARV7_CPU1_UNLOCK_MAGIC 0xbabe
#endif
static void __iomem *l3bridge;
static const char * const mstarv7_board_dt_compat[] __initconst = {
"mstar,infinity",
"mstar,infinity2m",
"mstar,infinity3",
"mstar,mercury5",
NULL,
};
/*
* This may need locking to deal with situations where an interrupt
* happens while we are in here and mb() gets called by the interrupt handler.
*
* The vendor code did have a spin lock but it doesn't seem to be needed and
* removing it hasn't caused any side effects so far.
*
* [writel|readl]_relaxed have to be used here because otherwise
* we'd end up right back in here.
*/
static void mstarv7_mb(void)
{
/* toggle the flush miu pipe fire bit */
writel_relaxed(0, l3bridge + MSTARV7_L3BRIDGE_FLUSH);
writel_relaxed(MSTARV7_L3BRIDGE_FLUSH_TRIGGER, l3bridge
+ MSTARV7_L3BRIDGE_FLUSH);
while (!(readl_relaxed(l3bridge + MSTARV7_L3BRIDGE_STATUS)
& MSTARV7_L3BRIDGE_STATUS_DONE)) {
/* wait for flush to complete */
}
}
#ifdef CONFIG_SMP
static int mstarv7_boot_secondary(unsigned int cpu, struct task_struct *idle)
{
struct device_node *np;
u32 bootaddr = (u32) __pa_symbol(secondary_startup_arm);
void __iomem *smpctrl;
/*
* right now we don't know how to boot anything except
* cpu 1.
*/
if (cpu != 1)
return -EINVAL;
np = of_find_compatible_node(NULL, NULL, "mstar,smpctrl");
smpctrl = of_iomap(np, 0);
if (!smpctrl)
Annotation
- Immediate include surface: `linux/init.h`, `asm/mach/arch.h`, `asm/mach/map.h`, `linux/of.h`, `linux/of_address.h`, `linux/io.h`.
- Detected declarations: `function mb`, `function mstarv7_boot_secondary`, `function mstarv7_init`.
- Atlas domain: Architecture Layer / arch/arm.
- 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.