diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index aef40bd2957b..a6f95fb74dd2 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -428,6 +428,20 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
| 428 | return 0; | 428 | return 0; |
| 429 | } | 429 | } |
| 430 | 430 | ||
| 431 | static const struct of_device_id s3c_rtc_dt_match[]; | ||
| 432 | |||
| 433 | static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) | ||
| 434 | { | ||
| 435 | #ifdef CONFIG_OF | ||
| 436 | if (pdev->dev.of_node) { | ||
| 437 | const struct of_device_id *match; | ||
| 438 | match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); | ||
| 439 | return match->data; | ||
| 440 | } | ||
| 441 | #endif | ||
| 442 | return platform_get_device_id(pdev)->driver_data; | ||
| 443 | } | ||
| 444 | |||
| 431 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) | 445 | static int __devinit s3c_rtc_probe(struct platform_device *pdev) |
| 432 | { | 446 | { |
| 433 | struct rtc_device *rtc; | 447 | struct rtc_device *rtc; |
| @@ -508,13 +522,7 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) | |||
| 508 | goto err_nortc; | 522 | goto err_nortc; |
| 509 | } | 523 | } |
| 510 | 524 | ||
| 511 | #ifdef CONFIG_OF | 525 | s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev); |
| 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; | ||
| 518 | 526 | ||
| 519 | /* Check RTC Time */ | 527 | /* Check RTC Time */ |
| 520 | 528 | ||
| @@ -638,8 +646,13 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
| 638 | 646 | ||
| 639 | #ifdef CONFIG_OF | 647 | #ifdef CONFIG_OF |
| 640 | static const struct of_device_id s3c_rtc_dt_match[] = { | 648 | static const struct of_device_id s3c_rtc_dt_match[] = { |
| 641 | { .compatible = "samsung,s3c2410-rtc" }, | 649 | { |
| 642 | { .compatible = "samsung,s3c6410-rtc" }, | 650 | .compatible = "samsung,s3c2410-rtc" |
| 651 | .data = TYPE_S3C2410, | ||
| 652 | }, { | ||
| 653 | .compatible = "samsung,s3c6410-rtc" | ||
| 654 | .data = TYPE_S3C64XX, | ||
| 655 | }, | ||
| 643 | {}, | 656 | {}, |
| 644 | }; | 657 | }; |
| 645 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); | 658 | MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match); |
