From: Andrew Morton <akpm@linux-foundation.org>
To: Sonny Rao <sonnyrao@chromium.org>
Cc: "Doug Anderson" <dianders@chromium.org>,
"Chris Zhong" <zyw@rock-chips.com>,
"Heiko Stübner" <heiko@sntech.de>,
"open list:ARM/Rockchip SoC..."
<linux-rockchip@lists.infradead.org>,
"Alessandro Zummo" <a.zummo@towertech.it>,
rtc-linux@googlegroups.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] RTC: RK808: fix the rtc time reading issue
Date: Wed, 14 Jan 2015 14:53:07 -0800 [thread overview]
Message-ID: <20150114145307.380c86a83c65760a046382e4@linux-foundation.org> (raw)
In-Reply-To: <CAPz6YkWe9tkn7BehGOurbq6omvTpYi170G0z6T+OijngOADRQQ@mail.gmail.com>
On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao <sonnyrao@chromium.org> wrote:
> On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson <dianders@chromium.org> wrote:
> > Sonny,
> >
> >> Chris, it looks like you swapped the set and the clear of this bit,
> >> and you're relying on the fact that the i2c transaction takes a
> >> certain amount of time after the RTC_GET_TIME BIT is set. I'm not
> >> sure how long it actually takes, but why not just put in a usleep()
> >> for the minimum wait time?
> >
> > I think we are safe.
> >
> > At 400kHz (the max speed of this part) each bit can be transferred no
> > faster than 2.5us. In order to do a valid i2c transaction we need to
> > _at least_ write the address of the device and the data onto the bus,
> > which is 16 bits. 16 * 2.5us = 40us. That's above the 31.25us
> >
> > Personally I think what Chris has is fine, with the comment.
>
> Ok, I'm fine with that if we're sure it's slow enough. Comment
> explaining would certainly help.
Thanks, all. I did this:
--- a/drivers/rtc/rtc-rk808.c~rtc-rk808-fix-the-rtc-time-reading-issue-fix
+++ a/drivers/rtc/rtc-rk808.c
@@ -73,10 +73,11 @@ static int rk808_rtc_readtime(struct dev
return ret;
}
- /* After we set the GET_TIME bit, the rtc time couldn't be read
- * immediately, we should wait up to 31.25 us, about one cycle of
+ /*
+ * After we set the GET_TIME bit, the rtc time can't be read
+ * immediately. So we should wait up to 31.25 us, about one cycle of
* 32khz. If we clear the GET_TIME bit here, the time of i2c transfer
- * certainly more than 31.25us.
+ * certainly more than 31.25us: 16 * 2.5us at 400kHz bus frequency.
*/
ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
BIT_RTC_CTRL_REG_RTC_GET_TIME,
_
next prev parent reply other threads:[~2015-01-14 22:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 2:43 Chris Zhong
2015-01-14 18:00 ` Sonny Rao
2015-01-14 18:36 ` Doug Anderson
2015-01-14 19:44 ` Sonny Rao
2015-01-14 22:53 ` Andrew Morton [this message]
2015-01-14 22:56 ` Doug Anderson
2015-01-14 18:39 ` Doug Anderson
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=20150114145307.380c86a83c65760a046382e4@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=a.zummo@towertech.it \
--cc=dianders@chromium.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=rtc-linux@googlegroups.com \
--cc=sonnyrao@chromium.org \
--cc=zyw@rock-chips.com \
/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
all inboxes | Powered by JetHome®