arch/mips/alchemy/board-mtx1.c
Source file repositories/reference/linux-study-clean/arch/mips/alchemy/board-mtx1.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/alchemy/board-mtx1.c- Extension
.c- Size
- 8899 bytes
- Lines
- 345
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/interrupt.hlinux/kernel.hlinux/platform_device.hlinux/property.hlinux/gpio/machine.hlinux/gpio/property.hlinux/input.hlinux/mtd/partitions.hlinux/mtd/physmap.hmtd/mtd-abi.hasm/bootinfo.hasm/reboot.hasm/setup.hasm/mach-au1x00/au1000.hasm/mach-au1x00/gpio-au1000.hasm/mach-au1x00/au1xxx_eth.hprom.h
Detected Declarations
function Copyrightfunction prom_putcharfunction mtx1_resetfunction mtx1_power_offfunction board_setupfunction mtx1_keys_initfunction mtx1_wdt_initfunction mtx1_leds_initfunction mtx1_pci_idselfunction mtx1_map_pci_irqfunction mtx1_register_devices
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* MTX-1 platform devices registration (Au1500)
*
* Copyright (C) 2007-2009, Florian Fainelli <florian@openwrt.org>
*/
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/gpio/machine.h>
#include <linux/gpio/property.h>
#include <linux/input.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h>
#include <mtd/mtd-abi.h>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/setup.h>
#include <asm/mach-au1x00/au1000.h>
#include <asm/mach-au1x00/gpio-au1000.h>
#include <asm/mach-au1x00/au1xxx_eth.h>
#include <prom.h>
const char *get_system_type(void)
{
return "MTX-1";
}
void prom_putchar(char c)
{
alchemy_uart_putchar(AU1000_UART0_PHYS_ADDR, c);
}
static void mtx1_reset(char *c)
{
/* Jump to the reset vector */
__asm__ __volatile__("jr\t%0" : : "r"(0xbfc00000));
}
static void mtx1_power_off(void)
{
while (1)
asm volatile (
" .set mips32 \n"
" wait \n"
" .set mips0 \n");
}
void __init board_setup(void)
{
#if IS_ENABLED(CONFIG_USB_OHCI_HCD)
/* Enable USB power switch */
alchemy_gpio_direction_output(204, 0);
#endif /* IS_ENABLED(CONFIG_USB_OHCI_HCD) */
/* Initialize sys_pinfunc */
alchemy_wrsys(SYS_PF_NI2, AU1000_SYS_PINFUNC);
/* Initialize GPIO */
alchemy_wrsys(~0, AU1000_SYS_TRIOUTCLR);
alchemy_gpio_direction_output(0, 0); /* Disable M66EN (PCI 66MHz) */
alchemy_gpio_direction_output(3, 1); /* Disable PCI CLKRUN# */
alchemy_gpio_direction_output(1, 1); /* Enable EXT_IO3 */
alchemy_gpio_direction_output(5, 0); /* Disable eth PHY TX_ER */
/* Enable LED and set it to green */
alchemy_gpio_direction_output(211, 1); /* green on */
alchemy_gpio_direction_output(212, 0); /* red off */
pm_power_off = mtx1_power_off;
_machine_halt = mtx1_power_off;
_machine_restart = mtx1_reset;
printk(KERN_INFO "4G Systems MTX-1 Board\n");
}
/******************************************************************************/
static const struct software_node mtx1_gpio_keys_node = {
.name = "mtx1-gpio-keys",
};
static const struct property_entry mtx1_button_props[] = {
PROPERTY_ENTRY_U32("linux,code", BTN_0),
PROPERTY_ENTRY_GPIO("gpios", &alchemy_gpio2_node, 7, GPIO_ACTIVE_HIGH),
PROPERTY_ENTRY_STRING("label", "System button"),
{ }
Annotation
- Immediate include surface: `linux/init.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/platform_device.h`, `linux/property.h`, `linux/gpio/machine.h`, `linux/gpio/property.h`, `linux/input.h`.
- Detected declarations: `function Copyright`, `function prom_putchar`, `function mtx1_reset`, `function mtx1_power_off`, `function board_setup`, `function mtx1_keys_init`, `function mtx1_wdt_init`, `function mtx1_leds_init`, `function mtx1_pci_idsel`, `function mtx1_map_pci_irq`.
- Atlas domain: Architecture Layer / arch/mips.
- 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.