diff options
Diffstat (limited to 'drivers/rtc/rtc-bfin.c')
-rw-r--r-- | drivers/rtc/rtc-bfin.c | 46 |
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 | ||
374 | static 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 | |||
391 | static struct rtc_class_ops bfin_rtc_ops = { | 372 | static 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 | ||
403 | static int __devinit bfin_rtc_probe(struct platform_device *pdev) | 383 | static 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 | ||