aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/rtc/rtc-vr41xx.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 2c839d0d21bd..fadddac1e5a4 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -209,19 +209,18 @@ static int vr41xx_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm)
209 209
210static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq) 210static int vr41xx_rtc_irq_set_freq(struct device *dev, int freq)
211{ 211{
212 unsigned long count; 212 u64 count;
213 213
214 if (!is_power_of_2(freq)) 214 if (!is_power_of_2(freq))
215 return -EINVAL; 215 return -EINVAL;
216 count = RTC_FREQUENCY; 216 count = RTC_FREQUENCY;
217 do_div(count, freq); 217 do_div(count, freq);
218 218
219 periodic_count = count;
220
221 spin_lock_irq(&rtc_lock); 219 spin_lock_irq(&rtc_lock);
222 220
223 rtc1_write(RTCL1LREG, count); 221 periodic_count = count;
224 rtc1_write(RTCL1HREG, count >> 16); 222 rtc1_write(RTCL1LREG, periodic_count);
223 rtc1_write(RTCL1HREG, periodic_count >> 16);
225 224
226 spin_unlock_irq(&rtc_lock); 225 spin_unlock_irq(&rtc_lock);
227 226