aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2009-01-19 15:44:33 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-08 12:50:16 -0500
commit39a80c7f379e1c1d3e63b204b8353b7381d0a3d5 (patch)
tree7e2b60598eac3d5aab46b1c6fcbf8511d2be9ee5 /drivers
parentf1c2543738d18e4398e3d6e27abff6676667975a (diff)
[ARM] omap: watchdog: convert clocks to match by devid and conid
This eliminates the need for separate OMAP24xx and OMAP34xx clock requesting code sections. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/watchdog/omap_wdt.c93
1 files changed, 25 insertions, 68 deletions
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 2f2ce7429f5b..1a4c699762e6 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,9 @@ 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 if (wdev->ick)
150 clk_enable(wdev->armwdt_ck); /* Enable the clock */ 149 clk_enable(wdev->ick); /* Enable the interface clock */
151 150 clk_enable(wdev->fck); /* Enable the functional clock */
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 151
157 /* initialize prescaler */ 152 /* initialize prescaler */
158 while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) 153 while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01)
@@ -181,13 +176,9 @@ static int omap_wdt_release(struct inode *inode, struct file *file)
181 176
182 omap_wdt_disable(wdev); 177 omap_wdt_disable(wdev);
183 178
184 if (cpu_is_omap16xx()) 179 if (wdev->ick)
185 clk_disable(wdev->armwdt_ck); /* Disable the clock */ 180 clk_disable(wdev->ick);
186 181 clk_disable(wdev->fck);
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 182#else
192 printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); 183 printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n");
193#endif 184#endif
@@ -303,44 +294,21 @@ static int __init omap_wdt_probe(struct platform_device *pdev)
303 wdev->omap_wdt_users = 0; 294 wdev->omap_wdt_users = 0;
304 wdev->mem = mem; 295 wdev->mem = mem;
305 296
306 if (cpu_is_omap16xx()) { 297 if (cpu_is_omap24xx() || cpu_is_omap34xx()) {
307 wdev->armwdt_ck = clk_get(&pdev->dev, "armwdt_ck"); 298 wdev->ick = clk_get(&pdev->dev, "ick");
308 if (IS_ERR(wdev->armwdt_ck)) { 299 if (IS_ERR(wdev->ick)) {
309 ret = PTR_ERR(wdev->armwdt_ck); 300 ret = PTR_ERR(wdev->ick);
310 wdev->armwdt_ck = NULL; 301 wdev->ick = NULL;
311 goto err_clk; 302 goto err_clk;
312 } 303 }
313 } 304 }
314 305 wdev->fck = clk_get(&pdev->dev, "fck");
315 if (cpu_is_omap24xx()) { 306 if (IS_ERR(wdev->fck)) {
316 wdev->mpu_wdt_ick = clk_get(&pdev->dev, "mpu_wdt_ick"); 307 ret = PTR_ERR(wdev->fck);
317 if (IS_ERR(wdev->mpu_wdt_ick)) { 308 wdev->fck = NULL;
318 ret = PTR_ERR(wdev->mpu_wdt_ick); 309 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 } 310 }
329 311
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); 312 wdev->base = ioremap(res->start, res->end - res->start + 1);
345 if (!wdev->base) { 313 if (!wdev->base) {
346 ret = -ENOMEM; 314 ret = -ENOMEM;
@@ -380,12 +348,10 @@ err_ioremap:
380 wdev->base = NULL; 348 wdev->base = NULL;
381 349
382err_clk: 350err_clk:
383 if (wdev->armwdt_ck) 351 if (wdev->ick)
384 clk_put(wdev->armwdt_ck); 352 clk_put(wdev->ick);
385 if (wdev->mpu_wdt_ick) 353 if (wdev->fck)
386 clk_put(wdev->mpu_wdt_ick); 354 clk_put(wdev->fck);
387 if (wdev->mpu_wdt_fck)
388 clk_put(wdev->mpu_wdt_fck);
389 kfree(wdev); 355 kfree(wdev);
390 356
391err_kzalloc: 357err_kzalloc:
@@ -417,20 +383,11 @@ static int omap_wdt_remove(struct platform_device *pdev)
417 release_mem_region(res->start, res->end - res->start + 1); 383 release_mem_region(res->start, res->end - res->start + 1);
418 platform_set_drvdata(pdev, NULL); 384 platform_set_drvdata(pdev, NULL);
419 385
420 if (wdev->armwdt_ck) { 386 if (wdev->ick) {
421 clk_put(wdev->armwdt_ck); 387 clk_put(wdev->ick);
422 wdev->armwdt_ck = NULL;
423 } 388 }
424 389
425 if (wdev->mpu_wdt_ick) { 390 clk_put(wdev->fck);
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); 391 iounmap(wdev->base);
435 392
436 kfree(wdev); 393 kfree(wdev);