aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/sa1100_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/sa1100_wdt.c')
-rw-r--r--drivers/watchdog/sa1100_wdt.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index ed01e4c2beff..e19b45794717 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/bitops.h> 28#include <linux/bitops.h>
29#include <linux/uaccess.h> 29#include <linux/uaccess.h>
30#include <linux/timex.h>
30 31
31#ifdef CONFIG_ARCH_PXA 32#ifdef CONFIG_ARCH_PXA
32#include <mach/pxa-regs.h> 33#include <mach/pxa-regs.h>
@@ -35,8 +36,7 @@
35#include <mach/reset.h> 36#include <mach/reset.h>
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37 38
38#define OSCR_FREQ CLOCK_TICK_RATE 39static unsigned long oscr_freq;
39
40static unsigned long sa1100wdt_users; 40static unsigned long sa1100wdt_users;
41static int pre_margin; 41static int pre_margin;
42static int boot_status; 42static int boot_status;
@@ -123,12 +123,12 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
123 break; 123 break;
124 } 124 }
125 125
126 pre_margin = OSCR_FREQ * time; 126 pre_margin = oscr_freq * time;
127 OSMR3 = OSCR + pre_margin; 127 OSMR3 = OSCR + pre_margin;
128 /*fall through*/ 128 /*fall through*/
129 129
130 case WDIOC_GETTIMEOUT: 130 case WDIOC_GETTIMEOUT:
131 ret = put_user(pre_margin / OSCR_FREQ, p); 131 ret = put_user(pre_margin / oscr_freq, p);
132 break; 132 break;
133 } 133 }
134 return ret; 134 return ret;
@@ -155,6 +155,8 @@ static int __init sa1100dog_init(void)
155{ 155{
156 int ret; 156 int ret;
157 157
158 oscr_freq = get_clock_tick_rate();
159
158 /* 160 /*
159 * Read the reset status, and save it for later. If 161 * Read the reset status, and save it for later. If
160 * we suspend, RCSR will be cleared, and the watchdog 162 * we suspend, RCSR will be cleared, and the watchdog
@@ -162,7 +164,7 @@ static int __init sa1100dog_init(void)
162 */ 164 */
163 boot_status = (reset_status & RESET_STATUS_WATCHDOG) ? 165 boot_status = (reset_status & RESET_STATUS_WATCHDOG) ?
164 WDIOF_CARDRESET : 0; 166 WDIOF_CARDRESET : 0;
165 pre_margin = OSCR_FREQ * margin; 167 pre_margin = oscr_freq * margin;
166 168
167 ret = misc_register(&sa1100dog_miscdev); 169 ret = misc_register(&sa1100dog_miscdev);
168 if (ret == 0) 170 if (ret == 0)