aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-s3c.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
-rw-r--r--drivers/rtc/rtc-s3c.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c
index 2087953f108d..3f3a29752369 100644
--- a/drivers/rtc/rtc-s3c.c
+++ b/drivers/rtc/rtc-s3c.c
@@ -40,6 +40,10 @@ enum s3c_cpu_type {
40 TYPE_S3C64XX, 40 TYPE_S3C64XX,
41}; 41};
42 42
43struct s3c_rtc_drv_data {
44 int cpu_type;
45};
46
43/* I have yet to find an S3C implementation with more than one 47/* I have yet to find an S3C implementation with more than one
44 * of these rtc blocks in */ 48 * of these rtc blocks in */
45 49
@@ -446,10 +450,12 @@ static const struct of_device_id s3c_rtc_dt_match[];
446static inline int s3c_rtc_get_driver_data(struct platform_device *pdev) 450static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
447{ 451{
448#ifdef CONFIG_OF 452#ifdef CONFIG_OF
453 struct s3c_rtc_drv_data *data;
449 if (pdev->dev.of_node) { 454 if (pdev->dev.of_node) {
450 const struct of_device_id *match; 455 const struct of_device_id *match;
451 match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node); 456 match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
452 return match->data; 457 data = (struct s3c_rtc_drv_data *) match->data;
458 return data->cpu_type;
453 } 459 }
454#endif 460#endif
455 return platform_get_device_id(pdev)->driver_data; 461 return platform_get_device_id(pdev)->driver_data;
@@ -664,20 +670,27 @@ static int s3c_rtc_resume(struct platform_device *pdev)
664#define s3c_rtc_resume NULL 670#define s3c_rtc_resume NULL
665#endif 671#endif
666 672
673static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = {
674 [TYPE_S3C2410] = { TYPE_S3C2410 },
675 [TYPE_S3C2416] = { TYPE_S3C2416 },
676 [TYPE_S3C2443] = { TYPE_S3C2443 },
677 [TYPE_S3C64XX] = { TYPE_S3C64XX },
678};
679
667#ifdef CONFIG_OF 680#ifdef CONFIG_OF
668static const struct of_device_id s3c_rtc_dt_match[] = { 681static const struct of_device_id s3c_rtc_dt_match[] = {
669 { 682 {
670 .compatible = "samsung,s3c2410-rtc", 683 .compatible = "samsung,s3c2410-rtc",
671 .data = TYPE_S3C2410, 684 .data = &s3c_rtc_drv_data_array[TYPE_S3C2410],
672 }, { 685 }, {
673 .compatible = "samsung,s3c2416-rtc", 686 .compatible = "samsung,s3c2416-rtc",
674 .data = TYPE_S3C2416, 687 .data = &s3c_rtc_drv_data_array[TYPE_S3C2416],
675 }, { 688 }, {
676 .compatible = "samsung,s3c2443-rtc", 689 .compatible = "samsung,s3c2443-rtc",
677 .data = TYPE_S3C2443, 690 .data = &s3c_rtc_drv_data_array[TYPE_S3C2443],
678 }, { 691 }, {
679 .compatible = "samsung,s3c6410-rtc", 692 .compatible = "samsung,s3c6410-rtc",
680 .data = TYPE_S3C64XX, 693 .data = &s3c_rtc_drv_data_array[TYPE_S3C64XX],
681 }, 694 },
682 {}, 695 {},
683}; 696};