diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-08-08 12:33:47 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-08-08 14:18:18 -0400 |
commit | 097d9eb537ff4d88b74c3fe67392e27c478ca3c5 (patch) | |
tree | 9034d676d9096857a380aab9d99e3e88fccb6bfe /drivers/watchdog/omap_wdt.c | |
parent | c41107c2d4fd31924533f4dbc4c3428acc2b5894 (diff) | |
parent | aeee90dfa01844168cd7f8051d0a0f969c573067 (diff) |
Merge Linus' latest into master
Conflicts:
drivers/watchdog/at91rm9200_wdt.c
drivers/watchdog/davinci_wdt.c
drivers/watchdog/ep93xx_wdt.c
drivers/watchdog/ixp2000_wdt.c
drivers/watchdog/ixp4xx_wdt.c
drivers/watchdog/ks8695_wdt.c
drivers/watchdog/omap_wdt.c
drivers/watchdog/pnx4008_wdt.c
drivers/watchdog/sa1100_wdt.c
drivers/watchdog/wdt285.c
Diffstat (limited to 'drivers/watchdog/omap_wdt.c')
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 74a10d50607b..3a11dadfd8e7 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -40,11 +40,9 @@ | |||
40 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
41 | #include <linux/clk.h> | 41 | #include <linux/clk.h> |
42 | #include <linux/bitops.h> | 42 | #include <linux/bitops.h> |
43 | 43 | #include <linux/io.h> | |
44 | #include <asm/io.h> | 44 | #include <linux/uaccess.h> |
45 | #include <asm/uaccess.h> | ||
46 | #include <mach/hardware.h> | 45 | #include <mach/hardware.h> |
47 | |||
48 | #include <mach/prcm.h> | 46 | #include <mach/prcm.h> |
49 | 47 | ||
50 | #include "omap_wdt.h" | 48 | #include "omap_wdt.h" |
@@ -54,11 +52,12 @@ module_param(timer_margin, uint, 0); | |||
54 | MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)"); | 52 | MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)"); |
55 | 53 | ||
56 | static int omap_wdt_users; | 54 | static int omap_wdt_users; |
57 | static struct clk *armwdt_ck = NULL; | 55 | static struct clk *armwdt_ck; |
58 | static struct clk *mpu_wdt_ick = NULL; | 56 | static struct clk *mpu_wdt_ick; |
59 | static struct clk *mpu_wdt_fck = NULL; | 57 | static struct clk *mpu_wdt_fck; |
60 | 58 | ||
61 | static unsigned int wdt_trgr_pattern = 0x1234; | 59 | static unsigned int wdt_trgr_pattern = 0x1234; |
60 | static spinlock_t wdt_lock; | ||
62 | 61 | ||
63 | static void omap_wdt_ping(void) | 62 | static void omap_wdt_ping(void) |
64 | { | 63 | { |
@@ -174,30 +173,29 @@ static int omap_wdt_release(struct inode *inode, struct file *file) | |||
174 | return 0; | 173 | return 0; |
175 | } | 174 | } |
176 | 175 | ||
177 | static ssize_t | 176 | static ssize_t omap_wdt_write(struct file *file, const char __user *data, |
178 | omap_wdt_write(struct file *file, const char __user *data, | ||
179 | size_t len, loff_t *ppos) | 177 | size_t len, loff_t *ppos) |
180 | { | 178 | { |
181 | /* Refresh LOAD_TIME. */ | 179 | /* Refresh LOAD_TIME. */ |
182 | if (len) | 180 | if (len) { |
181 | spin_lock(&wdt_lock); | ||
183 | omap_wdt_ping(); | 182 | omap_wdt_ping(); |
183 | spin_unlock(&wdt_lock); | ||
184 | } | ||
184 | return len; | 185 | return len; |
185 | } | 186 | } |
186 | 187 | ||
187 | static int | 188 | static long omap_wdt_ioctl(struct file *file, unsigned int cmd, |
188 | omap_wdt_ioctl(struct inode *inode, struct file *file, | 189 | unsigned long arg) |
189 | unsigned int cmd, unsigned long arg) | ||
190 | { | 190 | { |
191 | int new_margin; | 191 | int new_margin; |
192 | static struct watchdog_info ident = { | 192 | static const struct watchdog_info ident = { |
193 | .identity = "OMAP Watchdog", | 193 | .identity = "OMAP Watchdog", |
194 | .options = WDIOF_SETTIMEOUT, | 194 | .options = WDIOF_SETTIMEOUT, |
195 | .firmware_version = 0, | 195 | .firmware_version = 0, |
196 | }; | 196 | }; |
197 | 197 | ||
198 | switch (cmd) { | 198 | switch (cmd) { |
199 | default: | ||
200 | return -ENOTTY; | ||
201 | case WDIOC_GETSUPPORT: | 199 | case WDIOC_GETSUPPORT: |
202 | return copy_to_user((struct watchdog_info __user *)arg, &ident, | 200 | return copy_to_user((struct watchdog_info __user *)arg, &ident, |
203 | sizeof(ident)); | 201 | sizeof(ident)); |
@@ -211,28 +209,34 @@ omap_wdt_ioctl(struct inode *inode, struct file *file, | |||
211 | return put_user(omap_prcm_get_reset_sources(), | 209 | return put_user(omap_prcm_get_reset_sources(), |
212 | (int __user *)arg); | 210 | (int __user *)arg); |
213 | case WDIOC_KEEPALIVE: | 211 | case WDIOC_KEEPALIVE: |
212 | spin_lock(&wdt_lock); | ||
214 | omap_wdt_ping(); | 213 | omap_wdt_ping(); |
214 | spin_unlock(&wdt_lock); | ||
215 | return 0; | 215 | return 0; |
216 | case WDIOC_SETTIMEOUT: | 216 | case WDIOC_SETTIMEOUT: |
217 | if (get_user(new_margin, (int __user *)arg)) | 217 | if (get_user(new_margin, (int __user *)arg)) |
218 | return -EFAULT; | 218 | return -EFAULT; |
219 | omap_wdt_adjust_timeout(new_margin); | 219 | omap_wdt_adjust_timeout(new_margin); |
220 | 220 | ||
221 | spin_lock(&wdt_lock); | ||
221 | omap_wdt_disable(); | 222 | omap_wdt_disable(); |
222 | omap_wdt_set_timeout(); | 223 | omap_wdt_set_timeout(); |
223 | omap_wdt_enable(); | 224 | omap_wdt_enable(); |
224 | 225 | ||
225 | omap_wdt_ping(); | 226 | omap_wdt_ping(); |
227 | spin_unlock(&wdt_lock); | ||
226 | /* Fall */ | 228 | /* Fall */ |
227 | case WDIOC_GETTIMEOUT: | 229 | case WDIOC_GETTIMEOUT: |
228 | return put_user(timer_margin, (int __user *)arg); | 230 | return put_user(timer_margin, (int __user *)arg); |
231 | default: | ||
232 | return -ENOTTY; | ||
229 | } | 233 | } |
230 | } | 234 | } |
231 | 235 | ||
232 | static const struct file_operations omap_wdt_fops = { | 236 | static const struct file_operations omap_wdt_fops = { |
233 | .owner = THIS_MODULE, | 237 | .owner = THIS_MODULE, |
234 | .write = omap_wdt_write, | 238 | .write = omap_wdt_write, |
235 | .ioctl = omap_wdt_ioctl, | 239 | .unlocked_ioctl = omap_wdt_ioctl, |
236 | .open = omap_wdt_open, | 240 | .open = omap_wdt_open, |
237 | .release = omap_wdt_release, | 241 | .release = omap_wdt_release, |
238 | }; | 242 | }; |
@@ -240,7 +244,7 @@ static const struct file_operations omap_wdt_fops = { | |||
240 | static struct miscdevice omap_wdt_miscdev = { | 244 | static struct miscdevice omap_wdt_miscdev = { |
241 | .minor = WATCHDOG_MINOR, | 245 | .minor = WATCHDOG_MINOR, |
242 | .name = "watchdog", | 246 | .name = "watchdog", |
243 | .fops = &omap_wdt_fops | 247 | .fops = &omap_wdt_fops, |
244 | }; | 248 | }; |
245 | 249 | ||
246 | static int __init omap_wdt_probe(struct platform_device *pdev) | 250 | static int __init omap_wdt_probe(struct platform_device *pdev) |
@@ -373,6 +377,7 @@ static struct platform_driver omap_wdt_driver = { | |||
373 | 377 | ||
374 | static int __init omap_wdt_init(void) | 378 | static int __init omap_wdt_init(void) |
375 | { | 379 | { |
380 | spin_lock_init(&wdt_lock); | ||
376 | return platform_driver_register(&omap_wdt_driver); | 381 | return platform_driver_register(&omap_wdt_driver); |
377 | } | 382 | } |
378 | 383 | ||