AnsweredAssumed Answered

Failed to reset Watchdog timer in u-boot

Question asked by Dhvanil Patel on May 20, 2015
Latest reply on May 21, 2015 by Yuri Muhin

Hi,

 

I am able to set watchdog timer u-boot and its working and system will reboot after timeout.

 

But I am not able to reset watchdog timer in u-boot itself.

 

Here is the code snippet which will do watchdog timer reset.

I have added this function in arch/arm/cpu/arm926ejs/mxs/mxs.c

#define CONFIG_WATCHDOG_TIMEOUT_MSECS 20000  // 20sec

static bool hw_watchdog_init_done = 0;

void hw_watchdog_reset(void)

{

        struct mxs_rtc_regs *rtc_regs =

                (struct mxs_rtc_regs *)MXS_RTC_BASE;

        if (!hw_watchdog_init_done)

                return;

        writel(CONFIG_WATCHDOG_TIMEOUT_MSECS, &rtc_regs->hw_rtc_watchdog);

}

void hw_watchdog_init(void)

{

        struct mxs_rtc_regs *rtc_regs =

                (struct mxs_rtc_regs *)MXS_RTC_BASE;

        hw_watchdog_init_done = 1;

        writel(RTC_PERSISTENT0_AUTO_RESTART, &rtc_regs->hw_rtc_persistent0_set);

        writel(CONFIG_WATCHDOG_TIMEOUT_MSECS, &rtc_regs->hw_rtc_watchdog);

      hw_watchdog_reset();

}

 

I am calling hw_watchdog_init() from board/freescale/mx28evk/mx28evk.c in board_init(). I have also enable hw watchdog (#define CONFIG_HW_WATCHDOG) in include/configs/mx28evk.h

 

One more things,

If I disable the code in hw_watchdog_reset() function and add writel(CONFIG_WATCHDOG_TIMEOUT_MSECS, &rtc_regs->hw_rtc_watchdog); in hw_watchdog_init() function then watchdog timer is working correct and board reset after timeout.

 

I want to reset Watchdog timer from hw_watchdog_reset() function before timeout occur. Is there any thing I am missing to reset watchdog timer? or missing anything to configure u-boot specific to watchdog reset functionality

 

 

 

Can anybody elaborate the way to reset watchdog timer?

-

Dhvanil Patel

Outcomes