diff options
| author | Yauhen Kharuzhy <jekhor@gmail.com> | 2012-01-10 18:10:32 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 19:30:52 -0500 |
| commit | 7287be1d0ac8c82999b67c2a33517c6ec9cfdbe7 (patch) | |
| tree | 7ed79d428bec700c2288c83cf3d685f87aa7019a /drivers/rtc | |
| parent | b43c1ea4d622b6951377de92edfb219d893e23ef (diff) | |
drivers/rtc/rtc-mxc.c: fix setting time for MX1 SoC
There is no way to track year in the i.MX1 RTC: Days Counter register is
9-bit wide only. Attempt to save date after 1970-01-01 plus 512 days
causes endless loop in mxc_rtc_set_mmss(). Fix this by resetting year to
1970.
[akpm@linux-foundation.org: use conventional comment layout]
Signed-off-by: Yauhen Kharuzhy <jekhor@gmail.com>
Cc: Daniel Mack <daniel@caiaq.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-mxc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c index 39e41fbdf08b..11b7b614fc8d 100644 --- a/drivers/rtc/rtc-mxc.c +++ b/drivers/rtc/rtc-mxc.c | |||
| @@ -290,6 +290,17 @@ static int mxc_rtc_read_time(struct device *dev, struct rtc_time *tm) | |||
| 290 | */ | 290 | */ |
| 291 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) | 291 | static int mxc_rtc_set_mmss(struct device *dev, unsigned long time) |
| 292 | { | 292 | { |
| 293 | /* | ||
| 294 | * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only | ||
| 295 | */ | ||
| 296 | if (cpu_is_mx1()) { | ||
| 297 | struct rtc_time tm; | ||
| 298 | |||
| 299 | rtc_time_to_tm(time, &tm); | ||
| 300 | tm.tm_year = 70; | ||
| 301 | rtc_tm_to_time(&tm, &time); | ||
| 302 | } | ||
| 303 | |||
| 293 | /* Avoid roll-over from reading the different registers */ | 304 | /* Avoid roll-over from reading the different registers */ |
| 294 | do { | 305 | do { |
| 295 | set_alarm_or_time(dev, MXC_RTC_TIME, time); | 306 | set_alarm_or_time(dev, MXC_RTC_TIME, time); |
