blob: d627d4b2b47f4f456addef452e77c16513238bd7 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
Steven J. Hillb72d9a42013-06-13 19:55:06 +00002 * 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 *
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 * Carsten Langgaard, carstenl@mips.com
7 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
Linus Torvalds1da177e2005-04-16 15:20:36 -07008 */
Steven J. Hillb72d9a42013-06-13 19:55:06 +00009#include <linux/io.h>
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000010#include <linux/pm.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/reboot.h>
Steven J. Hill36a29af2013-06-13 19:55:05 +000013
14#define SOFTRES_REG 0x1f000500
15#define GORESET 0x42
Linus Torvalds1da177e2005-04-16 15:20:36 -070016
Linus Torvalds1da177e2005-04-16 15:20:36 -070017static void mips_machine_restart(char *command)
18{
Dmitri Vorobiev84c21e22008-01-08 06:44:00 +030019 unsigned int __iomem *softres_reg =
20 ioremap(SOFTRES_REG, sizeof(unsigned int));
Linus Torvalds1da177e2005-04-16 15:20:36 -070021
Dmitri Vorobiev84c21e22008-01-08 06:44:00 +030022 __raw_writel(GORESET, softres_reg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070023}
24
25static void mips_machine_halt(void)
26{
Dmitri Vorobiev84c21e22008-01-08 06:44:00 +030027 unsigned int __iomem *softres_reg =
28 ioremap(SOFTRES_REG, sizeof(unsigned int));
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Dmitri Vorobiev84c21e22008-01-08 06:44:00 +030030 __raw_writel(GORESET, softres_reg);
Linus Torvalds1da177e2005-04-16 15:20:36 -070031}
32
Ralf Baechle1f320d02009-09-15 14:50:39 +020033static int __init mips_reboot_setup(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070034{
35 _machine_restart = mips_machine_restart;
36 _machine_halt = mips_machine_halt;
Ralf Baechlefcdb27a2006-01-18 17:37:07 +000037 pm_power_off = mips_machine_halt;
Ralf Baechle1f320d02009-09-15 14:50:39 +020038
39 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -070040}
Ralf Baechle1f320d02009-09-15 14:50:39 +020041arch_initcall(mips_reboot_setup);