aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-bfin.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2008-08-05 16:01:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-08-05 17:33:48 -0400
commit26cb8bb21b11245a53f79d9fa766537752f77d88 (patch)
treee1ab62679bd88a47f97dcc7e964a642152789030 /drivers/rtc/rtc-bfin.c
parente12af37d9ee09c2ac6da26a51c77754dec09fed4 (diff)
blackfin RTC driver: drop PIE/stopwatch code since the hardware can only do a max of 1HZ and this same functionality is provided by UIE
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Cc: David Brownell <david-b@pacbell.net> Cc: Alessandro Zummo <a.zummo@towertech.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-bfin.c')
-rw-r--r--drivers/rtc/rtc-bfin.c46
1 files changed, 14 insertions, 32 deletions
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c
index ceebce7e0a0f..a1af4c27939b 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -32,6 +32,15 @@
32 * writes to clear status registers complete immediately. 32 * writes to clear status registers complete immediately.
33 */ 33 */
34 34
35/* It may seem odd that there is no SWCNT code in here (which would be exposed
36 * via the periodic interrupt event, or PIE). Since the Blackfin RTC peripheral
37 * runs in units of seconds (N/HZ) but the Linux framework runs in units of HZ
38 * (2^N HZ), there is no point in keeping code that only provides 1 HZ PIEs.
39 * The same exact behavior can be accomplished by using the update interrupt
40 * event (UIE). Maybe down the line the RTC peripheral will suck less in which
41 * case we can re-introduce PIE support.
42 */
43
35#include <linux/bcd.h> 44#include <linux/bcd.h>
36#include <linux/completion.h> 45#include <linux/completion.h>
37#include <linux/delay.h> 46#include <linux/delay.h>
@@ -151,7 +160,6 @@ static void bfin_rtc_reset(struct device *dev, u16 rtc_ictl)
151 bfin_rtc_sync_pending(dev); 160 bfin_rtc_sync_pending(dev);
152 bfin_write_RTC_PREN(0x1); 161 bfin_write_RTC_PREN(0x1);
153 bfin_write_RTC_ICTL(rtc_ictl); 162 bfin_write_RTC_ICTL(rtc_ictl);
154 bfin_write_RTC_SWCNT(0);
155 bfin_write_RTC_ALARM(0); 163 bfin_write_RTC_ALARM(0);
156 bfin_write_RTC_ISTAT(0xFFFF); 164 bfin_write_RTC_ISTAT(0xFFFF);
157 rtc->rtc_wrote_regs = 0; 165 rtc->rtc_wrote_regs = 0;
@@ -194,14 +202,6 @@ static irqreturn_t bfin_rtc_interrupt(int irq, void *dev_id)
194 } 202 }
195 } 203 }
196 204
197 if (rtc_ictl & RTC_ISTAT_STOPWATCH) {
198 if (rtc_istat & RTC_ISTAT_STOPWATCH) {
199 bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
200 events |= RTC_PF | RTC_IRQF;
201 bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
202 }
203 }
204
205 if (rtc_ictl & RTC_ISTAT_SEC) { 205 if (rtc_ictl & RTC_ISTAT_SEC) {
206 if (rtc_istat & RTC_ISTAT_SEC) { 206 if (rtc_istat & RTC_ISTAT_SEC) {
207 bfin_write_RTC_ISTAT(RTC_ISTAT_SEC); 207 bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
@@ -361,33 +361,14 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
361 seq_printf(seq, 361 seq_printf(seq,
362 "alarm_IRQ\t: %s\n" 362 "alarm_IRQ\t: %s\n"
363 "wkalarm_IRQ\t: %s\n" 363 "wkalarm_IRQ\t: %s\n"
364 "seconds_IRQ\t: %s\n" 364 "seconds_IRQ\t: %s\n",
365 "periodic_IRQ\t: %s\n",
366 yesno(ictl & RTC_ISTAT_ALARM), 365 yesno(ictl & RTC_ISTAT_ALARM),
367 yesno(ictl & RTC_ISTAT_ALARM_DAY), 366 yesno(ictl & RTC_ISTAT_ALARM_DAY),
368 yesno(ictl & RTC_ISTAT_SEC), 367 yesno(ictl & RTC_ISTAT_SEC));
369 yesno(ictl & RTC_ISTAT_STOPWATCH));
370 return 0; 368 return 0;
371#undef yesno 369#undef yesno
372} 370}
373 371
374static int bfin_irq_set_state(struct device *dev, int enabled)
375{
376 struct bfin_rtc *rtc = dev_get_drvdata(dev);
377
378 dev_dbg_stamp(dev);
379
380 bfin_rtc_sync_pending(dev);
381
382 if (enabled) {
383 bfin_rtc_int_set(RTC_ISTAT_STOPWATCH);
384 bfin_write_RTC_SWCNT(rtc->rtc_dev->irq_freq);
385 } else
386 bfin_rtc_int_clear(~RTC_ISTAT_STOPWATCH);
387
388 return 0;
389}
390
391static struct rtc_class_ops bfin_rtc_ops = { 372static struct rtc_class_ops bfin_rtc_ops = {
392 .open = bfin_rtc_open, 373 .open = bfin_rtc_open,
393 .release = bfin_rtc_release, 374 .release = bfin_rtc_release,
@@ -397,7 +378,6 @@ static struct rtc_class_ops bfin_rtc_ops = {
397 .read_alarm = bfin_rtc_read_alarm, 378 .read_alarm = bfin_rtc_read_alarm,
398 .set_alarm = bfin_rtc_set_alarm, 379 .set_alarm = bfin_rtc_set_alarm,
399 .proc = bfin_rtc_proc, 380 .proc = bfin_rtc_proc,
400 .irq_set_state = bfin_irq_set_state,
401}; 381};
402 382
403static int __devinit bfin_rtc_probe(struct platform_device *pdev) 383static int __devinit bfin_rtc_probe(struct platform_device *pdev)
@@ -416,7 +396,9 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
416 ret = PTR_ERR(rtc->rtc_dev); 396 ret = PTR_ERR(rtc->rtc_dev);
417 goto err; 397 goto err;
418 } 398 }
419 rtc->rtc_dev->irq_freq = 1; 399
400 /* see comment at top of file about stopwatch/PIE */
401 bfin_write_RTC_SWCNT(0);
420 402
421 platform_set_drvdata(pdev, rtc); 403 platform_set_drvdata(pdev, rtc);
422 404