diff options
| -rw-r--r-- | drivers/watchdog/orion_wdt.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c index be7c71c5d951..ba316db2b80c 100644 --- a/drivers/watchdog/orion_wdt.c +++ b/drivers/watchdog/orion_wdt.c | |||
| @@ -57,6 +57,7 @@ struct orion_watchdog_data { | |||
| 57 | int rstout_enable_bit; | 57 | int rstout_enable_bit; |
| 58 | int (*clock_init)(struct platform_device *, | 58 | int (*clock_init)(struct platform_device *, |
| 59 | struct orion_watchdog *); | 59 | struct orion_watchdog *); |
| 60 | int (*enabled)(struct orion_watchdog *); | ||
| 60 | int (*start)(struct watchdog_device *); | 61 | int (*start)(struct watchdog_device *); |
| 61 | int (*stop)(struct watchdog_device *); | 62 | int (*stop)(struct watchdog_device *); |
| 62 | }; | 63 | }; |
| @@ -229,7 +230,7 @@ static int orion_wdt_stop(struct watchdog_device *wdt_dev) | |||
| 229 | return dev->data->stop(wdt_dev); | 230 | return dev->data->stop(wdt_dev); |
| 230 | } | 231 | } |
| 231 | 232 | ||
| 232 | static int orion_wdt_enabled(struct orion_watchdog *dev) | 233 | static int orion_enabled(struct orion_watchdog *dev) |
| 233 | { | 234 | { |
| 234 | bool enabled, running; | 235 | bool enabled, running; |
| 235 | 236 | ||
| @@ -239,6 +240,13 @@ static int orion_wdt_enabled(struct orion_watchdog *dev) | |||
| 239 | return enabled && running; | 240 | return enabled && running; |
| 240 | } | 241 | } |
| 241 | 242 | ||
| 243 | static int orion_wdt_enabled(struct watchdog_device *wdt_dev) | ||
| 244 | { | ||
| 245 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); | ||
| 246 | |||
| 247 | return dev->data->enabled(dev); | ||
| 248 | } | ||
| 249 | |||
| 242 | static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev) | 250 | static unsigned int orion_wdt_get_timeleft(struct watchdog_device *wdt_dev) |
| 243 | { | 251 | { |
| 244 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); | 252 | struct orion_watchdog *dev = watchdog_get_drvdata(wdt_dev); |
| @@ -300,6 +308,7 @@ static const struct orion_watchdog_data orion_data = { | |||
| 300 | .wdt_enable_bit = BIT(4), | 308 | .wdt_enable_bit = BIT(4), |
| 301 | .wdt_counter_offset = 0x24, | 309 | .wdt_counter_offset = 0x24, |
| 302 | .clock_init = orion_wdt_clock_init, | 310 | .clock_init = orion_wdt_clock_init, |
| 311 | .enabled = orion_enabled, | ||
| 303 | .start = orion_start, | 312 | .start = orion_start, |
| 304 | .stop = orion_stop, | 313 | .stop = orion_stop, |
| 305 | }; | 314 | }; |
| @@ -309,6 +318,7 @@ static const struct orion_watchdog_data armada370_data = { | |||
| 309 | .wdt_enable_bit = BIT(8), | 318 | .wdt_enable_bit = BIT(8), |
| 310 | .wdt_counter_offset = 0x34, | 319 | .wdt_counter_offset = 0x34, |
| 311 | .clock_init = armada370_wdt_clock_init, | 320 | .clock_init = armada370_wdt_clock_init, |
| 321 | .enabled = orion_enabled, | ||
| 312 | .start = armada370_start, | 322 | .start = armada370_start, |
| 313 | .stop = armada370_stop, | 323 | .stop = armada370_stop, |
| 314 | }; | 324 | }; |
| @@ -318,6 +328,7 @@ static const struct orion_watchdog_data armadaxp_data = { | |||
| 318 | .wdt_enable_bit = BIT(8), | 328 | .wdt_enable_bit = BIT(8), |
| 319 | .wdt_counter_offset = 0x34, | 329 | .wdt_counter_offset = 0x34, |
| 320 | .clock_init = armadaxp_wdt_clock_init, | 330 | .clock_init = armadaxp_wdt_clock_init, |
| 331 | .enabled = orion_enabled, | ||
| 321 | .start = armada370_start, | 332 | .start = armada370_start, |
| 322 | .stop = armada370_stop, | 333 | .stop = armada370_stop, |
| 323 | }; | 334 | }; |
| @@ -424,7 +435,7 @@ static int orion_wdt_probe(struct platform_device *pdev) | |||
| 424 | * removed and re-insterted, or if the bootloader explicitly | 435 | * removed and re-insterted, or if the bootloader explicitly |
| 425 | * set a running watchdog before booting the kernel. | 436 | * set a running watchdog before booting the kernel. |
| 426 | */ | 437 | */ |
| 427 | if (!orion_wdt_enabled(dev)) | 438 | if (!orion_wdt_enabled(&dev->wdt)) |
| 428 | orion_wdt_stop(&dev->wdt); | 439 | orion_wdt_stop(&dev->wdt); |
| 429 | 440 | ||
| 430 | /* Request the IRQ only after the watchdog is disabled */ | 441 | /* Request the IRQ only after the watchdog is disabled */ |
