Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Andrew, On Wed, Jan 14, 2015 at 2:53 PM, Andrew Morton wrote: > On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao wrote: > >> On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson >> wrote: >> > Sonny, >> > >> >> Chris, it looks like you swapped the set and the clear of this bit, >> >> and you're relying

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Andrew Morton
On Wed, 14 Jan 2015 11:44:02 -0800 Sonny Rao wrote: > On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson 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 af

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Wed, Jan 14, 2015 at 10:36 AM, Doug Anderson 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 act

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
Chris, On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong wrote: > + /* 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 > +* 32khz. If we clear the GET_TIME bit here, the time of i2c transfer > +

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Doug Anderson
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 minim

Re: [PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-14 Thread Sonny Rao
On Tue, Jan 13, 2015 at 6:43 PM, Chris Zhong wrote: > 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 32khz. Otherwise reading > RTC time will return a old time. If clear the GET_TIME bit after setting, > the time of i2c

[PATCH] RTC: RK808: fix the rtc time reading issue

2015-01-13 Thread Chris Zhong
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 32khz. Otherwise reading RTC time will return a old time. If clear the GET_TIME bit after setting, the time of i2c transfer certainly more than 31.25us. Signed-off-by: Chris