From: Bryan Wu <bryan.wu@analog.com>
To: a.zummo@towertech.it, rtc-linux@googlegroups.com
Cc: linux-kernel@vger.kernel.org,
uclinux-dist-devel@blackfin.uclinux.org,
Mike Frysinger <michael.frysinger@analog.com>,
Bryan Wu <bryan.wu@analog.com>
Subject: [PATCH 1/7] Blackfin RTC driver: the frequency function is in units of Hz, not units of seconds, so lock our driver down to 1 Hz
Date: Fri, 23 Nov 2007 18:08:26 +0800 [thread overview]
Message-ID: <1195812512-25979-2-git-send-email-bryan.wu@analog.com> (raw)
In-Reply-To: <1195812512-25979-1-git-send-email-bryan.wu@analog.com>
From: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Mike Frysinger <michael.frysinger@analog.com>
Signed-off-by: Bryan Wu <bryan.wu@analog.com>
---
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 1aa709d..303ed6e 100644
--- a/drivers/rtc/rtc-bfin.c
+++ b/drivers/rtc/rtc-bfin.c
@@ -72,7 +72,7 @@ struct bfin_rtc {
#define SEC_BITS_OFF 0
/* Some helper functions to convert between the common RTC notion of time
- * and the internal Blackfin notion that is stored in 32bits.
+ * and the internal Blackfin notion that is encoded in 32bits.
*/
static inline u32 rtc_time_to_bfin(unsigned long now)
{
@@ -112,6 +112,11 @@ static inline void rtc_bfin_to_tm(u32 rtc_bfin, struct rtc_time *tm)
* If anyone can point out the obvious solution here, i'm listening :). This
* shouldn't be an issue on an SMP or preempt system as this function should
* only be called with the rtc lock held.
+ *
+ * Other options:
+ * - disable PREN so the sync happens at 32.768kHZ ... but this changes the
+ * inc rate for all RTC registers from 1HZ to 32.768kHZ ...
+ * - use the write complete IRQ
*/
static void rtc_bfin_sync_pending(void)
{
@@ -356,12 +361,18 @@ static int bfin_rtc_proc(struct device *dev, struct seq_file *seq)
return 0;
}
+/**
+ * bfin_irq_set_freq - make sure hardware supports requested freq
+ * @dev: pointer to RTC device structure
+ * @freq: requested frequency rate
+ *
+ * The Blackfin RTC can only generate periodic events at 1 per
+ * second (1 Hz), so reject any attempt at changing it.
+ */
static int bfin_irq_set_freq(struct device *dev, int freq)
{
- struct bfin_rtc *rtc = dev_get_drvdata(dev);
stampit();
- rtc->rtc_dev->irq_freq = freq;
- return 0;
+ return -ENOTTY;
}
static struct rtc_class_ops bfin_rtc_ops = {
@@ -394,14 +405,13 @@ static int __devinit bfin_rtc_probe(struct platform_device *pdev)
ret = PTR_ERR(rtc->rtc_dev);
goto err;
}
- rtc->rtc_dev->irq_freq = 0;
- rtc->rtc_dev->max_user_freq = (2 << 16); /* stopwatch is an unsigned 16 bit reg */
+ rtc->rtc_dev->irq_freq = 1;
platform_set_drvdata(pdev, rtc);
return 0;
-err:
+ err:
kfree(rtc);
return ret;
}
--
1.5.3.4
next prev parent reply other threads:[~2007-11-23 10:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-23 10:08 [PATCH 0/7] Blackfin On-Chip RTC driver updates Bryan Wu
2007-11-23 10:08 ` Bryan Wu [this message]
2007-12-04 16:26 ` [PATCH 1/7] Blackfin RTC driver: the frequency function is in units of Hz, not units of seconds, so lock our driver down to 1 Hz Alessandro Zummo
2007-12-04 16:29 ` [rtc-linux] " Mike Frysinger
2007-12-04 16:41 ` Alessandro Zummo
2007-12-04 16:47 ` Mike Frysinger
2007-12-04 16:49 ` Alessandro Zummo
2007-12-04 16:56 ` Mike Frysinger
2007-12-04 16:59 ` Alessandro Zummo
2007-12-04 17:15 ` Mike Frysinger
2007-11-23 10:08 ` [PATCH 2/7] Blackfin RTC driver: we pass in a (struct device*) to the irq handler, not a (struct platform_device*), so fix the irq handler Bryan Wu
2007-11-23 10:08 ` [PATCH 3/7] Blackfin RTC driver: cleanup proc handler (we dont need RTC reg dump now that we have MMR filesystem in sysfs) Bryan Wu
2007-11-23 10:08 ` [PATCH 4/7] Blackfin RTC driver: use dev_dbg() rather than pr_stamp() Bryan Wu
2007-11-23 10:08 ` [PATCH 5/7] Blackfin RTC driver: read_alarm() checks the enabled field, not the pending field Bryan Wu
2007-11-23 10:08 ` [PATCH 6/7] Blackfin RTC driver: shave off another memcpy() by using assignment Bryan Wu
2007-11-23 10:08 ` [PATCH 7/7] Blackfin RTC driver: convert sync wait to use the irq write complete notice Bryan Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1195812512-25979-2-git-send-email-bryan.wu@analog.com \
--to=bryan.wu@analog.com \
--cc=a.zummo@towertech.it \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.frysinger@analog.com \
--cc=rtc-linux@googlegroups.com \
--cc=uclinux-dist-devel@blackfin.uclinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).