提交 7ec5ad0f 编写于 作者: V Varadarajan, Charulatha 提交者: Kevin Hilman

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: NCharulatha V <charu@ti.com>
Acked-by: NCousson, Benoit <b-cousson@ti.com>
Acked-by: NWim Van Sebroeck <wim@iguana.be>
Signed-off-by: NKevin Hilman <khilman@deeprootsystems.com>
上级 f2ce6231
...@@ -38,11 +38,11 @@ ...@@ -38,11 +38,11 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/clk.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <mach/hardware.h> #include <mach/hardware.h>
#include <plat/prcm.h> #include <plat/prcm.h>
...@@ -61,8 +61,6 @@ struct omap_wdt_dev { ...@@ -61,8 +61,6 @@ struct omap_wdt_dev {
void __iomem *base; /* physical */ void __iomem *base; /* physical */
struct device *dev; struct device *dev;
int omap_wdt_users; int omap_wdt_users;
struct clk *ick;
struct clk *fck;
struct resource *mem; struct resource *mem;
struct miscdevice omap_wdt_miscdev; struct miscdevice omap_wdt_miscdev;
}; };
...@@ -146,8 +144,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file) ...@@ -146,8 +144,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file)
if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users)))
return -EBUSY; return -EBUSY;
clk_enable(wdev->ick); /* Enable the interface clock */ pm_runtime_get_sync(wdev->dev);
clk_enable(wdev->fck); /* Enable the functional clock */
/* initialize prescaler */ /* initialize prescaler */
while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01)
...@@ -177,8 +174,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file) ...@@ -177,8 +174,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file)
omap_wdt_disable(wdev); omap_wdt_disable(wdev);
clk_disable(wdev->ick); pm_runtime_put_sync(wdev->dev);
clk_disable(wdev->fck);
#else #else
printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n");
#endif #endif
...@@ -292,19 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -292,19 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
wdev->omap_wdt_users = 0; wdev->omap_wdt_users = 0;
wdev->mem = mem; wdev->mem = mem;
wdev->dev = &pdev->dev;
wdev->ick = clk_get(&pdev->dev, "ick");
if (IS_ERR(wdev->ick)) {
ret = PTR_ERR(wdev->ick);
wdev->ick = NULL;
goto err_clk;
}
wdev->fck = clk_get(&pdev->dev, "fck");
if (IS_ERR(wdev->fck)) {
ret = PTR_ERR(wdev->fck);
wdev->fck = NULL;
goto err_clk;
}
wdev->base = ioremap(res->start, resource_size(res)); wdev->base = ioremap(res->start, resource_size(res));
if (!wdev->base) { if (!wdev->base) {
...@@ -314,8 +298,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -314,8 +298,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, wdev); platform_set_drvdata(pdev, wdev);
clk_enable(wdev->ick); pm_runtime_enable(wdev->dev);
clk_enable(wdev->fck); pm_runtime_get_sync(wdev->dev);
omap_wdt_disable(wdev); omap_wdt_disable(wdev);
omap_wdt_adjust_timeout(timer_margin); omap_wdt_adjust_timeout(timer_margin);
...@@ -333,11 +317,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -333,11 +317,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
__raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
timer_margin); timer_margin);
/* autogate OCP interface clock */ pm_runtime_put_sync(wdev->dev);
__raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG);
clk_disable(wdev->ick);
clk_disable(wdev->fck);
omap_wdt_dev = pdev; omap_wdt_dev = pdev;
...@@ -349,12 +329,6 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) ...@@ -349,12 +329,6 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev)
err_ioremap: err_ioremap:
wdev->base = NULL; wdev->base = NULL;
err_clk:
if (wdev->ick)
clk_put(wdev->ick);
if (wdev->fck)
clk_put(wdev->fck);
kfree(wdev); kfree(wdev);
err_kzalloc: err_kzalloc:
...@@ -386,8 +360,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev) ...@@ -386,8 +360,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev)
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
clk_put(wdev->ick);
clk_put(wdev->fck);
iounmap(wdev->base); iounmap(wdev->base);
kfree(wdev); kfree(wdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册