watchdog: ath79_wdt: avoid spurious restarts on AR934x
[pandora-kernel.git] / drivers / watchdog / ath79_wdt.c
index 725c84b..d256ca7 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/init.h>
@@ -73,6 +74,15 @@ static inline void ath79_wdt_keepalive(void)
 static inline void ath79_wdt_enable(void)
 {
        ath79_wdt_keepalive();
+
+       /*
+        * Updating the TIMER register requires a few microseconds
+        * on the AR934x SoCs at least. Use a small delay to ensure
+        * that the TIMER register is updated within the hardware
+        * before enabling the watchdog.
+        */
+       udelay(2);
+
        ath79_reset_wr(AR71XX_RESET_REG_WDOG_CTRL, WDOG_CTRL_ACTION_FCR);
 }