Merge branch 'topic/hda-probe-defer' into for-next
[linux-drm-fsl-dcu.git] / arch / mips / loongson1 / common / reset.c
1 /*
2  * Copyright (c) 2011 Zhang, Keguang <keguang.zhang@gmail.com>
3  *
4  * This program is free software; you can redistribute  it and/or modify it
5  * under  the terms of  the GNU General  Public License as published by the
6  * Free Software Foundation;  either version 2 of the  License, or (at your
7  * option) any later version.
8  */
9
10 #include <linux/io.h>
11 #include <linux/pm.h>
12 #include <asm/reboot.h>
13
14 #include <loongson1.h>
15
16 static void ls1x_restart(char *command)
17 {
18         __raw_writel(0x1, LS1X_WDT_EN);
19         __raw_writel(0x5000000, LS1X_WDT_TIMER);
20         __raw_writel(0x1, LS1X_WDT_SET);
21 }
22
23 static void ls1x_halt(void)
24 {
25         while (1) {
26                 if (cpu_wait)
27                         cpu_wait();
28         }
29 }
30
31 static void ls1x_power_off(void)
32 {
33         ls1x_halt();
34 }
35
36 static int __init ls1x_reboot_setup(void)
37 {
38         _machine_restart = ls1x_restart;
39         _machine_halt = ls1x_halt;
40         pm_power_off = ls1x_power_off;
41
42         return 0;
43 }
44
45 arch_initcall(ls1x_reboot_setup);