Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved. |
| 7 | */ |
| 8 | #include <linux/io.h> |
| 9 | #include <linux/pm.h> |
| 10 | |
| 11 | #include <asm/reboot.h> |
Steven J. Hill | 2ddbc4e | 2013-06-13 19:55:04 +0000 | [diff] [blame] | 12 | |
| 13 | #define SOFTRES_REG 0x1f000050 |
| 14 | #define GORESET 0x4d |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 15 | |
| 16 | static void mips_machine_restart(char *command) |
| 17 | { |
| 18 | unsigned int __iomem *softres_reg = |
| 19 | ioremap(SOFTRES_REG, sizeof(unsigned int)); |
| 20 | |
| 21 | __raw_writel(GORESET, softres_reg); |
| 22 | } |
| 23 | |
| 24 | static void mips_machine_halt(void) |
| 25 | { |
| 26 | unsigned int __iomem *softres_reg = |
| 27 | ioremap(SOFTRES_REG, sizeof(unsigned int)); |
| 28 | |
| 29 | __raw_writel(GORESET, softres_reg); |
| 30 | } |
| 31 | |
| 32 | static int __init mips_reboot_setup(void) |
| 33 | { |
| 34 | _machine_restart = mips_machine_restart; |
| 35 | _machine_halt = mips_machine_halt; |
| 36 | pm_power_off = mips_machine_halt; |
| 37 | |
| 38 | return 0; |
| 39 | } |
Steven J. Hill | 3070033 | 2012-05-30 21:02:49 +0000 | [diff] [blame] | 40 | arch_initcall(mips_reboot_setup); |