2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
7 * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology
8 * Author: Fuxin Zhang, zhangfx@lemote.com
9 * Copyright (C) 2009 Lemote, Inc.
10 * Author: Zhangjin Wu, wuzhangjin@gmail.com
12 #include <linux/init.h>
16 #include <asm/reboot.h>
19 #include <boot_param.h>
21 static inline void loongson_reboot(void)
23 #ifndef CONFIG_CPU_JUMP_WORKAROUNDS
24 ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE
, 4)) ();
28 func
= (void *)ioremap_nocache(LOONGSON_BOOT_BASE
, 4);
39 static void loongson_restart(char *command
)
41 #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE
42 /* do preparation for reboot */
43 mach_prepare_reboot();
45 /* reboot via jumping to boot base address */
48 void (*fw_restart
)(void) = (void *)loongson_sysconf
.restart_addr
;
58 static void loongson_poweroff(void)
60 #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE
61 mach_prepare_shutdown();
64 void (*fw_poweroff
)(void) = (void *)loongson_sysconf
.poweroff_addr
;
74 static void loongson_halt(void)
76 pr_notice("\n\n** You can safely turn off the power now **\n\n");
83 static int __init
mips_reboot_setup(void)
85 _machine_restart
= loongson_restart
;
86 _machine_halt
= loongson_halt
;
87 pm_power_off
= loongson_poweroff
;
92 arch_initcall(mips_reboot_setup
);