diff options
| author | Guenter Roeck <linux@roeck-us.net> | 2014-09-30 13:48:34 -0400 |
|---|---|---|
| committer | Sebastian Reichel <sre@kernel.org> | 2014-11-16 21:07:10 -0500 |
| commit | f59a42d4e177564b9892112af7a4e73d0c91f9b4 (patch) | |
| tree | a89118ebc730e4a4b053d2de76dee1a563eefa18 | |
| parent | fcf01c51f0f5565a184638b7d055e590aad6c0f8 (diff) | |
power/reset: keystone: Register with kernel restart handler
Register with kernel restart handler instead of setting arm_pm_restart directly.
Move notifier registration to the end of the probe function to avoid having to
implement error handling.
Cc: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Tested-by: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
| -rw-r--r-- | drivers/power/reset/keystone-reset.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/power/reset/keystone-reset.c b/drivers/power/reset/keystone-reset.c index 408a18fd91cb..4b6b12e74477 100644 --- a/drivers/power/reset/keystone-reset.c +++ b/drivers/power/reset/keystone-reset.c | |||
| @@ -12,9 +12,9 @@ | |||
| 12 | 12 | ||
| 13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
| 14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
| 15 | #include <linux/notifier.h> | ||
| 15 | #include <linux/reboot.h> | 16 | #include <linux/reboot.h> |
| 16 | #include <linux/regmap.h> | 17 | #include <linux/regmap.h> |
| 17 | #include <asm/system_misc.h> | ||
| 18 | #include <linux/mfd/syscon.h> | 18 | #include <linux/mfd/syscon.h> |
| 19 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
| 20 | 20 | ||
| @@ -52,7 +52,8 @@ static inline int rsctrl_enable_rspll_write(void) | |||
| 52 | RSCTRL_KEY_MASK, RSCTRL_KEY); | 52 | RSCTRL_KEY_MASK, RSCTRL_KEY); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static void rsctrl_restart(enum reboot_mode mode, const char *cmd) | 55 | static int rsctrl_restart_handler(struct notifier_block *this, |
| 56 | unsigned long mode, void *cmd) | ||
| 56 | { | 57 | { |
| 57 | /* enable write access to RSTCTRL */ | 58 | /* enable write access to RSTCTRL */ |
| 58 | rsctrl_enable_rspll_write(); | 59 | rsctrl_enable_rspll_write(); |
| @@ -60,8 +61,15 @@ static void rsctrl_restart(enum reboot_mode mode, const char *cmd) | |||
| 60 | /* reset the SOC */ | 61 | /* reset the SOC */ |
| 61 | regmap_update_bits(pllctrl_regs, rspll_offset + RSCTRL_RG, | 62 | regmap_update_bits(pllctrl_regs, rspll_offset + RSCTRL_RG, |
| 62 | RSCTRL_RESET_MASK, 0); | 63 | RSCTRL_RESET_MASK, 0); |
| 64 | |||
| 65 | return NOTIFY_DONE; | ||
| 63 | } | 66 | } |
| 64 | 67 | ||
| 68 | static struct notifier_block rsctrl_restart_nb = { | ||
| 69 | .notifier_call = rsctrl_restart_handler, | ||
| 70 | .priority = 128, | ||
| 71 | }; | ||
| 72 | |||
| 65 | static struct of_device_id rsctrl_of_match[] = { | 73 | static struct of_device_id rsctrl_of_match[] = { |
| 66 | {.compatible = "ti,keystone-reset", }, | 74 | {.compatible = "ti,keystone-reset", }, |
| 67 | {}, | 75 | {}, |
| @@ -114,8 +122,6 @@ static int rsctrl_probe(struct platform_device *pdev) | |||
| 114 | if (ret) | 122 | if (ret) |
| 115 | return ret; | 123 | return ret; |
| 116 | 124 | ||
| 117 | arm_pm_restart = rsctrl_restart; | ||
| 118 | |||
| 119 | /* disable a reset isolation for all module clocks */ | 125 | /* disable a reset isolation for all module clocks */ |
| 120 | ret = regmap_write(pllctrl_regs, rspll_offset + RSISO_RG, 0); | 126 | ret = regmap_write(pllctrl_regs, rspll_offset + RSISO_RG, 0); |
| 121 | if (ret) | 127 | if (ret) |
| @@ -147,7 +153,11 @@ static int rsctrl_probe(struct platform_device *pdev) | |||
| 147 | return ret; | 153 | return ret; |
| 148 | } | 154 | } |
| 149 | 155 | ||
| 150 | return 0; | 156 | ret = register_restart_handler(&rsctrl_restart_nb); |
| 157 | if (ret) | ||
| 158 | dev_err(dev, "cannot register restart handler (err=%d)\n", ret); | ||
| 159 | |||
| 160 | return ret; | ||
| 151 | } | 161 | } |
| 152 | 162 | ||
| 153 | static struct platform_driver rsctrl_driver = { | 163 | static struct platform_driver rsctrl_driver = { |
