aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/omap_wdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/watchdog/omap_wdt.c')
-rw-r--r--drivers/watchdog/omap_wdt.c42
1 files changed, 7 insertions, 35 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 81e3d6100894..3dd4971160ef 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -38,11 +38,11 @@
38#include <linux/err.h> 38#include <linux/err.h>
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40#include <linux/moduleparam.h> 40#include <linux/moduleparam.h>
41#include <linux/clk.h>
42#include <linux/bitops.h> 41#include <linux/bitops.h>
43#include <linux/io.h> 42#include <linux/io.h>
44#include <linux/uaccess.h> 43#include <linux/uaccess.h>
45#include <linux/slab.h> 44#include <linux/slab.h>
45#include <linux/pm_runtime.h>
46#include <mach/hardware.h> 46#include <mach/hardware.h>
47#include <plat/prcm.h> 47#include <plat/prcm.h>
48 48
@@ -61,8 +61,6 @@ struct omap_wdt_dev {
61 void __iomem *base; /* physical */ 61 void __iomem *base; /* physical */
62 struct device *dev; 62 struct device *dev;
63 int omap_wdt_users; 63 int omap_wdt_users;
64 struct clk *ick;
65 struct clk *fck;
66 struct resource *mem; 64 struct resource *mem;
67 struct miscdevice omap_wdt_miscdev; 65 struct miscdevice omap_wdt_miscdev;
68}; 66};
@@ -146,8 +144,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file)
146 if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) 144 if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
147 return -EBUSY; 145 return -EBUSY;
148 146
149 clk_enable(wdev->ick); /* Enable the interface clock */ 147 pm_runtime_get_sync(wdev->dev);
150 clk_enable(wdev->fck); /* Enable the functional clock */
151 148
152 /* initialize prescaler */ 149 /* initialize prescaler */
153 while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) 150 while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01)
@@ -177,8 +174,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file)
177 174
178 omap_wdt_disable(wdev); 175 omap_wdt_disable(wdev);
179 176
180 clk_disable(wdev->ick); 177 pm_runtime_put_sync(wdev->dev);
181 clk_disable(wdev->fck);
182#else 178#else
183 printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); 179 printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n");
184#endif 180#endif
@@ -293,19 +289,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
293 289
294 wdev->omap_wdt_users = 0; 290 wdev->omap_wdt_users = 0;
295 wdev->mem = mem; 291 wdev->mem = mem;
296 292 wdev->dev = &pdev->dev;
297 wdev->ick = clk_get(&pdev->dev, "ick");
298 if (IS_ERR(wdev->ick)) {
299 ret = PTR_ERR(wdev->ick);
300 wdev->ick = NULL;
301 goto err_clk;
302 }
303 wdev->fck = clk_get(&pdev->dev, "fck");
304 if (IS_ERR(wdev->fck)) {
305 ret = PTR_ERR(wdev->fck);
306 wdev->fck = NULL;
307 goto err_clk;
308 }
309 293
310 wdev->base = ioremap(res->start, resource_size(res)); 294 wdev->base = ioremap(res->start, resource_size(res));
311 if (!wdev->base) { 295 if (!wdev->base) {
@@ -315,8 +299,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
315 299
316 platform_set_drvdata(pdev, wdev); 300 platform_set_drvdata(pdev, wdev);
317 301
318 clk_enable(wdev->ick); 302 pm_runtime_enable(wdev->dev);
319 clk_enable(wdev->fck); 303 pm_runtime_get_sync(wdev->dev);
320 304
321 omap_wdt_disable(wdev); 305 omap_wdt_disable(wdev);
322 omap_wdt_adjust_timeout(timer_margin); 306 omap_wdt_adjust_timeout(timer_margin);
@@ -334,11 +318,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
334 __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, 318 __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
335 timer_margin); 319 timer_margin);
336 320
337 /* autogate OCP interface clock */ 321 pm_runtime_put_sync(wdev->dev);
338 __raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
339
340 clk_disable(wdev->ick);
341 clk_disable(wdev->fck);
342 322
343 omap_wdt_dev = pdev; 323 omap_wdt_dev = pdev;
344 324
@@ -350,12 +330,6 @@ err_misc:
350 330
351err_ioremap: 331err_ioremap:
352 wdev->base = NULL; 332 wdev->base = NULL;
353
354err_clk:
355 if (wdev->ick)
356 clk_put(wdev->ick);
357 if (wdev->fck)
358 clk_put(wdev->fck);
359 kfree(wdev); 333 kfree(wdev);
360 334
361err_kzalloc: 335err_kzalloc:
@@ -387,8 +361,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)
387 release_mem_region(res->start, resource_size(res)); 361 release_mem_region(res->start, resource_size(res));
388 platform_set_drvdata(pdev, NULL); 362 platform_set_drvdata(pdev, NULL);
389 363
390 clk_put(wdev->ick);
391 clk_put(wdev->fck);
392 iounmap(wdev->base); 364 iounmap(wdev->base);
393 365
394 kfree(wdev); 366 kfree(wdev);