]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/watchdog/omap_wdt.c
rockchip: video: rk_vop: migrate to livetree
[people/ms/u-boot.git] / drivers / watchdog / omap_wdt.c
index 7ea4b604cd6376d500944bd3ba81937df2a91cc1..7b1f42943293e7e5015b6e1450d820bb1c4bb427 100644 (file)
@@ -81,10 +81,32 @@ static int omap_wdt_set_timeout(unsigned int timeout)
        return 0;
 }
 
+void hw_watchdog_disable(void)
+{
+       struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
+
+       /*
+        * Disable watchdog
+        */
+       writel(0xAAAA, &wdt->wdtwspr);
+       while (readl(&wdt->wdtwwps) != 0x0)
+               ;
+       writel(0x5555, &wdt->wdtwspr);
+       while (readl(&wdt->wdtwwps) != 0x0)
+               ;
+}
+
 void hw_watchdog_init(void)
 {
        struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
 
+       /*
+        * Make sure the watchdog is disabled. This is unfortunately required
+        * because writing to various registers with the watchdog running has no
+        * effect.
+        */
+       hw_watchdog_disable();
+
        /* initialize prescaler */
        while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
                ;
@@ -104,18 +126,3 @@ void hw_watchdog_init(void)
        while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR)
                ;
 }
-
-void hw_watchdog_disable(void)
-{
-       struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
-
-       /*
-        * Disable watchdog
-        */
-       writel(0xAAAA, &wdt->wdtwspr);
-       while (readl(&wdt->wdtwwps) != 0x0)
-               ;
-       writel(0x5555, &wdt->wdtwspr);
-       while (readl(&wdt->wdtwwps) != 0x0)
-               ;
-}