sh: machine_ops based reboot support.

This provides a machine_ops-based reboot interface loosely cloned from
x86, and converts the native sh32 and sh64 cases over to it.

Necessary both for tying in SMP support and also enabling platforms like
SDK7786 to add support for their microcontroller-based power managers.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
This commit is contained in:
Paul Mundt
2010-01-20 16:42:52 +09:00
parent 2efa53b269
commit fbb82b0365
11 changed files with 156 additions and 90 deletions

View File

@ -16,63 +16,15 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/elfcore.h>
#include <linux/pm.h>
#include <linux/kallsyms.h>
#include <linux/kexec.h>
#include <linux/kdebug.h>
#include <linux/tick.h>
#include <linux/reboot.h>
#include <linux/fs.h>
#include <linux/ftrace.h>
#include <linux/preempt.h>
#include <linux/hw_breakpoint.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <asm/pgalloc.h>
#include <asm/system.h>
#include <asm/fpu.h>
#include <asm/syscalls.h>
#include <asm/watchdog.h>
#ifdef CONFIG_32BIT
static void watchdog_trigger_immediate(void)
{
sh_wdt_write_cnt(0xFF);
sh_wdt_write_csr(0xC2);
}
void machine_restart(char * __unused)
{
local_irq_disable();
/* Use watchdog timer to trigger reset */
watchdog_trigger_immediate();
while (1)
cpu_sleep();
}
#else
void machine_restart(char * __unused)
{
/* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
asm volatile("ldc %0, sr\n\t"
"mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
}
#endif
void machine_halt(void)
{
local_irq_disable();
while (1)
cpu_sleep();
}
void machine_power_off(void)
{
if (pm_power_off)
pm_power_off();
}
void show_regs(struct pt_regs * regs)
{