diff options
author | Jin Park <jinyoungp@nvidia.com> | 2011-09-07 11:22:05 +0900 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-09-27 17:48:22 -0700 |
commit | 508fac6318b9c20cfaba010fc3949b21a46b16ef (patch) | |
tree | 90ee893ea025cfa4aa40ad2c90eecd0a9e3a8e15 | |
parent | 467186f51c815c11b0672225dbda195931e2a01e (diff) |
rtc: max77663: Added delay for awaiting buffer update
Added 14ms delay for awaiting buffer update. So there is no need to
check update buffer flag bit on RTC_UPDATE1 register.
Bug 849360
Signed-off-by: Jin Park <jinyoungp@nvidia.com>
Reviewed-on: http://git-master/r/50987
(cherry picked from commit 1879feec7231ec082e6133e2172566ad4ee43f66)
Change-Id: If54c6ea3744140b9886ace26f335b0c0ecb72bb2
Reviewed-on: http://git-master/r/54635
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r-- | drivers/rtc/rtc-max77663.c | 29 |
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/rtc/rtc-max77663.c b/drivers/rtc/rtc-max77663.c index f0bcd83624c0..9f0981f91e46 100644 --- a/drivers/rtc/rtc-max77663.c +++ b/drivers/rtc/rtc-max77663.c @@ -71,7 +71,6 @@ #define ALARM_EN_MASK 0x80 #define ALARM_EN_SHIFT 7 -#define RTC_UPDATE_RETRIES 20 #define RTC_YEAR_BASE 100 #define RTC_YEAR_MAX 99 @@ -104,15 +103,11 @@ static inline int max77663_rtc_update_buffer(struct max77663_rtc *rtc, int write) { struct device *parent = _to_parent(rtc); - int retries = RTC_UPDATE_RETRIES; u8 val = FLAG_AUTO_CLEAR_MASK | RTC_WAKE_MASK | RB_UPDATE_MASK; - u8 flag_mask = RB_UPDATE_FLAG_MASK; int ret; - if (write) { + if (write) val = FLAG_AUTO_CLEAR_MASK | RTC_WAKE_MASK | WB_UPDATE_MASK; - flag_mask = WB_UPDATE_FLAG_MASK; - } dev_dbg(rtc->dev, "rtc_update_buffer: write=%d, addr=0x%x, val=0x%x\n", write, MAX77663_RTC_UPDATE0, val); @@ -123,22 +118,12 @@ static inline int max77663_rtc_update_buffer(struct max77663_rtc *rtc, return ret; } - do { - ret = max77663_read(parent, MAX77663_RTC_UPDATE1, &val, 1, 1); - schedule_timeout_uninterruptible(msecs_to_jiffies(1)); - } while (!ret && retries-- && !(val & flag_mask)); - - if (ret < 0) { - dev_err(rtc->dev, - "rtc_update_buffer: Failed to get rtc update1\n"); - return ret; - } - - if (retries <= 0) { - dev_err(rtc->dev, "rtc_update_buffer: " - "Timeout waiting for buffer update\n"); - return -ETIMEDOUT; - } + /* + * Must wait 14ms for buffer update. + * If the sleeping time is 10us - 20ms, usleep_range() is recommended. + * Please refer Documentation/timers/timers-howto.txt. + */ + usleep_range(14000, 14000); return 0; } |