arch/mips/loongson2ef/lemote-2f/reset.c
Source file repositories/reference/linux-study-clean/arch/mips/loongson2ef/lemote-2f/reset.c
File Facts
- System
- Linux kernel
- Corpus path
arch/mips/loongson2ef/lemote-2f/reset.c- Extension
.c- Size
- 3370 bytes
- Lines
- 156
- 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.
Dependency Surface
linux/io.hlinux/delay.hlinux/types.hasm/bootinfo.hloongson.hcs5536/cs5536.hec_kb3310b.h
Detected Declarations
function Copyrightfunction fl2f_rebootfunction fl2f_shutdownfunction ml2f_rebootfunction ml2f_shutdownfunction yl2f89_shutdownfunction mach_prepare_rebootfunction mach_prepare_shutdown
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/* Board-specific reboot/shutdown routines
*
* Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca>
*
* Copyright (C) 2009 Lemote Inc.
* Author: Wu Zhangjin, wuzhangjin@gmail.com
*/
#include <linux/io.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <asm/bootinfo.h>
#include <loongson.h>
#include <cs5536/cs5536.h>
#include "ec_kb3310b.h"
static void reset_cpu(void)
{
/*
* reset cpu to full speed, this is needed when enabling cpu frequency
* scalling
*/
writel(readl(LOONGSON_CHIPCFG) | 0x7, LOONGSON_CHIPCFG);
}
/* reset support for fuloong2f */
static void fl2f_reboot(void)
{
reset_cpu();
/* send a reset signal to south bridge.
*
* NOTE: if enable "Power Management" in kernel, rtl8169 will not reset
* normally with this reset operation and it will not work in PMON, but
* you can type halt command and then reboot, seems the hardware reset
* logic not work normally.
*/
{
u32 hi, lo;
_rdmsr(DIVIL_MSR_REG(DIVIL_SOFT_RESET), &hi, &lo);
lo |= 0x00000001;
_wrmsr(DIVIL_MSR_REG(DIVIL_SOFT_RESET), hi, lo);
}
}
static void fl2f_shutdown(void)
{
u32 hi, lo, val;
int gpio_base;
/* get gpio base */
_rdmsr(DIVIL_MSR_REG(DIVIL_LBAR_GPIO), &hi, &lo);
gpio_base = lo & 0xff00;
/* make cs5536 gpio13 output enable */
val = inl(gpio_base + GPIOL_OUT_EN);
val &= ~(1 << (16 + 13));
val |= (1 << 13);
outl(val, gpio_base + GPIOL_OUT_EN);
mmiowb();
/* make cs5536 gpio13 output low level voltage. */
val = inl(gpio_base + GPIOL_OUT_VAL) & ~(1 << (13));
val |= (1 << (16 + 13));
outl(val, gpio_base + GPIOL_OUT_VAL);
mmiowb();
}
/* reset support for yeeloong2f and mengloong2f notebook */
static void ml2f_reboot(void)
{
reset_cpu();
/* sending an reset signal to EC(embedded controller) */
ec_write(REG_RESET, BIT_RESET_ON);
}
#define yl2f89_reboot ml2f_reboot
/* menglong(7inches) laptop has different shutdown logic from 8.9inches */
#define EC_SHUTDOWN_IO_PORT_HIGH 0xff2d
#define EC_SHUTDOWN_IO_PORT_LOW 0xff2e
#define EC_SHUTDOWN_IO_PORT_DATA 0xff2f
#define REG_SHUTDOWN_HIGH 0xFC
#define REG_SHUTDOWN_LOW 0x29
Annotation
- Immediate include surface: `linux/io.h`, `linux/delay.h`, `linux/types.h`, `asm/bootinfo.h`, `loongson.h`, `cs5536/cs5536.h`, `ec_kb3310b.h`.
- Detected declarations: `function Copyright`, `function fl2f_reboot`, `function fl2f_shutdown`, `function ml2f_reboot`, `function ml2f_shutdown`, `function yl2f89_shutdown`, `function mach_prepare_reboot`, `function mach_prepare_shutdown`.
- 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.