Failed to reset Watchdog timer in u-boot

cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to reset Watchdog timer in u-boot

1,166 Views
dhvanilpatel
Contributor I

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

Labels (2)
0 Kudos
1 Reply

198 Views
Yuri
NXP TechSupport
NXP TechSupport

  Please try the following (how to implement reset) :

HW_RTC_PERSISTENT0: AUTO_RESTART =1

HW_POWER_RESET: 0x3E77<<16 | PWD

Best regards

Yuri

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos