aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2015-01-25 15:30:43 -0500
committerSebastian Reichel <sre@kernel.org>2015-01-25 16:13:16 -0500
commit453fe4f11c2ac18b654db13daeaa71409ef142e0 (patch)
tree45bcee41954aca628fd317f10469545d7025ed21
parentb2b3a8b934e649d0f0659584f2186602dbb391b5 (diff)
power/reset: st-poweroff: Register with kernel restart handler
Register with kernel restart handler instead of setting arm_pm_restart directly. Select high priority since the restart handler is instantiated through devicetree, indicating that it should be used if configured. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r--drivers/power/reset/st-poweroff.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/power/reset/st-poweroff.c b/drivers/power/reset/st-poweroff.c
index a0acf25ee2a2..27383de9caa8 100644
--- a/drivers/power/reset/st-poweroff.c
+++ b/drivers/power/reset/st-poweroff.c
@@ -15,10 +15,9 @@
15#include <linux/of_platform.h> 15#include <linux/of_platform.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mfd/syscon.h> 17#include <linux/mfd/syscon.h>
18#include <linux/reboot.h>
18#include <linux/regmap.h> 19#include <linux/regmap.h>
19 20
20#include <asm/system_misc.h>
21
22struct reset_syscfg { 21struct reset_syscfg {
23 struct regmap *regmap; 22 struct regmap *regmap;
24 /* syscfg used for reset */ 23 /* syscfg used for reset */
@@ -75,7 +74,8 @@ static struct reset_syscfg stid127_reset = {
75 74
76static struct reset_syscfg *st_restart_syscfg; 75static struct reset_syscfg *st_restart_syscfg;
77 76
78static void st_restart(enum reboot_mode reboot_mode, const char *cmd) 77static int st_restart(struct notifier_block *this, unsigned long mode,
78 void *cmd)
79{ 79{
80 /* reset syscfg updated */ 80 /* reset syscfg updated */
81 regmap_update_bits(st_restart_syscfg->regmap, 81 regmap_update_bits(st_restart_syscfg->regmap,
@@ -88,8 +88,15 @@ static void st_restart(enum reboot_mode reboot_mode, const char *cmd)
88 st_restart_syscfg->offset_rst_msk, 88 st_restart_syscfg->offset_rst_msk,
89 st_restart_syscfg->mask_rst_msk, 89 st_restart_syscfg->mask_rst_msk,
90 0); 90 0);
91
92 return NOTIFY_DONE;
91} 93}
92 94
95static struct notifier_block st_restart_nb = {
96 .notifier_call = st_restart,
97 .priority = 192,
98};
99
93static struct of_device_id st_reset_of_match[] = { 100static struct of_device_id st_reset_of_match[] = {
94 { 101 {
95 .compatible = "st,stih415-restart", 102 .compatible = "st,stih415-restart",
@@ -126,9 +133,7 @@ static int st_reset_probe(struct platform_device *pdev)
126 return PTR_ERR(st_restart_syscfg->regmap); 133 return PTR_ERR(st_restart_syscfg->regmap);
127 } 134 }
128 135
129 arm_pm_restart = st_restart; 136 return register_restart_handler(&st_restart_nb);
130
131 return 0;
132} 137}
133 138
134static struct platform_driver st_reset_driver = { 139static struct platform_driver st_reset_driver = {