mxs: add watchdog
Subsystems (2)
PATCH 1/1 mxs: add watchdog
Use RTC watchdog feature as hardware watchdog.
--- 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
drivers/watchdog/Makefile +1 -0
@@ -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
drivers/watchdog/mxsrtc_wdt.c new file +23 -0
@@ -0,0 +1,23 @@ +#include <common.h> +#include <asm/io.h> +#include <watchdog.h> +#include <asm/arch/imx-regs.h> + +#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
include/configs/mxs.h +4 -0
@@ -202,4 +202,8 @@#define CONFIG_EHCI_IS_TDI #endif +#ifdef CONFIG_HW_WATCHDOG +#define CONFIG_MXS_RTC_WATCHDOG +#endif +#endif /* __CONFIGS_MXS_H__ */
Signature · 1 line
1.8.5.3
PATCH 1/1 mxs: add watchdog
Hi Alexey,
sorry for delay - I missed your patch.
Quoted 25 lines · Alexey Ignatov
Use RTC watchdog feature as hardware watchdog.
Signed-off-by Alexey Ignatov <[email protected]>--- 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.cdrivers/watchdog/Makefile +1
-0@@ -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.odrivers/watchdog/mxsrtc_wdt.c new file +0
-0
drivers/watchdog/mxsrtc_wdt.c line 6
Quoted 6 lines
drivers/watchdog/mxsrtc_wdt.c new file +6
-0@@ -0,0 +1,23 @@ +#include <common.h> +#include <asm/io.h> +#include <watchdog.h> +#include <asm/arch/imx-regs.h> + +#ifdef CONFIG_MXS_RTC_WATCHDOG
You do not need this #ifdef. The file is compiled only if CONFIG_MXS_RTC_WATCHDOG, as you set in Makefile. You can drop it.
Quoted 6 lines
drivers/watchdog/mxsrtc_wdt.c new file +4
-0+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS +#define CONFIG_WATCHDOG_TIMEOUT_MSECS 60000 +#endif +void hw_watchdog_reset (void )
drivers/watchdog/mxsrtc_wdt.c line 20
Quoted 10 lines
drivers/watchdog/mxsrtc_wdt.c new file +10
-0+{ +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 ();
I think it does not matter, but why do we need to trigger the timer if we have not yet initialized it ?
Quoted 8 lines
drivers/watchdog/mxsrtc_wdt.c new file +3
-0+ writel(RTC_CTRL_WATCHDOGEN, &rtc_regs->hw_rtc_watchdog_set); +} +#endif include/configs/mxs.h +0
-0
include/configs/mxs.h line 207
Quoted 6 lines
include/configs/mxs.h +3
-0@@ -202,4 +202,8 @@#define CONFIG_EHCI_IS_TDI #endif +#ifdef CONFIG_HW_WATCHDOG +#define CONFIG_MXS_RTC_WATCHDOG +#endif
You have to split in two patch. The first one for the driver, the second one to add support for the board(s).
However, if you add it here, all boards will start the watchdog and maybe some of them do not want to have it. Trigger must be done later in kernel, too. I think each board maintainer should decide if he want to have watchdog enable or not.
Please move CONFIG_HW_WATCHDOG to the board where you want that it must be on, and please put the board's maintainer in CC in your next version
- thanks !
Best regards,
Stefano Babic
Quoted 3 lines
include/configs/mxs.h +1
-0+#endif /* __CONFIGS_MXS_H__ */
Signature · 5 lines
===================================================================== DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================