From: s.trumtrar@pengutronix.de (Steffen Trumtrar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 9/9] rtc: stmp3xxx: Replace wait_time function
Date: Mon, 4 Mar 2013 15:05:48 +0100 [thread overview]
Message-ID: <1362405948-12992-10-git-send-email-s.trumtrar@pengutronix.de> (raw)
In-Reply-To: <1362405948-12992-1-git-send-email-s.trumtrar@pengutronix.de>
Replace the wait_time function with the more generic wait_copy_ctrl function.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
drivers/rtc/rtc-stmp3xxx.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/rtc/rtc-stmp3xxx.c b/drivers/rtc/rtc-stmp3xxx.c
index be4fd78..35a92cd 100644
--- a/drivers/rtc/rtc-stmp3xxx.c
+++ b/drivers/rtc/rtc-stmp3xxx.c
@@ -172,24 +172,13 @@ static inline void stmp3xxx_wait_copy_ctrl(const struct stmp3xxx_rtc_data *rtc_d
pr_warn("possible data loss of rtc shadow registers\n");
}
-static void stmp3xxx_wait_time(struct stmp3xxx_rtc_data *rtc_data)
-{
- /*
- * The datasheet doesn't say which way round the
- * NEW_REGS/STALE_REGS bitfields go. In fact it's 0x1=P0,
- * 0x2=P1, .., 0x20=P5, 0x40=ALARM, 0x80=SECONDS
- */
- while (readl(rtc_data->io + STMP3XXX_RTC_STAT) &
- (0x80 << STMP3XXX_RTC_STAT_STALE_SHIFT))
- cpu_relax();
-}
-
/* Time read/write */
static int stmp3xxx_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
{
struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
- stmp3xxx_wait_time(rtc_data);
+ stmp3xxx_wait_copy_ctrl(rtc_data, STMP3XXX_RTC_STAT_STALE_SHIFT,
+ STMP3XXX_RTC_STAT_SEC_MASK);
rtc_time_to_tm(readl(rtc_data->io + STMP3XXX_RTC_SECONDS), rtc_tm);
return 0;
}
@@ -199,7 +188,8 @@ static int stmp3xxx_rtc_set_mmss(struct device *dev, unsigned long t)
struct stmp3xxx_rtc_data *rtc_data = dev_get_drvdata(dev);
writel(t, rtc_data->io + STMP3XXX_RTC_SECONDS);
- stmp3xxx_wait_time(rtc_data);
+ stmp3xxx_wait_copy_ctrl(rtc_data, STMP3XXX_RTC_STAT_NEW_SHIFT,
+ STMP3XXX_RTC_STAT_SEC_MASK);
return 0;
}
--
1.7.10.4
prev parent reply other threads:[~2013-03-04 14:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-04 14:05 [PATCH 0/9] rtc: stmp3xxx: DT bindings and wakealarm Steffen Trumtrar
2013-03-04 14:05 ` [PATCH 1/9] MXS/i.MX28: add the possibility to define the used crystals via device tree Steffen Trumtrar
2013-03-07 6:17 ` Shawn Guo
2013-03-04 14:05 ` [PATCH 2/9] MXS/i.MX28: add the possibility to define the external RTC crystal Steffen Trumtrar
2013-03-07 6:33 ` Shawn Guo
2013-03-04 14:05 ` [PATCH 3/9] MXS/i.MX28: prepare different clocking of the built-in RTC Steffen Trumtrar
2013-03-07 6:40 ` Shawn Guo
2013-03-04 14:05 ` [PATCH 4/9] MXS/i.MX28: there is more than one way to clock the RTC Steffen Trumtrar
2013-03-07 6:48 ` Shawn Guo
2013-03-07 8:19 ` Steffen Trumtrar
2013-03-04 14:05 ` [PATCH 5/9] MXS/i.MX28: enable RTC to wakeup the system Steffen Trumtrar
2013-03-04 14:05 ` [PATCH 6/9] rtc: stmp3xxx: add sysfs entries for persistent regs Steffen Trumtrar
2013-03-04 15:14 ` Grant Likely
2013-03-05 8:02 ` Steffen Trumtrar
2013-03-06 13:27 ` Steffen Trumtrar
2013-03-04 14:05 ` [PATCH 7/9] rtc: stmp3xxx: Re-enable active alarm Steffen Trumtrar
2013-03-04 14:05 ` [PATCH 8/9] rtc: stmp3xxx: Check copy controller state Steffen Trumtrar
2013-03-04 14:05 ` Steffen Trumtrar [this message]
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=1362405948-12992-10-git-send-email-s.trumtrar@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.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).