aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2014-09-30 13:48:35 -0400
committerSebastian Reichel <sre@kernel.org>2014-11-16 21:07:10 -0500
commit6724534c79ead70e310616d0e4380bb9fbb67c15 (patch)
tree34f375b2d645dad9b704249ea2350bdc77e700f8
parentf59a42d4e177564b9892112af7a4e73d0c91f9b4 (diff)
power/reset: hisi: Register with kernel restart handler
Register with kernel restart handler instead of setting arm_pm_restart directly. Cc: Haojian Zhuang <haojian.zhuang@linaro.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/power/reset/hisi-reboot.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c
index 0c91d0231d36..5385460e23bb 100644
--- a/drivers/power/reset/hisi-reboot.c
+++ b/drivers/power/reset/hisi-reboot.c
@@ -14,27 +14,36 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/notifier.h>
17#include <linux/of_address.h> 18#include <linux/of_address.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/reboot.h> 20#include <linux/reboot.h>
20 21
21#include <asm/proc-fns.h> 22#include <asm/proc-fns.h>
22#include <asm/system_misc.h>
23 23
24static void __iomem *base; 24static void __iomem *base;
25static u32 reboot_offset; 25static u32 reboot_offset;
26 26
27static void hisi_restart(enum reboot_mode mode, const char *cmd) 27static int hisi_restart_handler(struct notifier_block *this,
28 unsigned long mode, void *cmd)
28{ 29{
29 writel_relaxed(0xdeadbeef, base + reboot_offset); 30 writel_relaxed(0xdeadbeef, base + reboot_offset);
30 31
31 while (1) 32 while (1)
32 cpu_do_idle(); 33 cpu_do_idle();
34
35 return NOTIFY_DONE;
33} 36}
34 37
38static struct notifier_block hisi_restart_nb = {
39 .notifier_call = hisi_restart_handler,
40 .priority = 128,
41};
42
35static int hisi_reboot_probe(struct platform_device *pdev) 43static int hisi_reboot_probe(struct platform_device *pdev)
36{ 44{
37 struct device_node *np = pdev->dev.of_node; 45 struct device_node *np = pdev->dev.of_node;
46 int err;
38 47
39 base = of_iomap(np, 0); 48 base = of_iomap(np, 0);
40 if (!base) { 49 if (!base) {
@@ -47,9 +56,12 @@ static int hisi_reboot_probe(struct platform_device *pdev)
47 return -EINVAL; 56 return -EINVAL;
48 } 57 }
49 58
50 arm_pm_restart = hisi_restart; 59 err = register_restart_handler(&hisi_restart_nb);
60 if (err)
61 dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n",
62 err);
51 63
52 return 0; 64 return err;
53} 65}
54 66
55static struct of_device_id hisi_reboot_of_match[] = { 67static struct of_device_id hisi_reboot_of_match[] = {