diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-03-19 08:39:58 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-03-19 08:39:58 -0400 |
commit | 14b6848bc0134b8838d374c423df3edda9b1490e (patch) | |
tree | 724dc912efe84f432d33a798502811c5f5295774 /drivers/watchdog | |
parent | 05d9881bc4c6f172997b7a59e4a1a95910c4ebd7 (diff) | |
parent | 4da3782151300237db3abe070f716922889252e0 (diff) |
Merge branch 'omap-clks3' into devel
Conflicts:
arch/arm/mach-omap2/clock.c
Diffstat (limited to 'drivers/watchdog')
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 94 |
1 files changed, 22 insertions, 72 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 2f2ce7429f5b..aa5ad6e33f02 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -60,9 +60,8 @@ struct omap_wdt_dev { | |||
60 | void __iomem *base; /* physical */ | 60 | void __iomem *base; /* physical */ |
61 | struct device *dev; | 61 | struct device *dev; |
62 | int omap_wdt_users; | 62 | int omap_wdt_users; |
63 | struct clk *armwdt_ck; | 63 | struct clk *ick; |
64 | struct clk *mpu_wdt_ick; | 64 | struct clk *fck; |
65 | struct clk *mpu_wdt_fck; | ||
66 | struct resource *mem; | 65 | struct resource *mem; |
67 | struct miscdevice omap_wdt_miscdev; | 66 | struct miscdevice omap_wdt_miscdev; |
68 | }; | 67 | }; |
@@ -146,13 +145,8 @@ static int omap_wdt_open(struct inode *inode, struct file *file) | |||
146 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) | 145 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) |
147 | return -EBUSY; | 146 | return -EBUSY; |
148 | 147 | ||
149 | if (cpu_is_omap16xx()) | 148 | clk_enable(wdev->ick); /* Enable the interface clock */ |
150 | clk_enable(wdev->armwdt_ck); /* Enable the clock */ | 149 | clk_enable(wdev->fck); /* Enable the functional clock */ |
151 | |||
152 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | ||
153 | clk_enable(wdev->mpu_wdt_ick); /* Enable the interface clock */ | ||
154 | clk_enable(wdev->mpu_wdt_fck); /* Enable the functional clock */ | ||
155 | } | ||
156 | 150 | ||
157 | /* initialize prescaler */ | 151 | /* initialize prescaler */ |
158 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) | 152 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) |
@@ -181,13 +175,8 @@ static int omap_wdt_release(struct inode *inode, struct file *file) | |||
181 | 175 | ||
182 | omap_wdt_disable(wdev); | 176 | omap_wdt_disable(wdev); |
183 | 177 | ||
184 | if (cpu_is_omap16xx()) | 178 | clk_disable(wdev->ick); |
185 | clk_disable(wdev->armwdt_ck); /* Disable the clock */ | 179 | clk_disable(wdev->fck); |
186 | |||
187 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | ||
188 | clk_disable(wdev->mpu_wdt_ick); /* Disable the clock */ | ||
189 | clk_disable(wdev->mpu_wdt_fck); /* Disable the clock */ | ||
190 | } | ||
191 | #else | 180 | #else |
192 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); | 181 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); |
193 | #endif | 182 | #endif |
@@ -303,44 +292,19 @@ static int __init omap_wdt_probe(struct platform_device *pdev) | |||
303 | wdev->omap_wdt_users = 0; | 292 | wdev->omap_wdt_users = 0; |
304 | wdev->mem = mem; | 293 | wdev->mem = mem; |
305 | 294 | ||
306 | if (cpu_is_omap16xx()) { | 295 | wdev->ick = clk_get(&pdev->dev, "ick"); |
307 | wdev->armwdt_ck = clk_get(&pdev->dev, "armwdt_ck"); | 296 | if (IS_ERR(wdev->ick)) { |
308 | if (IS_ERR(wdev->armwdt_ck)) { | 297 | ret = PTR_ERR(wdev->ick); |
309 | ret = PTR_ERR(wdev->armwdt_ck); | 298 | wdev->ick = NULL; |
310 | wdev->armwdt_ck = NULL; | 299 | goto err_clk; |
311 | goto err_clk; | ||
312 | } | ||
313 | } | 300 | } |
314 | 301 | wdev->fck = clk_get(&pdev->dev, "fck"); | |
315 | if (cpu_is_omap24xx()) { | 302 | if (IS_ERR(wdev->fck)) { |
316 | wdev->mpu_wdt_ick = clk_get(&pdev->dev, "mpu_wdt_ick"); | 303 | ret = PTR_ERR(wdev->fck); |
317 | if (IS_ERR(wdev->mpu_wdt_ick)) { | 304 | wdev->fck = NULL; |
318 | ret = PTR_ERR(wdev->mpu_wdt_ick); | 305 | goto err_clk; |
319 | wdev->mpu_wdt_ick = NULL; | ||
320 | goto err_clk; | ||
321 | } | ||
322 | wdev->mpu_wdt_fck = clk_get(&pdev->dev, "mpu_wdt_fck"); | ||
323 | if (IS_ERR(wdev->mpu_wdt_fck)) { | ||
324 | ret = PTR_ERR(wdev->mpu_wdt_fck); | ||
325 | wdev->mpu_wdt_fck = NULL; | ||
326 | goto err_clk; | ||
327 | } | ||
328 | } | 306 | } |
329 | 307 | ||
330 | if (cpu_is_omap34xx()) { | ||
331 | wdev->mpu_wdt_ick = clk_get(&pdev->dev, "wdt2_ick"); | ||
332 | if (IS_ERR(wdev->mpu_wdt_ick)) { | ||
333 | ret = PTR_ERR(wdev->mpu_wdt_ick); | ||
334 | wdev->mpu_wdt_ick = NULL; | ||
335 | goto err_clk; | ||
336 | } | ||
337 | wdev->mpu_wdt_fck = clk_get(&pdev->dev, "wdt2_fck"); | ||
338 | if (IS_ERR(wdev->mpu_wdt_fck)) { | ||
339 | ret = PTR_ERR(wdev->mpu_wdt_fck); | ||
340 | wdev->mpu_wdt_fck = NULL; | ||
341 | goto err_clk; | ||
342 | } | ||
343 | } | ||
344 | wdev->base = ioremap(res->start, res->end - res->start + 1); | 308 | wdev->base = ioremap(res->start, res->end - res->start + 1); |
345 | if (!wdev->base) { | 309 | if (!wdev->base) { |
346 | ret = -ENOMEM; | 310 | ret = -ENOMEM; |
@@ -380,12 +344,10 @@ err_ioremap: | |||
380 | wdev->base = NULL; | 344 | wdev->base = NULL; |
381 | 345 | ||
382 | err_clk: | 346 | err_clk: |
383 | if (wdev->armwdt_ck) | 347 | if (wdev->ick) |
384 | clk_put(wdev->armwdt_ck); | 348 | clk_put(wdev->ick); |
385 | if (wdev->mpu_wdt_ick) | 349 | if (wdev->fck) |
386 | clk_put(wdev->mpu_wdt_ick); | 350 | clk_put(wdev->fck); |
387 | if (wdev->mpu_wdt_fck) | ||
388 | clk_put(wdev->mpu_wdt_fck); | ||
389 | kfree(wdev); | 351 | kfree(wdev); |
390 | 352 | ||
391 | err_kzalloc: | 353 | err_kzalloc: |
@@ -417,20 +379,8 @@ static int omap_wdt_remove(struct platform_device *pdev) | |||
417 | release_mem_region(res->start, res->end - res->start + 1); | 379 | release_mem_region(res->start, res->end - res->start + 1); |
418 | platform_set_drvdata(pdev, NULL); | 380 | platform_set_drvdata(pdev, NULL); |
419 | 381 | ||
420 | if (wdev->armwdt_ck) { | 382 | clk_put(wdev->ick); |
421 | clk_put(wdev->armwdt_ck); | 383 | clk_put(wdev->fck); |
422 | wdev->armwdt_ck = NULL; | ||
423 | } | ||
424 | |||
425 | if (wdev->mpu_wdt_ick) { | ||
426 | clk_put(wdev->mpu_wdt_ick); | ||
427 | wdev->mpu_wdt_ick = NULL; | ||
428 | } | ||
429 | |||
430 | if (wdev->mpu_wdt_fck) { | ||
431 | clk_put(wdev->mpu_wdt_fck); | ||
432 | wdev->mpu_wdt_fck = NULL; | ||
433 | } | ||
434 | iounmap(wdev->base); | 384 | iounmap(wdev->base); |
435 | 385 | ||
436 | kfree(wdev); | 386 | kfree(wdev); |