diff options
author | Guenter Roeck <linux@roeck-us.net> | 2014-09-30 13:48:35 -0400 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2014-11-16 21:07:10 -0500 |
commit | 6724534c79ead70e310616d0e4380bb9fbb67c15 (patch) | |
tree | 34f375b2d645dad9b704249ea2350bdc77e700f8 | |
parent | f59a42d4e177564b9892112af7a4e73d0c91f9b4 (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.c | 20 |
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 | ||
24 | static void __iomem *base; | 24 | static void __iomem *base; |
25 | static u32 reboot_offset; | 25 | static u32 reboot_offset; |
26 | 26 | ||
27 | static void hisi_restart(enum reboot_mode mode, const char *cmd) | 27 | static 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 | ||
38 | static struct notifier_block hisi_restart_nb = { | ||
39 | .notifier_call = hisi_restart_handler, | ||
40 | .priority = 128, | ||
41 | }; | ||
42 | |||
35 | static int hisi_reboot_probe(struct platform_device *pdev) | 43 | static 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 | ||
55 | static struct of_device_id hisi_reboot_of_match[] = { | 67 | static struct of_device_id hisi_reboot_of_match[] = { |