diff options
-rw-r--r-- | drivers/rtc/rtc-ab8500.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-ab8500.c b/drivers/rtc/rtc-ab8500.c index 1a57e03e169d..bf3c2f669c3c 100644 --- a/drivers/rtc/rtc-ab8500.c +++ b/drivers/rtc/rtc-ab8500.c | |||
@@ -89,22 +89,17 @@ static int ab8500_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
89 | if (retval < 0) | 89 | if (retval < 0) |
90 | return retval; | 90 | return retval; |
91 | 91 | ||
92 | /* Early AB8500 chips will not clear the rtc read request bit */ | 92 | /* Wait for some cycles after enabling the rtc read in ab8500 */ |
93 | if (abx500_get_chip_id(dev) == 0) { | 93 | while (time_before(jiffies, timeout)) { |
94 | usleep_range(1000, 1000); | 94 | retval = abx500_get_register_interruptible(dev, |
95 | } else { | 95 | AB8500_RTC, AB8500_RTC_READ_REQ_REG, &value); |
96 | /* Wait for some cycles after enabling the rtc read in ab8500 */ | 96 | if (retval < 0) |
97 | while (time_before(jiffies, timeout)) { | 97 | return retval; |
98 | retval = abx500_get_register_interruptible(dev, | 98 | |
99 | AB8500_RTC, AB8500_RTC_READ_REQ_REG, &value); | 99 | if (!(value & RTC_READ_REQUEST)) |
100 | if (retval < 0) | 100 | break; |
101 | return retval; | 101 | |
102 | 102 | usleep_range(1000, 5000); | |
103 | if (!(value & RTC_READ_REQUEST)) | ||
104 | break; | ||
105 | |||
106 | usleep_range(1000, 5000); | ||
107 | } | ||
108 | } | 103 | } |
109 | 104 | ||
110 | /* Read the Watchtime registers */ | 105 | /* Read the Watchtime registers */ |