public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Giulio Benetti <giulio.benetti@micronovasrl.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] at91sam9263ek: active watchdog support	via at91sam9263ek_wdt_config
Date: Thu, 18 Jun 2009 17:30:49 +0200	[thread overview]
Message-ID: <h1dmnp$61a$1@ger.gmane.org> (raw)
In-Reply-To: 20090615130120.GA2747@mail.gnudd.com

I think that with this patch at91 watchdog is enough, it reduces code that
is not yet used and I think it HAS NOT to be used(no wdt init).

Signed-off-by: giulio.benetti at micronovasrl.com

diff -urpN b/drivers/watchdog/at91sam9_wdt.c
a/drivers/watchdog/at91sam9_wdt.c
--- b/drivers/watchdog/at91sam9_wdt.c   2009-06-14 21:30:39.000000000 +0200
+++ a/drivers/watchdog/at91sam9_wdt.c   2009-06-18 17:26:26.000000000 +0200
@@ -5,6 +5,7 @@
  *
  * Copyright (C) 2008 Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com>
  * Copyright (C) 2008 Renaud CERRATO r.cerrato at til-technologies.fr
+ * Giulio Benetti <giulio.benetti@micronovasrl.com>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -24,56 +25,7 @@
 #include <asm/arch/io.h>
 #include <asm/arch/at91_wdt.h>
 
-/*
- * AT91SAM9 watchdog runs a 12bit counter @ 256Hz,
- * use this to convert a watchdog
- * value from/to milliseconds.
- */
-#define ms_to_ticks(t) (((t << 8) / 1000) - 1)
-#define ticks_to_ms(t) (((t + 1) * 1000) >> 8)
-
-/* Hardware timeout in seconds */
-#define WDT_HW_TIMEOUT 2
-
-/*
- * Set the watchdog time interval in 1/256Hz (write-once)
- * Counter is 12 bit.
- */
-static int at91_wdt_settimeout(unsigned int timeout)
-{
-       unsigned int reg;
-       unsigned int mr;
-
-       /* Check if disabled */
-       mr = at91_sys_read(AT91_WDT_MR);
-       if (mr & AT91_WDT_WDDIS) {
-               printf("sorry, watchdog is disabled\n");
-               return -1;
-       }
-
-       /*
-        * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
-        *
-        * Since WDV is a 12-bit counter, the maximum period is
-        * 4096 / 256 = 16 seconds.
-        */
-       reg = AT91_WDT_WDRSTEN  /* causes watchdog reset */
-               /* | AT91_WDT_WDRPROC   causes processor reset only */
-               | AT91_WDT_WDDBGHLT             /* disabled in debug mode */
-               | AT91_WDT_WDD                  /* restart at any time */
-               | (timeout & AT91_WDT_WDV);     /* timer value */
-       at91_sys_write(AT91_WDT_MR, reg);
-
-       return 0;
-}
-
 void hw_watchdog_reset(void)
 {
        at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
 }
-
-void hw_watchdog_init(void)
-{
-       /* 16 seconds timer, resets enabled */
-       at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000));
-}


-- 
Giulio Benetti
R&D
Micronova srl

  reply	other threads:[~2009-06-18 15:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-01 16:29 [U-Boot] [PATCH 1/2] at91sam9: add watchdog support Jean-Christophe PLAGNIOL-VILLARD
2009-02-01 16:29 ` [U-Boot] [PATCH 2/2] at91sam9263ek: active watchdog support via at91sam9263ek_wdt_config Jean-Christophe PLAGNIOL-VILLARD
2009-03-08 23:19   ` Wolfgang Denk
2009-06-13 10:52     ` Giulio Benetti
2009-06-13 12:37       ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-15 10:38         ` Giulio Benetti
2009-06-15 12:44           ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-15 13:01             ` Alessandro Rubini
2009-06-18 15:30               ` Giulio Benetti [this message]
2009-06-13 10:44 ` [U-Boot] [PATCH 1/2] at91sam9: add watchdog support Giulio Benetti
  -- strict thread matches above, loose matches on Subject: below --
2009-01-22 11:22 [U-Boot] [PATCH 0/2] " Jean-Christophe PLAGNIOL-VILLARD
2009-01-22 11:22 ` [U-Boot] [PATCH 1/2] " Jean-Christophe PLAGNIOL-VILLARD
2009-01-22 11:22   ` [U-Boot] [PATCH 2/2] at91sam9263ek: active watchdog support via at91sam9263ek_wdt_config Jean-Christophe PLAGNIOL-VILLARD
2009-03-08 23:15     ` Wolfgang Denk
2009-03-09  8:39       ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-09 11:19         ` Wolfgang Denk

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='h1dmnp$61a$1@ger.gmane.org' \
    --to=giulio.benetti@micronovasrl.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