diff options
author | Mike Frysinger <michael.frysinger@analog.com> | 2008-02-06 04:38:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-06 13:41:13 -0500 |
commit | 5c236343eb558e3cf3bbffd0688f5518f8b9028a (patch) | |
tree | fd56732063f8a223c589ca46ab4b0de7c25fc0ab /drivers/rtc/rtc-bfin.c | |
parent | 8f26795a22b12880bb07be688df72b4266f67be8 (diff) |
Blackfin RTC driver: the frequency function is in units of Hz, not units of seconds, so lock our driver down to 1 Hz
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
Acked-by: Alessandro Zummo <alessandro.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.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/rtc/rtc-bfin.c b/drivers/rtc/rtc-bfin.c index 1aa709dda0d6..303ed6e91d3f 100644 --- a/drivers/rtc/rtc-bfin.c +++ b/drivers/rtc/rtc-bfin.c | |||
@@ -72,7 +72,7 @@ struct bfin_rtc { | |||
72 | #define SEC_BITS_OFF 0 | 72 | #define SEC_BITS_OFF 0 |
73 | 73 | ||
74 | /* Some helper functions to convert between the common RTC notion of time | 74 | /* Some helper functions to convert between the common RTC notion of time |
75 | * and the internal Blackfin notion that is stored in 32bits. | 75 | * and the internal Blackfin notion that is encoded in 32bits. |
76 | */ | 76 | */ |
77 | static inline u32 rtc_time_to_bfin(unsigned long now) | 77 | static inline u32 rtc_time_to_bfin(unsigned long now) |
78 | { | 78 | { |
@@ -112,6 +112,11 @@ static inline void rtc_bfin_to_tm(u32 rtc_bfin, struct rtc_time *tm) | |||
112 | * If anyone can point out the obvious solution here, i'm listening :). This | 112 | * If anyone can point out the obvious solution here, i'm listening :). This |
113 | * shouldn't be an issue on an SMP or preempt system as this function should | 113 | * shouldn't be an issue on an SMP or preempt system as this function should |
114 | * only be called with the rtc lock held. | 114 | * only be called with the rtc lock held. |
115 | * | ||
116 | * Other options: | ||
117 | * - disable PREN so the sync happens at 32.768kHZ ... but this changes the | ||
118 | * inc rate for all RTC registers from 1HZ to 32.768kHZ ... | ||
119 | * - use the write complete IRQ | ||
115 | */ | 120 | */ |
116 | static void rtc_bfin_sync_pending(void) | 121 | static void rtc_bfin_sync_pending(void) |
117 | { | 122 | { |
@@ -356,12 +361,18 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq) | |||
356 | return 0; | 361 | return 0; |
357 | } | 362 | } |
358 | 363 | ||
364 | /** | ||
365 | * bfin_irq_set_freq - make sure hardware supports requested freq | ||
366 | * @dev: pointer to RTC device structure | ||
367 | * @freq: requested frequency rate | ||
368 | * | ||
369 | * The Blackfin RTC can only generate periodic events at 1 per | ||
370 | * second (1 Hz), so reject any attempt at changing it. | ||
371 | */ | ||
359 | static int bfin_irq_set_freq(struct device *dev, int freq) | 372 | static int bfin_irq_set_freq(struct device *dev, int freq) |
360 | { | 373 | { |
361 | struct bfin_rtc *rtc = dev_get_drvdata(dev); | ||
362 | stampit(); | 374 | stampit(); |
363 | rtc->rtc_dev->irq_freq = freq; | 375 | return -ENOTTY; |
364 | return 0; | ||
365 | } | 376 | } |
366 | 377 | ||
367 | static struct rtc_class_ops bfin_rtc_ops = { | 378 | static struct rtc_class_ops bfin_rtc_ops = { |
@@ -394,14 +405,13 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev) | |||
394 | ret = PTR_ERR(rtc->rtc_dev); | 405 | ret = PTR_ERR(rtc->rtc_dev); |
395 | goto err; | 406 | goto err; |
396 | } | 407 | } |
397 | rtc->rtc_dev->irq_freq = 0; | 408 | rtc->rtc_dev->irq_freq = 1; |
398 | rtc->rtc_dev->max_user_freq = (2 << 16); /* stopwatch is an unsigned 16 bit reg */ | ||
399 | 409 | ||
400 | platform_set_drvdata(pdev, rtc); | 410 | platform_set_drvdata(pdev, rtc); |
401 | 411 | ||
402 | return 0; | 412 | return 0; |
403 | 413 | ||
404 | err: | 414 | err: |
405 | kfree(rtc); | 415 | kfree(rtc); |
406 | return ret; | 416 | return ret; |
407 | } | 417 | } |