Disabling MX53 watchdog timer?

Hello all,

I’m using the watchdog timer on my Wi-i.MX53 board for a couple of features (including failover boot). The timer itself works fine, but I haven’t found a way to disable it. Where I’m at:

  1. If I use the wd_test_c program that comes with Digi ESP as a starting point, I can do things like pet the timer and change the timeout interval, but when it tries to disable the timer at exit there’s an ioctl error (“inappropriate ioctl for device”) and the program exits without disabling the timer - so the system reboots.

  2. I checked kernel configuration and found that the watchdog driver depends on NOWAYOUT:
    [linux-2.6.35/drivers/watchdog/Kconfig]

> config MXC_WATCHDOG
>     tristate "MXC watchdog"
>     depends on WATCHDOG && WATCHDOG_NOWAYOUT
>     depends on ARCH_MXC
>     help
>       Watchdog timer embedded into MXC chips. This will
>       reboot your system when timeout is reached.
> 
>       NOTE: once enabled, this timer cannot be disabled.
>       To compile this driver as a module, choose M here: the
>       module will be called mxc_wdt.

… this makes me suspicious that the driver or device doesn’t support being disabled, though if it’s never enabled to start with that doesn’t seem to bother anything. I tried removing this dependency and recompiling without NOWAYOUT; nothing complained but I still wasn’t able to disable the timer.

  1. I tried using the example watchdog program that comes with the kernel source (linux-2.6.35/Documentation/watchdog/src/watchdog-test.c) and it happily claims to disable the timer, but actually just quietly fails so after a minute the board reboots.

Has anyone had success disabling the watchdog timer manually? My main issue right now is that if I say /sbin/poweroff, the board will start shutting down but when the watchdog program exits, sometimes the watchdog timer will reset the board before it finishes powering off so it just reboots instead. My workaround at the moment is to catch SIGTERM and just change the timeout back to 60 seconds (I set it at 2 seconds during runtime) so that I can power off gracefully but it would be nice to just be able to disable the timer.

Thanks

Hi,
This is normal. Most watchdogs are “no way out”. This means, once enabled they cannot be disabled. That allows to test you if it can be disabled. Just that. In all Digi platforms the WD cannot be disabled. Therefore, the SW trails to disable it, but fails. It works as expected.
If you’d look in i.mx53 HRM you’d see something like:
Software watchdog enable
0Software watchdog disabled
1Software watchdog enabled;
[bgcolor=yellow]once set, cannot be cleared[/bgcolor]

Thanks for the response!