diff options
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 5b979d9cc332..aef40bd2957b 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/clk.h> | 25 | #include <linux/clk.h> |
| 26 | #include <linux/log2.h> | 26 | #include <linux/log2.h> |
| 27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
| 28 | #include <linux/of.h> | ||
| 28 | 29 | ||
| 29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
| 30 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
| @@ -507,7 +508,13 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 507 | goto err_nortc; | 508 | goto err_nortc; |
| 508 | } | 509 | } |
| 509 | 510 | ||
| 510 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | 511 | #ifdef CONFIG_OF |
| 512 | if (pdev->dev.of_node) | ||
| 513 | s3c_rtc_cpu_type = of_device_is_compatible(pdev->dev.of_node, | ||
| 514 | "samsung,s3c6410-rtc") ? TYPE_S3C64XX : TYPE_S3C2410; | ||
| 515 | else | ||
| 516 | #endif | ||
| 517 | s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data; | ||
| 511 | 518 | ||
| 512 | /* Check RTC Time */ | 519 | /* Check RTC Time */ |
| 513 | 520 | ||
| @@ -629,6 +636,17 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
| 629 | #define s3c_rtc_resume NULL | 636 | #define s3c_rtc_resume NULL |
| 630 | #endif | 637 | #endif |
| 631 | 638 | ||
| 639 | #ifdef CONFIG_OF | ||
| 640 | static const struct of_device_id s3c_rtc_dt_match[] = { | ||
| 641 | { .compatible = "samsung,s3c2410-rtc" }, | ||
| 642 | { .compatible = "samsung,s3c6410-rtc" }, | ||
| 643 | {}, | ||
| 644 | }; | ||
| 645 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); | ||
| 646 | #else | ||
| 647 | #define s3c_rtc_dt_match NULL | ||
| 648 | #endif | ||
| 649 | |||
| 632 | static struct platform_device_id s3c_rtc_driver_ids[] = { | 650 | static struct platform_device_id s3c_rtc_driver_ids[] = { |
| 633 | { | 651 | { |
| 634 | .name = "s3c2410-rtc", | 652 | .name = "s3c2410-rtc", |
| @@ -651,24 +669,11 @@ static struct platform_driver s3c_rtc_driver = { | |||
| 651 | .driver = { | 669 | .driver = { |
| 652 | .name = "s3c-rtc", | 670 | .name = "s3c-rtc", |
| 653 | .owner = THIS_MODULE, | 671 | .owner = THIS_MODULE, |
| 672 | .of_match_table = s3c_rtc_dt_match, | ||
| 654 | }, | 673 | }, |
| 655 | }; | 674 | }; |
| 656 | 675 | ||
| 657 | static char __initdata banner[] = "S3C24XX RTC, (c) 2004,2006 Simtec Electronics\n"; | 676 | module_platform_driver(s3c_rtc_driver); |
| 658 | |||
| 659 | static int __init s3c_rtc_init(void) | ||
| 660 | { | ||
| 661 | printk(banner); | ||
| 662 | return platform_driver_register(&s3c_rtc_driver); | ||
| 663 | } | ||
| 664 | |||
| 665 | static void __exit s3c_rtc_exit(void) | ||
| 666 | { | ||
| 667 | platform_driver_unregister(&s3c_rtc_driver); | ||
| 668 | } | ||
| 669 | |||
| 670 | module_init(s3c_rtc_init); | ||
| 671 | module_exit(s3c_rtc_exit); | ||
| 672 | 677 | ||
| 673 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); | 678 | MODULE_DESCRIPTION("Samsung S3C RTC Driver"); |
| 674 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); | 679 | MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); |
