From: leo.yan@linaro.org (Leo Yan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] drivers/rtc/rtc-pl031.c: reset registers in init flow
Date: Wed, 29 Jul 2015 14:02:01 +0800 [thread overview]
Message-ID: <1438149721-11072-1-git-send-email-leo.yan@linaro.org> (raw)
When use rtc-pl031 for suspend test on Hisilicon's SoC Hi6220, Usually
the data register (DR) will read back as value zero. So the suspend
test code will set the match register (MR) for 10 seconds' timeout; But
there have chance later will read back some random values from DR
register; So finally miss with match value and will not trigger
waken up event anymore.
This issue can be dismissed by reset registers in initialization flow;
And this code have no harm for ST's variant.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
drivers/rtc/rtc-pl031.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/rtc/rtc-pl031.c b/drivers/rtc/rtc-pl031.c
index 99181fff..01768de 100644
--- a/drivers/rtc/rtc-pl031.c
+++ b/drivers/rtc/rtc-pl031.c
@@ -345,6 +345,12 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
dev_dbg(&adev->dev, "designer ID = 0x%02x\n", amba_manf(adev));
dev_dbg(&adev->dev, "revision = 0x%01x\n", amba_rev(adev));
+ /* Init registers */
+ writel(0x0, ldata->base + RTC_LR);
+ writel(0x0, ldata->base + RTC_DR);
+ writel(0x0, ldata->base + RTC_IMSC);
+ writel(RTC_BIT_AI, ldata->base + RTC_ICR);
+
data = readl(ldata->base + RTC_CR);
/* Enable the clockwatch on ST Variants */
if (vendor->clockwatch)
--
1.9.1
next reply other threads:[~2015-07-29 6:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-29 6:02 Leo Yan [this message]
2015-07-29 9:08 ` [rtc-linux] [PATCH] drivers/rtc/rtc-pl031.c: reset registers in init flow Linus Walleij
2015-07-29 11:17 ` Leo Yan
2015-08-03 8:01 ` Linus Walleij
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=1438149721-11072-1-git-send-email-leo.yan@linaro.org \
--to=leo.yan@linaro.org \
--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).