diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-01 12:15:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-01 12:15:15 -0500 |
commit | ac0f6f927db539e03e1f3f61bcd4ed57d5cde7a9 (patch) | |
tree | 816e5ac643b15c2050c64a7075f0f7e13d86ea09 /drivers/watchdog | |
parent | b1bf9368407ae7e89d8a005bb40beb70a41df539 (diff) | |
parent | 9f33be2c3a80bdc2cc08342dd77fac87652e0548 (diff) |
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (100 commits)
ARM: Eliminate decompressor -Dstatic= PIC hack
ARM: 5958/1: ARM: U300: fix inverted clk round rate
ARM: 5956/1: misplaced parentheses
ARM: 5955/1: ep93xx: move timer defines into core.c and document
ARM: 5954/1: ep93xx: move gpio interrupt support to gpio.c
ARM: 5953/1: ep93xx: fix broken build of clock.c
ARM: 5952/1: ARM: MM: Add ARM_L1_CACHE_SHIFT_6 for handle inside each ARCH Kconfig
ARM: 5949/1: NUC900 add gpio virtual memory map
ARM: 5948/1: Enable timer0 to time4 clock support for nuc910
ARM: 5940/2: ARM: MMCI: remove custom DBG macro and printk
ARM: make_coherent(): fix problems with highpte, part 2
MM: Pass a PTE pointer to update_mmu_cache() rather than the PTE itself
ARM: 5945/1: ep93xx: include correct irq.h in core.c
ARM: 5933/1: amba-pl011: support hardware flow control
ARM: 5930/1: Add PKMAP area description to memory.txt.
ARM: 5929/1: Add checks to detect overlap of memory regions.
ARM: 5928/1: Change type of VMALLOC_END to unsigned long.
ARM: 5927/1: Make delimiters of DMA area globally visibly.
ARM: 5926/1: Add "Virtual kernel memory..." printout.
ARM: 5920/1: OMAP4: Enable L2 Cache
...
Fix up trivial conflict in arch/arm/mach-mx25/clock.c
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/pnx4008_wdt.c | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c index 430a5848a9a5..c7a9479934af 100644 --- a/drivers/watchdog/pnx4008_wdt.c +++ b/drivers/watchdog/pnx4008_wdt.c | |||
@@ -96,9 +96,6 @@ static void wdt_enable(void) | |||
96 | { | 96 | { |
97 | spin_lock(&io_lock); | 97 | spin_lock(&io_lock); |
98 | 98 | ||
99 | if (wdt_clk) | ||
100 | clk_set_rate(wdt_clk, 1); | ||
101 | |||
102 | /* stop counter, initiate counter reset */ | 99 | /* stop counter, initiate counter reset */ |
103 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); | 100 | __raw_writel(RESET_COUNT, WDTIM_CTRL(wdt_base)); |
104 | /*wait for reset to complete. 100% guarantee event */ | 101 | /*wait for reset to complete. 100% guarantee event */ |
@@ -125,19 +122,25 @@ static void wdt_disable(void) | |||
125 | spin_lock(&io_lock); | 122 | spin_lock(&io_lock); |
126 | 123 | ||
127 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ | 124 | __raw_writel(0, WDTIM_CTRL(wdt_base)); /*stop counter */ |
128 | if (wdt_clk) | ||
129 | clk_set_rate(wdt_clk, 0); | ||
130 | 125 | ||
131 | spin_unlock(&io_lock); | 126 | spin_unlock(&io_lock); |
132 | } | 127 | } |
133 | 128 | ||
134 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) | 129 | static int pnx4008_wdt_open(struct inode *inode, struct file *file) |
135 | { | 130 | { |
131 | int ret; | ||
132 | |||
136 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | 133 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) |
137 | return -EBUSY; | 134 | return -EBUSY; |
138 | 135 | ||
139 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 136 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
140 | 137 | ||
138 | ret = clk_enable(wdt_clk); | ||
139 | if (ret) { | ||
140 | clear_bit(WDT_IN_USE, &wdt_status); | ||
141 | return ret; | ||
142 | } | ||
143 | |||
141 | wdt_enable(); | 144 | wdt_enable(); |
142 | 145 | ||
143 | return nonseekable_open(inode, file); | 146 | return nonseekable_open(inode, file); |
@@ -225,6 +228,7 @@ static int pnx4008_wdt_release(struct inode *inode, struct file *file) | |||
225 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); | 228 | printk(KERN_WARNING "WATCHDOG: Device closed unexpectdly\n"); |
226 | 229 | ||
227 | wdt_disable(); | 230 | wdt_disable(); |
231 | clk_disable(wdt_clk); | ||
228 | clear_bit(WDT_IN_USE, &wdt_status); | 232 | clear_bit(WDT_IN_USE, &wdt_status); |
229 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | 233 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); |
230 | 234 | ||
@@ -273,25 +277,33 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev) | |||
273 | } | 277 | } |
274 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); | 278 | wdt_base = (void __iomem *)IO_ADDRESS(res->start); |
275 | 279 | ||
276 | wdt_clk = clk_get(&pdev->dev, "wdt_ck"); | 280 | wdt_clk = clk_get(&pdev->dev, NULL); |
277 | if (IS_ERR(wdt_clk)) { | 281 | if (IS_ERR(wdt_clk)) { |
278 | ret = PTR_ERR(wdt_clk); | 282 | ret = PTR_ERR(wdt_clk); |
279 | release_resource(wdt_mem); | 283 | release_resource(wdt_mem); |
280 | kfree(wdt_mem); | 284 | kfree(wdt_mem); |
281 | goto out; | 285 | goto out; |
282 | } else | 286 | } |
283 | clk_set_rate(wdt_clk, 1); | 287 | |
288 | ret = clk_enable(wdt_clk); | ||
289 | if (ret) { | ||
290 | release_resource(wdt_mem); | ||
291 | kfree(wdt_mem); | ||
292 | goto out; | ||
293 | } | ||
284 | 294 | ||
285 | ret = misc_register(&pnx4008_wdt_miscdev); | 295 | ret = misc_register(&pnx4008_wdt_miscdev); |
286 | if (ret < 0) { | 296 | if (ret < 0) { |
287 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); | 297 | printk(KERN_ERR MODULE_NAME "cannot register misc device\n"); |
288 | release_resource(wdt_mem); | 298 | release_resource(wdt_mem); |
289 | kfree(wdt_mem); | 299 | kfree(wdt_mem); |
290 | clk_set_rate(wdt_clk, 0); | 300 | clk_disable(wdt_clk); |
301 | clk_put(wdt_clk); | ||
291 | } else { | 302 | } else { |
292 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? | 303 | boot_status = (__raw_readl(WDTIM_RES(wdt_base)) & WDOG_RESET) ? |
293 | WDIOF_CARDRESET : 0; | 304 | WDIOF_CARDRESET : 0; |
294 | wdt_disable(); /*disable for now */ | 305 | wdt_disable(); /*disable for now */ |
306 | clk_disable(wdt_clk); | ||
295 | set_bit(WDT_DEVICE_INITED, &wdt_status); | 307 | set_bit(WDT_DEVICE_INITED, &wdt_status); |
296 | } | 308 | } |
297 | 309 | ||
@@ -302,11 +314,10 @@ out: | |||
302 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) | 314 | static int __devexit pnx4008_wdt_remove(struct platform_device *pdev) |
303 | { | 315 | { |
304 | misc_deregister(&pnx4008_wdt_miscdev); | 316 | misc_deregister(&pnx4008_wdt_miscdev); |
305 | if (wdt_clk) { | 317 | |
306 | clk_set_rate(wdt_clk, 0); | 318 | clk_disable(wdt_clk); |
307 | clk_put(wdt_clk); | 319 | clk_put(wdt_clk); |
308 | wdt_clk = NULL; | 320 | |
309 | } | ||
310 | if (wdt_mem) { | 321 | if (wdt_mem) { |
311 | release_resource(wdt_mem); | 322 | release_resource(wdt_mem); |
312 | kfree(wdt_mem); | 323 | kfree(wdt_mem); |