public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] Coldfire: interrupts: Add watchdog auto reset to dtimer_interrupt
Date: Fri, 20 Mar 2009 18:16:28 -0400	[thread overview]
Message-ID: <49C415BC.9080101@RuggedCom.com> (raw)

 From 8b6ff599fde043c89cf8e5163635e2bc6dce6787 Mon Sep 17 00:00:00 2001
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
Date: Fri, 20 Mar 2009 15:30:10 -0400
Subject: [PATCH] Adds WATCHDOG_RESET() function call to lib_m68k dtimer_interrupt.

Ported from lib_ppc/interrupts.c, this adds the ability for
the coldfire system timer to auto-reset the watchdog when
dtimer_interrupts is called.

Signed-off-by: Richard Retanubun <RichardRetanubun@RuggedCom.com>
---
Hi TC & John

This is the solution to the 2nd problem I found for my previous e-mail:

Coldfire: MCF5271: Periodic HW watchdog petting and sleep function does not work

This fixes the HW watchdog periodic auto-reset. The sleep function's cause I
answered in the original thread, still hoping to get recommended values for
CONFIG_SYS_TMRINTR_PRI, 0x09 seems to work ok.

- Richard

  lib_m68k/time.c |   13 ++++++++++++-
  1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/lib_m68k/time.c b/lib_m68k/time.c
index 697d67e..29269f6 100644
--- a/lib_m68k/time.c
+++ b/lib_m68k/time.c
@@ -27,10 +27,15 @@

  #include <asm/timer.h>
  #include <asm/immap.h>
+#include <watchdog.h>

  DECLARE_GLOBAL_DATA_PTR;

-static ulong timestamp;
+static volatile ulong timestamp = 0;
+
+#ifndef CONFIG_SYS_WATCHDOG_FREQ
+#define CONFIG_SYS_WATCHDOG_FREQ (CONFIG_SYS_HZ / 2)
+#endif

  #if defined(CONFIG_MCFTMR)
  #ifndef CONFIG_SYS_UDELAY_BASE
@@ -76,6 +81,12 @@ void dtimer_interrupt(void *not_used)
  	if ((CONFIG_SYS_TMRPND_REG & CONFIG_SYS_TMRINTR_MASK) == CONFIG_SYS_TMRINTR_PEND) {
  		timerp->ter = (DTIM_DTER_CAP | DTIM_DTER_REF);
  		timestamp++;
+
+		#if defined(CONFIG_WATCHDOG) || defined (CONFIG_HW_WATCHDOG)
+		if ((timestamp % (CONFIG_SYS_WATCHDOG_FREQ)) == 0) {
+			WATCHDOG_RESET ();
+		}
+		#endif    /* CONFIG_WATCHDOG || CONFIG_HW_WATCHDOG */
  		return;
  	}
  }
-- 
1.5.6.5

                 reply	other threads:[~2009-03-20 22:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=49C415BC.9080101@RuggedCom.com \
    --to=richardretanubun@ruggedcom.com \
    --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