diff mbox

[U-Boot] watchdog: omap: Add handling for CONFIG_WATCHDOG_TIMEOUT_MSECS

Message ID 1420714734-32635-1-git-send-email-marek.belisko@gmail.com
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Belisko Marek Jan. 8, 2015, 10:58 a.m. UTC
This change add possibility to change watchdog timeout compile time.
Previous default value is kept when CONFIG_WATCHDOG_TIMEOUT_MSECS is
not defined in config file.

Signed-off-by: Marek Belisko <marek.belisko@gmail.com>
---
 drivers/watchdog/omap_wdt.c |   12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

Comments

Tom Rini Jan. 8, 2015, 12:13 p.m. UTC | #1
On Thu, Jan 08, 2015 at 11:58:53AM +0100, Marek Belisko wrote:

> This change add possibility to change watchdog timeout compile time.
> Previous default value is kept when CONFIG_WATCHDOG_TIMEOUT_MSECS is
> not defined in config file.

Lets do this with a Kconfig option please, thanks!
diff mbox

Patch

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 7ea4b60..26774d6 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -44,9 +44,6 @@ 
 #include <asm/processor.h>
 #include <asm/arch/cpu.h>
 
-/* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 60
-
 static unsigned int wdt_trgr_pattern = 0x1234;
 
 void hw_watchdog_reset(void)
@@ -92,8 +89,15 @@  void hw_watchdog_init(void)
 	writel(WDT_WCLR_PRE | (PTV << WDT_WCLR_PTV_OFF), &wdt->wdtwclr);
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
 		;
+	/*
+	 * If timeuot is not defined in config file
+	 * use default 60 seconds
+	 */
+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS
+#define CONFIG_WATCHDOG_TIMEOUT_MSECS 60000
+#endif
 
-	omap_wdt_set_timeout(WDT_HW_TIMEOUT);
+	omap_wdt_set_timeout(CONFIG_WATCHDOG_TIMEOUT_MSECS);
 
 	/* Sequence to enable the watchdog */
 	writel(0xBBBB, &wdt->wdtwspr);