mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
MIPS: Loongson64: reset: Prioritise firmware service
We should always use firmware's poweroff & reboot service if it's available as firmware may need to perform more task than platform's syscon etc. However _machine_restart & poweroff hooks are registered at low priority, which means platform reboot driver can override them. Register firmware based reboot/poweroff implementation with register_sys_off_handler with appropriate priority so that they will be prioritised. Remove _machine_halt hook as it's deemed to be unnecessary. Cc: stable@vger.kernel.org Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
This commit is contained in:
parent
f4d430db17
commit
4e7ca0b57f
@ -11,6 +11,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <asm/bootinfo.h>
|
||||
@ -21,36 +22,21 @@
|
||||
#include <loongson.h>
|
||||
#include <boot_param.h>
|
||||
|
||||
static void loongson_restart(char *command)
|
||||
static int firmware_restart(struct sys_off_data *unusedd)
|
||||
{
|
||||
|
||||
void (*fw_restart)(void) = (void *)loongson_sysconf.restart_addr;
|
||||
|
||||
fw_restart();
|
||||
while (1) {
|
||||
if (cpu_wait)
|
||||
cpu_wait();
|
||||
}
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static void loongson_poweroff(void)
|
||||
static int firmware_poweroff(struct sys_off_data *unused)
|
||||
{
|
||||
void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr;
|
||||
|
||||
fw_poweroff();
|
||||
while (1) {
|
||||
if (cpu_wait)
|
||||
cpu_wait();
|
||||
}
|
||||
}
|
||||
|
||||
static void loongson_halt(void)
|
||||
{
|
||||
pr_notice("\n\n** You can safely turn off the power now **\n\n");
|
||||
while (1) {
|
||||
if (cpu_wait)
|
||||
cpu_wait();
|
||||
}
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
@ -154,9 +140,17 @@ static void loongson_crash_shutdown(struct pt_regs *regs)
|
||||
|
||||
static int __init mips_reboot_setup(void)
|
||||
{
|
||||
_machine_restart = loongson_restart;
|
||||
_machine_halt = loongson_halt;
|
||||
pm_power_off = loongson_poweroff;
|
||||
if (loongson_sysconf.restart_addr) {
|
||||
register_sys_off_handler(SYS_OFF_MODE_RESTART,
|
||||
SYS_OFF_PRIO_FIRMWARE,
|
||||
firmware_restart, NULL);
|
||||
}
|
||||
|
||||
if (loongson_sysconf.poweroff_addr) {
|
||||
register_sys_off_handler(SYS_OFF_MODE_POWER_OFF,
|
||||
SYS_OFF_PRIO_FIRMWARE,
|
||||
firmware_poweroff, NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_KEXEC_CORE
|
||||
kexec_argv = kmalloc(KEXEC_ARGV_SIZE, GFP_KERNEL);
|
||||
|
Loading…
Reference in New Issue
Block a user