projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b43c1ea
)
drivers/rtc/rtc-mxc.c: fix setting time for MX1 SoC
author
Yauhen Kharuzhy
<
[email protected]
>
Tue, 10 Jan 2012 23:10:32 +0000
(15:10 -0800)
committer
Linus Torvalds
<
[email protected]
>
Wed, 11 Jan 2012 00:30:52 +0000
(16:30 -0800)
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.
[
[email protected]
: use conventional comment layout]
Signed-off-by: Yauhen Kharuzhy <
[email protected]
>
Cc: Daniel Mack <
[email protected]
>
Cc: Alessandro Zummo <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
drivers/rtc/rtc-mxc.c
patch
|
blob
|
history
diff --git
a/drivers/rtc/rtc-mxc.c
b/drivers/rtc/rtc-mxc.c
index 39e41fbdf08ba6de6259347feb0cc5dee76803d7..11b7b614fc8d6ecde83222dd95d0649fa723b688 100644
(file)
--- 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)
*/
static int mxc_rtc_set_mmss(struct device *dev, unsigned long time)
{
+ /*
+ * TTC_DAYR register is 9-bit in MX1 SoC, save time and day of year only
+ */
+ if (cpu_is_mx1()) {
+ struct rtc_time tm;
+
+ rtc_time_to_tm(time, &tm);
+ tm.tm_year = 70;
+ rtc_tm_to_time(&tm, &time);
+ }
+
/* Avoid roll-over from reading the different registers */
do {
set_alarm_or_time(dev, MXC_RTC_TIME, time);