arch/xtensa/platforms/xtfpga/setup.c
Source file repositories/reference/linux-study-clean/arch/xtensa/platforms/xtfpga/setup.c
File Facts
- System
- Linux kernel
- Corpus path
arch/xtensa/platforms/xtfpga/setup.c- Extension
.c- Size
- 6944 bytes
- Lines
- 302
- Domain
- Architecture Layer
- Bucket
- arch/xtensa
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/stddef.hlinux/kernel.hlinux/init.hlinux/io.hlinux/errno.hlinux/reboot.hlinux/kdev_t.hlinux/types.hlinux/major.hlinux/console.hlinux/delay.hlinux/of.hlinux/clk-provider.hlinux/of_address.hlinux/slab.hasm/timex.hasm/processor.hasm/platform.hasm/bootparam.hplatform/lcd.hplatform/hardware.hlinux/serial_8250.hlinux/if.hnet/ethoc.hlinux/usb/c67x00.h
Detected Declarations
function xtfpga_power_offfunction xtfpga_restartfunction platform_calibrate_ccountfunction xtfpga_register_handlersfunction xtfpga_clk_setupfunction update_local_macfunction machine_setupfunction xtavnet_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
*
* arch/xtensa/platform/xtavnet/setup.c
*
* ...
*
* Authors: Chris Zankel <chris@zankel.net>
* Joe Taylor <joe@tensilica.com>
*
* Copyright 2001 - 2006 Tensilica Inc.
*/
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/errno.h>
#include <linux/reboot.h>
#include <linux/kdev_t.h>
#include <linux/types.h>
#include <linux/major.h>
#include <linux/console.h>
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/clk-provider.h>
#include <linux/of_address.h>
#include <linux/slab.h>
#include <asm/timex.h>
#include <asm/processor.h>
#include <asm/platform.h>
#include <asm/bootparam.h>
#include <platform/lcd.h>
#include <platform/hardware.h>
static int xtfpga_power_off(struct sys_off_data *unused)
{
lcd_disp_at_pos("POWEROFF", 0);
local_irq_disable();
while (1)
cpu_relax();
return NOTIFY_DONE;
}
static int xtfpga_restart(struct sys_off_data *unused)
{
/* Try software reset first. */
WRITE_ONCE(*(u32 *)XTFPGA_SWRST_VADDR, 0xdead);
/* If software reset did not work, flush and reset the mmu,
* simulate a processor reset, and jump to the reset vector.
*/
cpu_reset();
return NOTIFY_DONE;
}
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
void __init platform_calibrate_ccount(void)
{
ccount_freq = *(long *)XTFPGA_CLKFRQ_VADDR;
}
#endif
static void __init xtfpga_register_handlers(void)
{
register_sys_off_handler(SYS_OFF_MODE_RESTART,
SYS_OFF_PRIO_PLATFORM,
xtfpga_restart, NULL);
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
SYS_OFF_PRIO_DEFAULT,
xtfpga_power_off, NULL);
}
#ifdef CONFIG_USE_OF
static void __init xtfpga_clk_setup(struct device_node *np)
{
void __iomem *base = of_iomap(np, 0);
struct clk *clk;
u32 freq;
if (!base) {
pr_err("%pOFn: invalid address\n", np);
return;
}
freq = __raw_readl(base);
Annotation
- Immediate include surface: `linux/stddef.h`, `linux/kernel.h`, `linux/init.h`, `linux/io.h`, `linux/errno.h`, `linux/reboot.h`, `linux/kdev_t.h`, `linux/types.h`.
- Detected declarations: `function xtfpga_power_off`, `function xtfpga_restart`, `function platform_calibrate_ccount`, `function xtfpga_register_handlers`, `function xtfpga_clk_setup`, `function update_local_mac`, `function machine_setup`, `function xtavnet_init`.
- Atlas domain: Architecture Layer / arch/xtensa.
- 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.