aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorVaradarajan, Charulatha <charu@ti.com>2010-09-23 10:32:43 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-29 15:21:58 -0400
commit7ec5ad0f3c1e28b693185c35f768953c5db32291 (patch)
tree6e5ba4505e29957c42a3771512ea308760339b33 /drivers/watchdog
parentf2ce62312650211f6cf665cd6dc519c334c4071e (diff)
OMAP: WDT: Use PM runtime APIs instead of clk FW APIs
Call runtime pm APIs pm_runtime_put_sync() and pm_runtime_get_sync() for enabling/disabling the clocks, sysconfig settings instead of using clock FW APIs. Signed-off-by: Charulatha V <charu@ti.com> Acked-by: Cousson, Benoit <b-cousson@ti.com> Acked-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'drivers/watchdog')
-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 76b58abf4451..dbbc5801a0c3 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
@@ -292,19 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
292 288
293 wdev->omap_wdt_users = 0; 289 wdev->omap_wdt_users = 0;
294 wdev->mem = mem; 290 wdev->mem = mem;
295 291 wdev->dev = &pdev->dev;
296 wdev->ick = clk_get(&pdev->dev, "ick");
297 if (IS_ERR(wdev->ick)) {
298 ret = PTR_ERR(wdev->ick);
299 wdev->ick = NULL;
300 goto err_clk;
301 }
302 wdev->fck = clk_get(&pdev->dev, "fck");
303 if (IS_ERR(wdev->fck)) {
304 ret = PTR_ERR(wdev->fck);
305 wdev->fck = NULL;
306 goto err_clk;
307 }
308 292
309 wdev->base = ioremap(res->start, resource_size(res)); 293 wdev->base = ioremap(res->start, resource_size(res));
310 if (!wdev->base) { 294 if (!wdev->base) {
@@ -314,8 +298,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
314 298
315 platform_set_drvdata(pdev, wdev); 299 platform_set_drvdata(pdev, wdev);
316 300
317 clk_enable(wdev->ick); 301 pm_runtime_enable(wdev->dev);
318 clk_enable(wdev->fck); 302 pm_runtime_get_sync(wdev->dev);
319 303
320 omap_wdt_disable(wdev); 304 omap_wdt_disable(wdev);
321 omap_wdt_adjust_timeout(timer_margin); 305 omap_wdt_adjust_timeout(timer_margin);
@@ -333,11 +317,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
333 __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, 317 __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
334 timer_margin); 318 timer_margin);
335 319
336 /* autogate OCP interface clock */ 320 pm_runtime_put_sync(wdev->dev);
337 __raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
338
339 clk_disable(wdev->ick);
340 clk_disable(wdev->fck);
341 321
342 omap_wdt_dev = pdev; 322 omap_wdt_dev = pdev;
343 323
@@ -349,12 +329,6 @@ err_misc:
349 329
350err_ioremap: 330err_ioremap:
351 wdev->base = NULL; 331 wdev->base = NULL;
352
353err_clk:
354 if (wdev->ick)
355 clk_put(wdev->ick);
356 if (wdev->fck)
357 clk_put(wdev->fck);
358 kfree(wdev); 332 kfree(wdev);
359 333
360err_kzalloc: 334err_kzalloc:
@@ -386,8 +360,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)
386 release_mem_region(res->start, resource_size(res)); 360 release_mem_region(res->start, resource_size(res));
387 platform_set_drvdata(pdev, NULL); 361 platform_set_drvdata(pdev, NULL);
388 362
389 clk_put(wdev->ick);
390 clk_put(wdev->fck);
391 iounmap(wdev->base); 363 iounmap(wdev->base);
392 364
393 kfree(wdev); 365 kfree(wdev);