diff options
Diffstat (limited to 'drivers/char/watchdog/s3c2410_wdt.c')
-rw-r--r-- | drivers/char/watchdog/s3c2410_wdt.c | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/drivers/char/watchdog/s3c2410_wdt.c b/drivers/char/watchdog/s3c2410_wdt.c index 3625b2601b42..eb667daee19b 100644 --- a/drivers/char/watchdog/s3c2410_wdt.c +++ b/drivers/char/watchdog/s3c2410_wdt.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <linux/watchdog.h> | 44 | #include <linux/watchdog.h> |
45 | #include <linux/fs.h> | 45 | #include <linux/fs.h> |
46 | #include <linux/init.h> | 46 | #include <linux/init.h> |
47 | #include <linux/device.h> | 47 | #include <linux/platform_device.h> |
48 | #include <linux/interrupt.h> | 48 | #include <linux/interrupt.h> |
49 | 49 | ||
50 | #include <asm/uaccess.h> | 50 | #include <asm/uaccess.h> |
@@ -347,15 +347,14 @@ static irqreturn_t s3c2410wdt_irq(int irqno, void *param, | |||
347 | } | 347 | } |
348 | /* device interface */ | 348 | /* device interface */ |
349 | 349 | ||
350 | static int s3c2410wdt_probe(struct device *dev) | 350 | static int s3c2410wdt_probe(struct platform_device *pdev) |
351 | { | 351 | { |
352 | struct platform_device *pdev = to_platform_device(dev); | ||
353 | struct resource *res; | 352 | struct resource *res; |
354 | int started = 0; | 353 | int started = 0; |
355 | int ret; | 354 | int ret; |
356 | int size; | 355 | int size; |
357 | 356 | ||
358 | DBG("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); | 357 | DBG("%s: probe=%p\n", __FUNCTION__, pdev); |
359 | 358 | ||
360 | /* get the memory region for the watchdog timer */ | 359 | /* get the memory region for the watchdog timer */ |
361 | 360 | ||
@@ -386,13 +385,13 @@ static int s3c2410wdt_probe(struct device *dev) | |||
386 | return -ENOENT; | 385 | return -ENOENT; |
387 | } | 386 | } |
388 | 387 | ||
389 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, dev); | 388 | ret = request_irq(res->start, s3c2410wdt_irq, 0, pdev->name, pdev); |
390 | if (ret != 0) { | 389 | if (ret != 0) { |
391 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); | 390 | printk(KERN_INFO PFX "failed to install irq (%d)\n", ret); |
392 | return ret; | 391 | return ret; |
393 | } | 392 | } |
394 | 393 | ||
395 | wdt_clock = clk_get(dev, "watchdog"); | 394 | wdt_clock = clk_get(&pdev->dev, "watchdog"); |
396 | if (wdt_clock == NULL) { | 395 | if (wdt_clock == NULL) { |
397 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); | 396 | printk(KERN_INFO PFX "failed to find watchdog clock source\n"); |
398 | return -ENOENT; | 397 | return -ENOENT; |
@@ -430,7 +429,7 @@ static int s3c2410wdt_probe(struct device *dev) | |||
430 | return 0; | 429 | return 0; |
431 | } | 430 | } |
432 | 431 | ||
433 | static int s3c2410wdt_remove(struct device *dev) | 432 | static int s3c2410wdt_remove(struct platform_device *dev) |
434 | { | 433 | { |
435 | if (wdt_mem != NULL) { | 434 | if (wdt_mem != NULL) { |
436 | release_resource(wdt_mem); | 435 | release_resource(wdt_mem); |
@@ -454,7 +453,7 @@ static int s3c2410wdt_remove(struct device *dev) | |||
454 | return 0; | 453 | return 0; |
455 | } | 454 | } |
456 | 455 | ||
457 | static void s3c2410wdt_shutdown(struct device *dev) | 456 | static void s3c2410wdt_shutdown(struct platform_device *dev) |
458 | { | 457 | { |
459 | s3c2410wdt_stop(); | 458 | s3c2410wdt_stop(); |
460 | } | 459 | } |
@@ -464,32 +463,28 @@ static void s3c2410wdt_shutdown(struct device *dev) | |||
464 | static unsigned long wtcon_save; | 463 | static unsigned long wtcon_save; |
465 | static unsigned long wtdat_save; | 464 | static unsigned long wtdat_save; |
466 | 465 | ||
467 | static int s3c2410wdt_suspend(struct device *dev, pm_message_t state, u32 level) | 466 | static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) |
468 | { | 467 | { |
469 | if (level == SUSPEND_POWER_DOWN) { | 468 | /* Save watchdog state, and turn it off. */ |
470 | /* Save watchdog state, and turn it off. */ | 469 | wtcon_save = readl(wdt_base + S3C2410_WTCON); |
471 | wtcon_save = readl(wdt_base + S3C2410_WTCON); | 470 | wtdat_save = readl(wdt_base + S3C2410_WTDAT); |
472 | wtdat_save = readl(wdt_base + S3C2410_WTDAT); | ||
473 | 471 | ||
474 | /* Note that WTCNT doesn't need to be saved. */ | 472 | /* Note that WTCNT doesn't need to be saved. */ |
475 | s3c2410wdt_stop(); | 473 | s3c2410wdt_stop(); |
476 | } | ||
477 | 474 | ||
478 | return 0; | 475 | return 0; |
479 | } | 476 | } |
480 | 477 | ||
481 | static int s3c2410wdt_resume(struct device *dev, u32 level) | 478 | static int s3c2410wdt_resume(struct platform_device *dev) |
482 | { | 479 | { |
483 | if (level == RESUME_POWER_ON) { | 480 | /* Restore watchdog state. */ |
484 | /* Restore watchdog state. */ | ||
485 | 481 | ||
486 | writel(wtdat_save, wdt_base + S3C2410_WTDAT); | 482 | writel(wtdat_save, wdt_base + S3C2410_WTDAT); |
487 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ | 483 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ |
488 | writel(wtcon_save, wdt_base + S3C2410_WTCON); | 484 | writel(wtcon_save, wdt_base + S3C2410_WTCON); |
489 | 485 | ||
490 | printk(KERN_INFO PFX "watchdog %sabled\n", | 486 | printk(KERN_INFO PFX "watchdog %sabled\n", |
491 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); | 487 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); |
492 | } | ||
493 | 488 | ||
494 | return 0; | 489 | return 0; |
495 | } | 490 | } |
@@ -500,14 +495,16 @@ static int s3c2410wdt_resume(struct device *dev, u32 level) | |||
500 | #endif /* CONFIG_PM */ | 495 | #endif /* CONFIG_PM */ |
501 | 496 | ||
502 | 497 | ||
503 | static struct device_driver s3c2410wdt_driver = { | 498 | static struct platform_driver s3c2410wdt_driver = { |
504 | .name = "s3c2410-wdt", | ||
505 | .bus = &platform_bus_type, | ||
506 | .probe = s3c2410wdt_probe, | 499 | .probe = s3c2410wdt_probe, |
507 | .remove = s3c2410wdt_remove, | 500 | .remove = s3c2410wdt_remove, |
508 | .shutdown = s3c2410wdt_shutdown, | 501 | .shutdown = s3c2410wdt_shutdown, |
509 | .suspend = s3c2410wdt_suspend, | 502 | .suspend = s3c2410wdt_suspend, |
510 | .resume = s3c2410wdt_resume, | 503 | .resume = s3c2410wdt_resume, |
504 | .driver = { | ||
505 | .owner = THIS_MODULE, | ||
506 | .name = "s3c2410-wdt", | ||
507 | }, | ||
511 | }; | 508 | }; |
512 | 509 | ||
513 | 510 | ||
@@ -516,12 +513,12 @@ static char banner[] __initdata = KERN_INFO "S3C2410 Watchdog Timer, (c) 2004 Si | |||
516 | static int __init watchdog_init(void) | 513 | static int __init watchdog_init(void) |
517 | { | 514 | { |
518 | printk(banner); | 515 | printk(banner); |
519 | return driver_register(&s3c2410wdt_driver); | 516 | return platform_driver_register(&s3c2410wdt_driver); |
520 | } | 517 | } |
521 | 518 | ||
522 | static void __exit watchdog_exit(void) | 519 | static void __exit watchdog_exit(void) |
523 | { | 520 | { |
524 | driver_unregister(&s3c2410wdt_driver); | 521 | platform_driver_unregister(&s3c2410wdt_driver); |
525 | } | 522 | } |
526 | 523 | ||
527 | module_init(watchdog_init); | 524 | module_init(watchdog_init); |