Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 1 | /* |
| 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. |
| 6 | * |
| 7 | * Copyright (C) 2007 Lemote, Inc. & Institute of Computing Technology |
| 8 | * Author: Fuxin Zhang, zhangfx@lemote.com |
Wu Zhangjin | 6f32096 | 2010-01-04 17:16:45 +0800 | [diff] [blame] | 9 | * Copyright (C) 2009 Lemote, Inc. |
Wu Zhangjin | f7a904d | 2010-01-04 17:16:51 +0800 | [diff] [blame^] | 10 | * Author: Zhangjin Wu, wuzhangjin@gmail.com |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 11 | */ |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/pm.h> |
| 14 | |
| 15 | #include <asm/reboot.h> |
| 16 | |
| 17 | #include <loongson.h> |
| 18 | |
| 19 | static void loongson_restart(char *command) |
| 20 | { |
| 21 | /* do preparation for reboot */ |
| 22 | mach_prepare_reboot(); |
| 23 | |
| 24 | /* reboot via jumping to boot base address */ |
Wu Zhangjin | e2fee57 | 2009-10-16 14:17:19 +0800 | [diff] [blame] | 25 | ((void (*)(void))ioremap_nocache(LOONGSON_BOOT_BASE, 4)) (); |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | static void loongson_halt(void) |
| 29 | { |
| 30 | mach_prepare_shutdown(); |
Wu Zhangjin | 6f32096 | 2010-01-04 17:16:45 +0800 | [diff] [blame] | 31 | unreachable(); |
Wu Zhangjin | 85749d2 | 2009-07-02 23:26:45 +0800 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | static int __init mips_reboot_setup(void) |
| 35 | { |
| 36 | _machine_restart = loongson_restart; |
| 37 | _machine_halt = loongson_halt; |
| 38 | pm_power_off = loongson_halt; |
| 39 | |
| 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | arch_initcall(mips_reboot_setup); |