[U-Boot] [PATCH AT91] Add watchdog reset to the at91samx SOC family

Michael Trimarchi trimarchi at gandalf.sssup.it
Tue Mar 15 12:27:17 CET 2011


This patch add the watchdog reset function to the atmel atsam9x architectures.

Signed-off-by: Michael Trimarchi <michael at amarulasolutions.com>
Cc: Reinhard Meyer <u-boot at emk-elektronik.de>

---
diff --git a/arch/arm/cpu/arm926ejs/at91/timer.c b/arch/arm/cpu/arm926ejs/at91/timer.c
index 82b8d7e..2e4ff02 100644
--- a/arch/arm/cpu/arm926ejs/at91/timer.c
+++ b/arch/arm/cpu/arm926ejs/at91/timer.c
@@ -26,6 +26,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pit.h>
 #include <asm/arch/at91_pmc.h>
+#include <asm/arch/at91_wdt.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/io.h>
 #include <div64.h>
@@ -139,3 +140,18 @@ ulong get_tbclk(void)
 {
 	return gd->timer_rate_hz;
 }
+
+#if defined(CONFIG_WATCHDOG)
+
+void watchdog_reset(void)
+{
+	at91_wdt_t *wdt = (at91_wdt_t *) AT91_WDT_BASE;
+	int re_enable = disable_interrupts();
+
+	writel(AT91_WDT_CR_WDRSTT | AT91_WDT_CR_KEY, &wdt->cr);
+
+	if (re_enable)
+		enable_interrupts();
+}
+
+#endif


More information about the U-Boot mailing list