diff options
Diffstat (limited to 'drivers/rtc/rtc-s3c.c')
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index cf953ecbfca..714964913e5 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
| @@ -77,47 +77,18 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id) | |||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /* Update control registers */ | 79 | /* Update control registers */ |
| 80 | static void s3c_rtc_setaie(int to) | 80 | static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) |
| 81 | { | 81 | { |
| 82 | unsigned int tmp; | 82 | unsigned int tmp; |
| 83 | 83 | ||
| 84 | pr_debug("%s: aie=%d\n", __func__, to); | 84 | pr_debug("%s: aie=%d\n", __func__, enabled); |
| 85 | 85 | ||
| 86 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; | 86 | tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN; |
| 87 | 87 | ||
| 88 | if (to) | 88 | if (enabled) |
| 89 | tmp |= S3C2410_RTCALM_ALMEN; | 89 | tmp |= S3C2410_RTCALM_ALMEN; |
| 90 | 90 | ||
| 91 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); | 91 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
| 92 | } | ||
| 93 | |||
| 94 | static int s3c_rtc_setpie(struct device *dev, int enabled) | ||
| 95 | { | ||
| 96 | unsigned int tmp; | ||
| 97 | |||
| 98 | pr_debug("%s: pie=%d\n", __func__, enabled); | ||
| 99 | |||
| 100 | spin_lock_irq(&s3c_rtc_pie_lock); | ||
| 101 | |||
| 102 | if (s3c_rtc_cpu_type == TYPE_S3C64XX) { | ||
| 103 | tmp = readw(s3c_rtc_base + S3C2410_RTCCON); | ||
| 104 | tmp &= ~S3C64XX_RTCCON_TICEN; | ||
| 105 | |||
| 106 | if (enabled) | ||
| 107 | tmp |= S3C64XX_RTCCON_TICEN; | ||
| 108 | |||
| 109 | writew(tmp, s3c_rtc_base + S3C2410_RTCCON); | ||
| 110 | } else { | ||
| 111 | tmp = readb(s3c_rtc_base + S3C2410_TICNT); | ||
| 112 | tmp &= ~S3C2410_TICNT_ENABLE; | ||
| 113 | |||
| 114 | if (enabled) | ||
| 115 | tmp |= S3C2410_TICNT_ENABLE; | ||
| 116 | |||
| 117 | writeb(tmp, s3c_rtc_base + S3C2410_TICNT); | ||
| 118 | } | ||
| 119 | |||
| 120 | spin_unlock_irq(&s3c_rtc_pie_lock); | ||
| 121 | 92 | ||
| 122 | return 0; | 93 | return 0; |
| 123 | } | 94 | } |
| @@ -308,7 +279,7 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
| 308 | 279 | ||
| 309 | writeb(alrm_en, base + S3C2410_RTCALM); | 280 | writeb(alrm_en, base + S3C2410_RTCALM); |
| 310 | 281 | ||
| 311 | s3c_rtc_setaie(alrm->enabled); | 282 | s3c_rtc_setaie(dev, alrm->enabled); |
| 312 | 283 | ||
| 313 | return 0; | 284 | return 0; |
| 314 | } | 285 | } |
| @@ -377,8 +348,6 @@ static const struct rtc_class_ops s3c_rtcops = { | |||
| 377 | .set_time = s3c_rtc_settime, | 348 | .set_time = s3c_rtc_settime, |
| 378 | .read_alarm = s3c_rtc_getalarm, | 349 | .read_alarm = s3c_rtc_getalarm, |
| 379 | .set_alarm = s3c_rtc_setalarm, | 350 | .set_alarm = s3c_rtc_setalarm, |
| 380 | .irq_set_freq = s3c_rtc_setfreq, | ||
| 381 | .irq_set_state = s3c_rtc_setpie, | ||
| 382 | .proc = s3c_rtc_proc, | 351 | .proc = s3c_rtc_proc, |
| 383 | .alarm_irq_enable = s3c_rtc_setaie, | 352 | .alarm_irq_enable = s3c_rtc_setaie, |
| 384 | }; | 353 | }; |
| @@ -440,7 +409,7 @@ static int __devexit s3c_rtc_remove(struct platform_device *dev) | |||
| 440 | rtc_device_unregister(rtc); | 409 | rtc_device_unregister(rtc); |
| 441 | 410 | ||
| 442 | s3c_rtc_setpie(&dev->dev, 0); | 411 | s3c_rtc_setpie(&dev->dev, 0); |
| 443 | s3c_rtc_setaie(0); | 412 | s3c_rtc_setaie(&dev->dev, 0); |
| 444 | 413 | ||
| 445 | clk_disable(rtc_clk); | 414 | clk_disable(rtc_clk); |
| 446 | clk_put(rtc_clk); | 415 | clk_put(rtc_clk); |
