diff options
author | Ezequiel Garcia <ezequiel.garcia@free-electrons.com> | 2014-03-15 14:17:59 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2014-06-10 15:44:24 -0400 |
commit | ebf5cf7628f04b6988b9ad08d919728748ecbce0 (patch) | |
tree | cf50ba2040edb332c4edfea48a3c6db688a28702 | |
parent | eba985e20c70d99a278c04ff5c492d90d53a20dd (diff) |
watchdog: orion: Introduce per-SoC stop() function
In order to support other SoCs, it's needed to have a different stop()
implementation for each SoC. This commit adds no functionality, and it
consists of preparation work.
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Tested-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | drivers/watchdog/orion_wdt.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index 365d6cc53074..be7c71c5d951 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
@@ -58,6 +58,7 @@ struct orion_watchdog_data { | |||
58 | int (*clock_init)(struct platform_device *, | 58 | int (*clock_init)(struct platform_device *, |
59 | struct orion_watchdog *); | 59 | struct orion_watchdog *); |
60 | int (*start)(struct watchdog_device *); | 60 | int (*start)(struct watchdog_device *); |
61 | int (*stop)(struct watchdog_device *); | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | struct orion_watchdog { | 64 | struct orion_watchdog { |
@@ -192,7 +193,7 @@ static int orion_wdt_start(struct watchdog_device *wdt_dev) | |||
192 | return dev->data->start(wdt_dev); | 193 | return dev->data->start(wdt_dev); |
193 | } | 194 | } |
194 | 195 | ||
195 | static int orion_wdt_stop(struct watchdog_device *wdt_dev) | 196 | static int orion_stop(struct watchdog_device *wdt_dev) |
196 | { | 197 | { |
197 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); | 198 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); |
198 | 199 | ||
@@ -205,6 +206,29 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev) | |||
205 | return 0; | 206 | return 0; |
206 | } | 207 | } |
207 | 208 | ||
209 | static int armada370_stop(struct watchdog_device *wdt_dev) | ||
210 | { | ||
211 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); | ||
212 | u32 reg; | ||
213 | |||
214 | /* Disable reset on watchdog */ | ||
215 | reg = readl(dev->rstout); | ||
216 | reg &= ~dev->data->rstout_enable_bit; | ||
217 | writel(reg, dev->rstout); | ||
218 | |||
219 | /* Disable watchdog timer */ | ||
220 | atomic_io_modify(dev->reg + TIMER_CTRL, dev->data->wdt_enable_bit, 0); | ||
221 | |||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static int orion_wdt_stop(struct watchdog_device *wdt_dev) | ||
226 | { | ||
227 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); | ||
228 | |||
229 | return dev->data->stop(wdt_dev); | ||
230 | } | ||
231 | |||
208 | static int orion_wdt_enabled(struct orion_watchdog *dev) | 232 | static int orion_wdt_enabled(struct orion_watchdog *dev) |
209 | { | 233 | { |
210 | bool enabled, running; | 234 | bool enabled, running; |
@@ -277,6 +301,7 @@ static const struct orion_watchdog_data orion_data = { | |||
277 | .wdt_counter_offset = 0x24, | 301 | .wdt_counter_offset = 0x24, |
278 | .clock_init = orion_wdt_clock_init, | 302 | .clock_init = orion_wdt_clock_init, |
279 | .start = orion_start, | 303 | .start = orion_start, |
304 | .stop = orion_stop, | ||
280 | }; | 305 | }; |
281 | 306 | ||
282 | static const struct orion_watchdog_data armada370_data = { | 307 | static const struct orion_watchdog_data armada370_data = { |
@@ -285,6 +310,7 @@ static const struct orion_watchdog_data armada370_data = { | |||
285 | .wdt_counter_offset = 0x34, | 310 | .wdt_counter_offset = 0x34, |
286 | .clock_init = armada370_wdt_clock_init, | 311 | .clock_init = armada370_wdt_clock_init, |
287 | .start = armada370_start, | 312 | .start = armada370_start, |
313 | .stop = armada370_stop, | ||
288 | }; | 314 | }; |
289 | 315 | ||
290 | static const struct orion_watchdog_data armadaxp_data = { | 316 | static const struct orion_watchdog_data armadaxp_data = { |
@@ -293,6 +319,7 @@ static const struct orion_watchdog_data armadaxp_data = { | |||
293 | .wdt_counter_offset = 0x34, | 319 | .wdt_counter_offset = 0x34, |
294 | .clock_init = armadaxp_wdt_clock_init, | 320 | .clock_init = armadaxp_wdt_clock_init, |
295 | .start = armada370_start, | 321 | .start = armada370_start, |
322 | .stop = armada370_stop, | ||
296 | }; | 323 | }; |
297 | 324 | ||
298 | static const struct of_device_id orion_wdt_of_match_table[] = { | 325 | static const struct of_device_id orion_wdt_of_match_table[] = { |