From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Ignatov Date: Wed, 8 Oct 2014 07:14:51 +0400 Subject: [U-Boot] [PATCH] mxs: add watchdog Message-ID: <1412738091-28876-1-git-send-email-lexszero@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Use RTC watchdog feature as hardware watchdog. Signed-off-by: Alexey Ignatov --- drivers/watchdog/Makefile | 1 + drivers/watchdog/mxsrtc_wdt.c | 23 +++++++++++++++++++++++ include/configs/mxs.h | 4 ++++ 3 files changed, 28 insertions(+) create mode 100644 drivers/watchdog/mxsrtc_wdt.c diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile index 0276a10..ffe42d1 100644 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -16,3 +16,4 @@ obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o obj-$(CONFIG_BFIN_WATCHDOG) += bfin_wdt.o obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o +obj-$(CONFIG_MXS_RTC_WATCHDOG) += mxsrtc_wdt.o diff --git a/drivers/watchdog/mxsrtc_wdt.c b/drivers/watchdog/mxsrtc_wdt.c new file mode 100644 index 0000000..33e7663 --- /dev/null +++ b/drivers/watchdog/mxsrtc_wdt.c @@ -0,0 +1,23 @@ +#include +#include +#include +#include + +#ifdef CONFIG_MXS_RTC_WATCHDOG +#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS +#define CONFIG_WATCHDOG_TIMEOUT_MSECS 60000 +#endif +void hw_watchdog_reset(void) +{ + struct mxs_rtc_regs *rtc_regs = (struct mxs_rtc_regs *)MXS_RTC_BASE; + 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_reset(); + writel(RTC_CTRL_WATCHDOGEN, &rtc_regs->hw_rtc_watchdog_set); +} +#endif diff --git a/include/configs/mxs.h b/include/configs/mxs.h index 8bce28f..1f1b87a 100644 --- a/include/configs/mxs.h +++ b/include/configs/mxs.h @@ -202,4 +202,8 @@ #define CONFIG_EHCI_IS_TDI #endif +#ifdef CONFIG_HW_WATCHDOG +#define CONFIG_MXS_RTC_WATCHDOG +#endif + #endif /* __CONFIGS_MXS_H__ */ -- 1.8.5.3