Path: blob/master/arch/mips/loongson/common/reset.c
10818 views
/*1* This program is free software; you can redistribute it and/or modify it2* under the terms of the GNU General Public License as published by the3* Free Software Foundation; either version 2 of the License, or (at your4* option) any later version.5*6* Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology7* Author: Fuxin Zhang, [email protected]8* Copyright (C) 2009 Lemote, Inc.9* Author: Zhangjin Wu, [email protected]10*/11#include <linux/init.h>12#include <linux/pm.h>1314#include <asm/reboot.h>1516#include <loongson.h>1718static inline void loongson_reboot(void)19{20#ifndef CONFIG_CPU_JUMP_WORKAROUNDS21((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) ();22#else23void (*func)(void);2425func = (void *)ioremap_nocache(LOONGSON_BOOT_BASE, 4);2627__asm__ __volatile__(28" .set noat \n"29" jr %[func] \n"30" .set at \n"31: /* No outputs */32: [func] "r" (func));33#endif34}3536static void loongson_restart(char *command)37{38/* do preparation for reboot */39mach_prepare_reboot();4041/* reboot via jumping to boot base address */42loongson_reboot();43}4445static void loongson_poweroff(void)46{47mach_prepare_shutdown();48unreachable();49}5051static void loongson_halt(void)52{53pr_notice("\n\n** You can safely turn off the power now **\n\n");54while (1) {55if (cpu_wait)56cpu_wait();57}58}5960static int __init mips_reboot_setup(void)61{62_machine_restart = loongson_restart;63_machine_halt = loongson_halt;64pm_power_off = loongson_poweroff;6566return 0;67}6869arch_initcall(mips_reboot_setup);707172