]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
Merge branch 'pele-peep4' of /home/linnj/linux_arm/devel/linux-2.6-xlnx-peep4-debug... pele-alpha2-validation1
authorJohn Linn <linnj@xilinx.com>
Fri, 20 Aug 2010 23:16:30 +0000 (17:16 -0600)
committerJohn Linn <linnj@xilinx.com>
Fri, 20 Aug 2010 23:16:30 +0000 (17:16 -0600)
drivers/watchdog/xilinx_a9wdt.c
drivers/watchdog/xilinx_wdtpss.c

index f4576b5d05b6a355db4636ee605f0ae9f9946264..10a4a9cb0cd8513f0364f3c6b9c941268603f3d4 100755 (executable)
 #include <linux/watchdog.h>
 #include <linux/miscdevice.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
 
 /* These are temporary values. Need to finalize when we have a fixed clock */
-#define XA9WDT_MAX_TIMEOUT     300
+#define XA9WDT_CLOCK           5000000
+#define XA9WDT_MAX_TIMEOUT     600
 #define XA9WDT_DEFAULT_TIMEOUT  10
 #define XA9WDT_PRESCALER        00
 
@@ -89,7 +91,7 @@ static struct watchdog_info xa9wdt_info = {
 /**
  * xa9wdt_start -  Enable and start the watchdog.
  *
- * The clock to the WDT is 12.5 MHz and the counter value is calculated
+ * The clock to the WDT is 5 MHz and the counter value is calculated
  * according to the formula:
  *     load count = ((timeout * clock) / (prescalar + 1)) - 1.
  * This needs to be re-visited when the PERIPHCLK clock changes in HW.
@@ -97,7 +99,7 @@ static struct watchdog_info xa9wdt_info = {
  **/
 static void xa9wdt_start(void)
 {
-       wdt_count = ((wdt_timeout * 12500000) / (XA9WDT_PRESCALER + 1)) - 1;
+       wdt_count = ((wdt_timeout * XA9WDT_CLOCK) / (XA9WDT_PRESCALER + 1)) - 1;
 
        spin_lock(&wdt->io_lock);
        xa9wdt_writereg(wdt_count, XA9WDT_LOAD_OFFSET);
@@ -506,8 +508,9 @@ static int __init xa9wdt_init(void)
         */
        if (xa9wdt_settimeout(wdt_timeout)) {
                xa9wdt_settimeout(XA9WDT_DEFAULT_TIMEOUT);
-               pr_info("xa9wdt: wdt_timeout value limited to 1 - 300 sec, \
-               using default %dsec timeout\n", XA9WDT_DEFAULT_TIMEOUT);
+               pr_info("xa9wdt: wdt_timeout value limited to 1 - %d sec, "
+               "using default %dsec timeout\n",
+               XA9WDT_MAX_TIMEOUT, XA9WDT_DEFAULT_TIMEOUT);
        }
        return platform_driver_register(&xa9wdt_driver);
 }
index eb867fb627c249f4ec1a3b0991cf4c36e1aa1775..223aaf10d50538f79fc0e693baab65fc57a2355b 100644 (file)
@@ -27,8 +27,9 @@
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 
-
-#define XWDTPSS_DEFAULT_TIMEOUT        10      /* Supports 1 - 600 sec */
+#define XWDTPSS_CLOCK          2500000
+#define XWDTPSS_DEFAULT_TIMEOUT        10
+#define XWDTPSS_MAX_TIMEOUT    400     /* Supports 1 - 400 sec */
 
 static int wdt_timeout = XWDTPSS_DEFAULT_TIMEOUT;
 static int nowayout = WATCHDOG_NOWAYOUT;
@@ -128,7 +129,7 @@ static void xwdtpss_reload(void)
 /**
  * xwdtpss_start -  Enable and start the watchdog.
  *
- * The clock to the WDT is 100 MHz, the prescalar is set to divide
+ * The clock to the WDT is 2.5 MHz, the prescalar is set to divide
  * the clock by 4096 and the counter value is calculated according to
  * the formula:
  *             calculated count = (timeout * clock) / prescalar + 1.
@@ -149,11 +150,11 @@ static void xwdtpss_start(void)
         * 64           - Prescalar divide value.
         * 0x1000       - Counter Value Divide, to obtain the value of counter
         *                reset to write to control register.
-        * 781250       - Input clock value.
+        * 2500000      - Input clock value.
         * This code needs to be modified when the clock value increases
         * in H/W.
         */
-       count = (wdt_timeout * 781250) / (64 * 0x1000) + 1;
+       count = (wdt_timeout * XWDTPSS_CLOCK) / (64 * 0x1000) + 1;
 
        /* Check for boundary conditions of counter value */
        if (count > 0xFFF)
@@ -192,7 +193,7 @@ static void xwdtpss_start(void)
  **/
 static int xwdtpss_settimeout(int new_time)
 {
-       if ((new_time <= 0) || (new_time > 600))
+       if ((new_time <= 0) || (new_time > XWDTPSS_MAX_TIMEOUT))
                return -ENOTSUPP;
        wdt_timeout = new_time;
        return 0;
@@ -548,9 +549,9 @@ static int __init xwdtpss_init(void)
         */
        if (xwdtpss_settimeout(wdt_timeout)) {
                xwdtpss_settimeout(XWDTPSS_DEFAULT_TIMEOUT);
-               pr_info("xwdtpss: wdt_timeout value limited to 1 - 600 sec, "
+               pr_info("xwdtpss: wdt_timeout value limited to 1 - %d sec, "
                        "using default timeout of %dsec\n",
-                       XWDTPSS_DEFAULT_TIMEOUT);
+                       XWDTPSS_MAX_TIMEOUT, XWDTPSS_DEFAULT_TIMEOUT);
        }
        return platform_driver_register(&xwdtpss_driver);
 }