public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergey Lapin <slapin@ossfans.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Hardware watchdog support for AT91SAM9260 CPU
Date: Fri, 15 Aug 2008 02:29:26 +0400	[thread overview]
Message-ID: <12187529674144-git-send-email-slapin@ossfans.org> (raw)


Signed-off-by: Sergey Lapin <slapin@ossfans.org>
---
 cpu/arm926ejs/at91/Makefile   |    1 +
 cpu/arm926ejs/at91/watchdog.c |   35 +++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/at91/watchdog.c

diff --git a/cpu/arm926ejs/at91/Makefile b/cpu/arm926ejs/at91/Makefile
index 44cde1a..7befcd7 100644
--- a/cpu/arm926ejs/at91/Makefile
+++ b/cpu/arm926ejs/at91/Makefile
@@ -29,6 +29,7 @@ COBJS-y	+= ether.o
 COBJS-y	+= timer.o
 COBJS-$(CONFIG_HAS_DATAFLASH) +=spi.o
 COBJS-y	+= usb.o
+COBJS-$(CONFIG_HW_WATCHDOG) +=watchdog.o
 SOBJS	= lowlevel_init.o
 
 SRCS    := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
diff --git a/cpu/arm926ejs/at91/watchdog.c b/cpu/arm926ejs/at91/watchdog.c
new file mode 100644
index 0000000..da15268
--- /dev/null
+++ b/cpu/arm926ejs/at91/watchdog.c
@@ -0,0 +1,35 @@
+/*
+ * watchdog.c - driver for at91sam9260 watchdog
+ *
+ * Copyright (c) 2007-2008 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <common.h>
+#include <watchdog.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/io.h>
+
+#ifdef CONFIG_HW_WATCHDOG
+#define AT91_WDT_CR		(AT91_WDT+0x00)
+#define AT91_WDT_MR		(AT91_WDT+0x04)
+#define AT91_WDT_SR		(AT91_WDT+0x08)
+
+void hw_watchdog_reset(void)
+{
+	at91_sys_write(AT91_WDT_CR, 0xa5000001);
+}
+
+void hw_watchdog_init(void)
+{
+	/* 16 seconds timer, resets enabled */
+	at91_sys_write(AT91_WDT_MR, 0x3FFF2FFF);
+}
+
+void hw_watchdog_disable(void)
+{
+	/* Can't reenable per documentation */
+	at91_sys_write(AT91_WDT_MR, 0x8000);
+}
+#endif
-- 
1.5.4.1

             reply	other threads:[~2008-08-14 22:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-14 22:29 Sergey Lapin [this message]
2008-08-14 22:29 ` [U-Boot] [PATCH] Custom AFEB9260 board support Sergey Lapin
2008-10-12 22:07   ` Wolfgang Denk
2008-10-24  7:44   ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-14 22:32 ` [U-Boot] [PATCH] Hardware watchdog support for AT91SAM9260 CPU Sergey Lapin
2008-10-22 21:49 ` Jean-Christophe PLAGNIOL-VILLARD
2008-10-22 23:22   ` Sergey Lapin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=12187529674144-git-send-email-slapin@ossfans.org \
    --to=slapin@ossfans.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox