diff mbox

[U-Boot,6/7] ti: wdt: omap: Use CONFIG_HW_WATCHDOG_TIMEOUT_MS to specify watchdog timeout

Message ID 1487543082-24746-8-git-send-email-lukma@denx.de
State Changes Requested
Delegated to: Tom Rini
Headers show

Commit Message

Lukasz Majewski Feb. 19, 2017, 10:24 p.m. UTC
Now it is possible to specify in the config file the time after which
watchdog will trigger.

The flag itself has been reused from designware watchdog code
(./drivers/watchdog/designware_wdt.c).

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 drivers/watchdog/omap_wdt.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Tom Rini Feb. 20, 2017, 2:23 a.m. UTC | #1
On Sun, Feb 19, 2017 at 11:24:41PM +0100, Lukasz Majewski wrote:
> Now it is possible to specify in the config file the time after which
> watchdog will trigger.
> 
> The flag itself has been reused from designware watchdog code
> (./drivers/watchdog/designware_wdt.c).
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> ---
>  drivers/watchdog/omap_wdt.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
> index 7b1f429..5a2126b 100644
> --- a/drivers/watchdog/omap_wdt.c
> +++ b/drivers/watchdog/omap_wdt.c
> @@ -45,7 +45,9 @@
>  #include <asm/arch/cpu.h>
>  
>  /* Hardware timeout in seconds */
> -#define WDT_HW_TIMEOUT 60
> +#ifndef CONFIG_HW_WATCHDOG_TIMEOUT_MS
> +#define CONFIG_HW_WATCHDOG_TIMEOUT_MS 60000
> +#endif

Please migrate CONFIG_HW_WATCHDOG_TIMEOUT_MS to Kconfig, thanks!
diff mbox

Patch

diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 7b1f429..5a2126b 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -45,7 +45,9 @@ 
 #include <asm/arch/cpu.h>
 
 /* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 60
+#ifndef CONFIG_HW_WATCHDOG_TIMEOUT_MS
+#define CONFIG_HW_WATCHDOG_TIMEOUT_MS 60000
+#endif
 
 static unsigned int wdt_trgr_pattern = 0x1234;
 
@@ -68,7 +70,7 @@  void hw_watchdog_reset(void)
 static int omap_wdt_set_timeout(unsigned int timeout)
 {
 	struct wd_timer *wdt = (struct wd_timer *)WDT_BASE;
-	u32 pre_margin = GET_WLDR_VAL(timeout);
+	u32 pre_margin = GET_WLDR_VAL(timeout / 1000);
 
 	/* just count up at 32 KHz */
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WLDR)
@@ -115,7 +117,7 @@  void hw_watchdog_init(void)
 	while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR)
 		;
 
-	omap_wdt_set_timeout(WDT_HW_TIMEOUT);
+	omap_wdt_set_timeout(CONFIG_HW_WATCHDOG_TIMEOUT_MS);
 
 	/* Sequence to enable the watchdog */
 	writel(0xBBBB, &wdt->wdtwspr);