aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2008-12-23 22:32:45 -0500
committerEric Miao <eric.miao@marvell.com>2008-12-29 04:58:00 -0500
commit28a623855f737a905b90a1616107ad813bfcd6e9 (patch)
tree788d7454da490c2c4e8a29e53fbecf0f7b1f1777 /drivers/watchdog
parent6769717d5d51596618f6b143008d8ace11ec8a69 (diff)
[ARM] sa1100_wdt: don't assume CLOCK_TICK_RATE to be a constant
See description of commit: [ARM] rtc-sa1100: don't assume CLOCK_TICK_RATE to be a constant for additional information. Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/sa1100_wdt.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c
index ed01e4c2beff..87977156ddb8 100644
--- a/drivers/watchdog/sa1100_wdt.c
+++ b/drivers/watchdog/sa1100_wdt.c
@@ -35,8 +35,7 @@
35#include <mach/reset.h> 35#include <mach/reset.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37 37
38#define OSCR_FREQ CLOCK_TICK_RATE 38static unsigned long oscr_freq;
39
40static unsigned long sa1100wdt_users; 39static unsigned long sa1100wdt_users;
41static int pre_margin; 40static int pre_margin;
42static int boot_status; 41static int boot_status;
@@ -123,12 +122,12 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd,
123 break; 122 break;
124 } 123 }
125 124
126 pre_margin = OSCR_FREQ * time; 125 pre_margin = oscr_freq * time;
127 OSMR3 = OSCR + pre_margin; 126 OSMR3 = OSCR + pre_margin;
128 /*fall through*/ 127 /*fall through*/
129 128
130 case WDIOC_GETTIMEOUT: 129 case WDIOC_GETTIMEOUT:
131 ret = put_user(pre_margin / OSCR_FREQ, p); 130 ret = put_user(pre_margin / oscr_freq, p);
132 break; 131 break;
133 } 132 }
134 return ret; 133 return ret;
@@ -155,6 +154,8 @@ static int __init sa1100dog_init(void)
155{ 154{
156 int ret; 155 int ret;
157 156
157 oscr_freq = get_clock_tick_rate();
158
158 /* 159 /*
159 * Read the reset status, and save it for later. If 160 * Read the reset status, and save it for later. If
160 * we suspend, RCSR will be cleared, and the watchdog 161 * we suspend, RCSR will be cleared, and the watchdog
@@ -162,7 +163,7 @@ static int __init sa1100dog_init(void)
162 */ 163 */
163 boot_status = (reset_status & RESET_STATUS_WATCHDOG) ? 164 boot_status = (reset_status & RESET_STATUS_WATCHDOG) ?
164 WDIOF_CARDRESET : 0; 165 WDIOF_CARDRESET : 0;
165 pre_margin = OSCR_FREQ * margin; 166 pre_margin = oscr_freq * margin;
166 167
167 ret = misc_register(&sa1100dog_miscdev); 168 ret = misc_register(&sa1100dog_miscdev);
168 if (ret == 0) 169 if (ret == 0)