aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/s3c2410-rtc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/s3c2410-rtc.c')
-rw-r--r--drivers/char/s3c2410-rtc.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/drivers/char/s3c2410-rtc.c b/drivers/char/s3c2410-rtc.c
index d724c0de4f28..3df7a574267b 100644
--- a/drivers/char/s3c2410-rtc.c
+++ b/drivers/char/s3c2410-rtc.c
@@ -382,7 +382,7 @@ static struct rtc_ops s3c2410_rtcops = {
382 .proc = s3c2410_rtc_proc, 382 .proc = s3c2410_rtc_proc,
383}; 383};
384 384
385static void s3c2410_rtc_enable(struct device *dev, int en) 385static void s3c2410_rtc_enable(struct platform_device *pdev, int en)
386{ 386{
387 unsigned int tmp; 387 unsigned int tmp;
388 388
@@ -399,21 +399,21 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
399 /* re-enable the device, and check it is ok */ 399 /* re-enable the device, and check it is ok */
400 400
401 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){ 401 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0){
402 dev_info(dev, "rtc disabled, re-enabling\n"); 402 dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
403 403
404 tmp = readb(S3C2410_RTCCON); 404 tmp = readb(S3C2410_RTCCON);
405 writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON); 405 writeb(tmp | S3C2410_RTCCON_RTCEN , S3C2410_RTCCON);
406 } 406 }
407 407
408 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){ 408 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)){
409 dev_info(dev, "removing S3C2410_RTCCON_CNTSEL\n"); 409 dev_info(&pdev->dev, "removing S3C2410_RTCCON_CNTSEL\n");
410 410
411 tmp = readb(S3C2410_RTCCON); 411 tmp = readb(S3C2410_RTCCON);
412 writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON); 412 writeb(tmp& ~S3C2410_RTCCON_CNTSEL , S3C2410_RTCCON);
413 } 413 }
414 414
415 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){ 415 if ((readb(S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)){
416 dev_info(dev, "removing S3C2410_RTCCON_CLKRST\n"); 416 dev_info(&pdev->dev, "removing S3C2410_RTCCON_CLKRST\n");
417 417
418 tmp = readb(S3C2410_RTCCON); 418 tmp = readb(S3C2410_RTCCON);
419 writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON); 419 writeb(tmp & ~S3C2410_RTCCON_CLKRST, S3C2410_RTCCON);
@@ -421,7 +421,7 @@ static void s3c2410_rtc_enable(struct device *dev, int en)
421 } 421 }
422} 422}
423 423
424static int s3c2410_rtc_remove(struct device *dev) 424static int s3c2410_rtc_remove(struct platform_device *dev)
425{ 425{
426 unregister_rtc(&s3c2410_rtcops); 426 unregister_rtc(&s3c2410_rtcops);
427 427
@@ -438,25 +438,24 @@ static int s3c2410_rtc_remove(struct device *dev)
438 return 0; 438 return 0;
439} 439}
440 440
441static int s3c2410_rtc_probe(struct device *dev) 441static int s3c2410_rtc_probe(struct platform_device *pdev)
442{ 442{
443 struct platform_device *pdev = to_platform_device(dev);
444 struct resource *res; 443 struct resource *res;
445 int ret; 444 int ret;
446 445
447 pr_debug("%s: probe=%p, device=%p\n", __FUNCTION__, pdev, dev); 446 pr_debug("%s: probe=%p\n", __FUNCTION__, pdev);
448 447
449 /* find the IRQs */ 448 /* find the IRQs */
450 449
451 s3c2410_rtc_tickno = platform_get_irq(pdev, 1); 450 s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
452 if (s3c2410_rtc_tickno <= 0) { 451 if (s3c2410_rtc_tickno <= 0) {
453 dev_err(dev, "no irq for rtc tick\n"); 452 dev_err(&pdev->dev, "no irq for rtc tick\n");
454 return -ENOENT; 453 return -ENOENT;
455 } 454 }
456 455
457 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0); 456 s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
458 if (s3c2410_rtc_alarmno <= 0) { 457 if (s3c2410_rtc_alarmno <= 0) {
459 dev_err(dev, "no irq for alarm\n"); 458 dev_err(&pdev->dev, "no irq for alarm\n");
460 return -ENOENT; 459 return -ENOENT;
461 } 460 }
462 461
@@ -467,7 +466,7 @@ static int s3c2410_rtc_probe(struct device *dev)
467 466
468 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 467 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
469 if (res == NULL) { 468 if (res == NULL) {
470 dev_err(dev, "failed to get memory region resource\n"); 469 dev_err(&pdev->dev, "failed to get memory region resource\n");
471 return -ENOENT; 470 return -ENOENT;
472 } 471 }
473 472
@@ -475,14 +474,14 @@ static int s3c2410_rtc_probe(struct device *dev)
475 pdev->name); 474 pdev->name);
476 475
477 if (s3c2410_rtc_mem == NULL) { 476 if (s3c2410_rtc_mem == NULL) {
478 dev_err(dev, "failed to reserve memory region\n"); 477 dev_err(&pdev->dev, "failed to reserve memory region\n");
479 ret = -ENOENT; 478 ret = -ENOENT;
480 goto exit_err; 479 goto exit_err;
481 } 480 }
482 481
483 s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1); 482 s3c2410_rtc_base = ioremap(res->start, res->end - res->start + 1);
484 if (s3c2410_rtc_base == NULL) { 483 if (s3c2410_rtc_base == NULL) {
485 dev_err(dev, "failed ioremap()\n"); 484 dev_err(&pdev->dev, "failed ioremap()\n");
486 ret = -EINVAL; 485 ret = -EINVAL;
487 goto exit_err; 486 goto exit_err;
488 } 487 }
@@ -494,7 +493,7 @@ static int s3c2410_rtc_probe(struct device *dev)
494 493
495 /* check to see if everything is setup correctly */ 494 /* check to see if everything is setup correctly */
496 495
497 s3c2410_rtc_enable(dev, 1); 496 s3c2410_rtc_enable(pdev, 1);
498 497
499 pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON)); 498 pr_debug("s3c2410_rtc: RTCCON=%02x\n", readb(S3C2410_RTCCON));
500 499
@@ -506,7 +505,7 @@ static int s3c2410_rtc_probe(struct device *dev)
506 return 0; 505 return 0;
507 506
508 exit_err: 507 exit_err:
509 dev_err(dev, "error %d during initialisation\n", ret); 508 dev_err(&pdev->dev, "error %d during initialisation\n", ret);
510 509
511 return ret; 510 return ret;
512} 511}
@@ -519,7 +518,7 @@ static struct timespec s3c2410_rtc_delta;
519 518
520static int ticnt_save; 519static int ticnt_save;
521 520
522static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state) 521static int s3c2410_rtc_suspend(struct platform_device *pdev, pm_message_t state)
523{ 522{
524 struct rtc_time tm; 523 struct rtc_time tm;
525 struct timespec time; 524 struct timespec time;
@@ -535,19 +534,19 @@ static int s3c2410_rtc_suspend(struct device *dev, pm_message_t state)
535 s3c2410_rtc_gettime(&tm); 534 s3c2410_rtc_gettime(&tm);
536 rtc_tm_to_time(&tm, &time.tv_sec); 535 rtc_tm_to_time(&tm, &time.tv_sec);
537 save_time_delta(&s3c2410_rtc_delta, &time); 536 save_time_delta(&s3c2410_rtc_delta, &time);
538 s3c2410_rtc_enable(dev, 0); 537 s3c2410_rtc_enable(pdev, 0);
539 538
540 return 0; 539 return 0;
541} 540}
542 541
543static int s3c2410_rtc_resume(struct device *dev) 542static int s3c2410_rtc_resume(struct platform_device *pdev)
544{ 543{
545 struct rtc_time tm; 544 struct rtc_time tm;
546 struct timespec time; 545 struct timespec time;
547 546
548 time.tv_nsec = 0; 547 time.tv_nsec = 0;
549 548
550 s3c2410_rtc_enable(dev, 1); 549 s3c2410_rtc_enable(pdev, 1);
551 s3c2410_rtc_gettime(&tm); 550 s3c2410_rtc_gettime(&tm);
552 rtc_tm_to_time(&tm, &time.tv_sec); 551 rtc_tm_to_time(&tm, &time.tv_sec);
553 restore_time_delta(&s3c2410_rtc_delta, &time); 552 restore_time_delta(&s3c2410_rtc_delta, &time);
@@ -560,14 +559,15 @@ static int s3c2410_rtc_resume(struct device *dev)
560#define s3c2410_rtc_resume NULL 559#define s3c2410_rtc_resume NULL
561#endif 560#endif
562 561
563static struct device_driver s3c2410_rtcdrv = { 562static struct platform_driver s3c2410_rtcdrv = {
564 .name = "s3c2410-rtc",
565 .owner = THIS_MODULE,
566 .bus = &platform_bus_type,
567 .probe = s3c2410_rtc_probe, 563 .probe = s3c2410_rtc_probe,
568 .remove = s3c2410_rtc_remove, 564 .remove = s3c2410_rtc_remove,
569 .suspend = s3c2410_rtc_suspend, 565 .suspend = s3c2410_rtc_suspend,
570 .resume = s3c2410_rtc_resume, 566 .resume = s3c2410_rtc_resume,
567 .driver = {
568 .name = "s3c2410-rtc",
569 .owner = THIS_MODULE,
570 },
571}; 571};
572 572
573static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n"; 573static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
@@ -575,12 +575,12 @@ static char __initdata banner[] = "S3C2410 RTC, (c) 2004 Simtec Electronics\n";
575static int __init s3c2410_rtc_init(void) 575static int __init s3c2410_rtc_init(void)
576{ 576{
577 printk(banner); 577 printk(banner);
578 return driver_register(&s3c2410_rtcdrv); 578 return platform_driver_register(&s3c2410_rtcdrv);
579} 579}
580 580
581static void __exit s3c2410_rtc_exit(void) 581static void __exit s3c2410_rtc_exit(void)
582{ 582{
583 driver_unregister(&s3c2410_rtcdrv); 583 platform_driver_unregister(&s3c2410_rtcdrv);
584} 584}
585 585
586module_init(s3c2410_rtc_init); 586module_init(s3c2410_rtc_init);