diff options
author | Guenter Roeck <linux@roeck-us.net> | 2015-01-25 15:30:41 -0500 |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-01-25 16:12:45 -0500 |
commit | 481ff6ff967fefdbfb967f7251e40c22a312d244 (patch) | |
tree | a68b3b9896354c10f535f101d23f51d79ecce626 | |
parent | 25a5b57dd76fbcbcb4107aa95400862cb924470d (diff) |
power/reset: at91: Register with kernel restart handler
Register with kernel restart handler instead of setting arm_pm_restart
directly. Register with high priority since the driver unconditionally
overwrites other restart handlers if instantiated.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
-rw-r--r-- | drivers/power/reset/at91-reset.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/power/reset/at91-reset.c b/drivers/power/reset/at91-reset.c index 69a75d99ae92..13584e24736a 100644 --- a/drivers/power/reset/at91-reset.c +++ b/drivers/power/reset/at91-reset.c | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
18 | #include <linux/reboot.h> | 18 | #include <linux/reboot.h> |
19 | 19 | ||
20 | #include <asm/system_misc.h> | ||
21 | |||
22 | #include <soc/at91/at91sam9_ddrsdr.h> | 20 | #include <soc/at91/at91sam9_ddrsdr.h> |
23 | #include <soc/at91/at91sam9_sdramc.h> | 21 | #include <soc/at91/at91sam9_sdramc.h> |
24 | 22 | ||
@@ -54,7 +52,8 @@ static void __iomem *at91_ramc_base[2], *at91_rstc_base; | |||
54 | * reset register it can be left driving the data bus and | 52 | * reset register it can be left driving the data bus and |
55 | * killing the chance of a subsequent boot from NAND | 53 | * killing the chance of a subsequent boot from NAND |
56 | */ | 54 | */ |
57 | static void at91sam9260_restart(enum reboot_mode mode, const char *cmd) | 55 | static int at91sam9260_restart(struct notifier_block *this, unsigned long mode, |
56 | void *cmd) | ||
58 | { | 57 | { |
59 | asm volatile( | 58 | asm volatile( |
60 | /* Align to cache lines */ | 59 | /* Align to cache lines */ |
@@ -76,9 +75,12 @@ static void at91sam9260_restart(enum reboot_mode mode, const char *cmd) | |||
76 | "r" (1), | 75 | "r" (1), |
77 | "r" (AT91_SDRAMC_LPCB_POWER_DOWN), | 76 | "r" (AT91_SDRAMC_LPCB_POWER_DOWN), |
78 | "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)); | 77 | "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST)); |
78 | |||
79 | return NOTIFY_DONE; | ||
79 | } | 80 | } |
80 | 81 | ||
81 | static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd) | 82 | static int at91sam9g45_restart(struct notifier_block *this, unsigned long mode, |
83 | void *cmd) | ||
82 | { | 84 | { |
83 | asm volatile( | 85 | asm volatile( |
84 | /* | 86 | /* |
@@ -117,6 +119,8 @@ static void at91sam9g45_restart(enum reboot_mode mode, const char *cmd) | |||
117 | "r" (AT91_DDRSDRC_LPCB_POWER_DOWN), | 119 | "r" (AT91_DDRSDRC_LPCB_POWER_DOWN), |
118 | "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST) | 120 | "r" (AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST) |
119 | : "r0"); | 121 | : "r0"); |
122 | |||
123 | return NOTIFY_DONE; | ||
120 | } | 124 | } |
121 | 125 | ||
122 | static void __init at91_reset_status(struct platform_device *pdev) | 126 | static void __init at91_reset_status(struct platform_device *pdev) |
@@ -161,6 +165,10 @@ static struct of_device_id at91_reset_of_match[] = { | |||
161 | { /* sentinel */ } | 165 | { /* sentinel */ } |
162 | }; | 166 | }; |
163 | 167 | ||
168 | static struct notifier_block at91_restart_nb = { | ||
169 | .priority = 192, | ||
170 | }; | ||
171 | |||
164 | static int at91_reset_of_probe(struct platform_device *pdev) | 172 | static int at91_reset_of_probe(struct platform_device *pdev) |
165 | { | 173 | { |
166 | const struct of_device_id *match; | 174 | const struct of_device_id *match; |
@@ -183,9 +191,8 @@ static int at91_reset_of_probe(struct platform_device *pdev) | |||
183 | } | 191 | } |
184 | 192 | ||
185 | match = of_match_node(at91_reset_of_match, pdev->dev.of_node); | 193 | match = of_match_node(at91_reset_of_match, pdev->dev.of_node); |
186 | arm_pm_restart = match->data; | 194 | at91_restart_nb.notifier_call = match->data; |
187 | 195 | return register_restart_handler(&at91_restart_nb); | |
188 | return 0; | ||
189 | } | 196 | } |
190 | 197 | ||
191 | static int at91_reset_platform_probe(struct platform_device *pdev) | 198 | static int at91_reset_platform_probe(struct platform_device *pdev) |
@@ -212,10 +219,11 @@ static int at91_reset_platform_probe(struct platform_device *pdev) | |||
212 | } | 219 | } |
213 | 220 | ||
214 | match = platform_get_device_id(pdev); | 221 | match = platform_get_device_id(pdev); |
215 | arm_pm_restart = (void (*)(enum reboot_mode, const char*)) | 222 | at91_restart_nb.notifier_call = |
216 | match->driver_data; | 223 | (int (*)(struct notifier_block *, |
224 | unsigned long, void *)) match->driver_data; | ||
217 | 225 | ||
218 | return 0; | 226 | return register_restart_handler(&at91_restart_nb); |
219 | } | 227 | } |
220 | 228 | ||
221 | static int at91_reset_probe(struct platform_device *pdev) | 229 | static int at91_reset_probe(struct platform_device *pdev) |