aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-pxa.c
diff options
context:
space:
mode:
authorLeo Song <liangs@marvell.com>2013-02-21 19:44:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-21 20:22:27 -0500
commitc4243de70f7d536d95196b8a31539298bb15238c (patch)
treeea421ac613dfc7dc7c5cfc3330f71921b7f8d0e6 /drivers/rtc/rtc-pxa.c
parent01a4ca16c897882635c937bf8f967584883669a2 (diff)
drivers/rtc/rtc-pxa.c: fix alarm not match issue
Fix pxa rtc alarm issue by setting week of month and day of week in rdar/rdcr or it would not match. Signed-off-by: Leo Song <liangs@marvell.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-pxa.c')
-rw-r--r--drivers/rtc/rtc-pxa.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/rtc/rtc-pxa.c b/drivers/rtc/rtc-pxa.c
index f771b2ee4b18..2695e556f141 100644
--- a/drivers/rtc/rtc-pxa.c
+++ b/drivers/rtc/rtc-pxa.c
@@ -62,6 +62,10 @@
62#define RYxR_MONTH_S 5 62#define RYxR_MONTH_S 5
63#define RYxR_MONTH_MASK (0xf << RYxR_MONTH_S) 63#define RYxR_MONTH_MASK (0xf << RYxR_MONTH_S)
64#define RYxR_DAY_MASK 0x1f 64#define RYxR_DAY_MASK 0x1f
65#define RDxR_WOM_S 20
66#define RDxR_WOM_MASK (0x7 << RDxR_WOM_S)
67#define RDxR_DOW_S 17
68#define RDxR_DOW_MASK (0x7 << RDxR_DOW_S)
65#define RDxR_HOUR_S 12 69#define RDxR_HOUR_S 12
66#define RDxR_HOUR_MASK (0x1f << RDxR_HOUR_S) 70#define RDxR_HOUR_MASK (0x1f << RDxR_HOUR_S)
67#define RDxR_MIN_S 6 71#define RDxR_MIN_S 6
@@ -91,6 +95,7 @@ struct pxa_rtc {
91 spinlock_t lock; /* Protects this structure */ 95 spinlock_t lock; /* Protects this structure */
92}; 96};
93 97
98
94static u32 ryxr_calc(struct rtc_time *tm) 99static u32 ryxr_calc(struct rtc_time *tm)
95{ 100{
96 return ((tm->tm_year + 1900) << RYxR_YEAR_S) 101 return ((tm->tm_year + 1900) << RYxR_YEAR_S)
@@ -100,7 +105,10 @@ static u32 ryxr_calc(struct rtc_time *tm)
100 105
101static u32 rdxr_calc(struct rtc_time *tm) 106static u32 rdxr_calc(struct rtc_time *tm)
102{ 107{
103 return (tm->tm_hour << RDxR_HOUR_S) | (tm->tm_min << RDxR_MIN_S) 108 return ((((tm->tm_mday + 6) / 7) << RDxR_WOM_S) & RDxR_WOM_MASK)
109 | (((tm->tm_wday + 1) << RDxR_DOW_S) & RDxR_DOW_MASK)
110 | (tm->tm_hour << RDxR_HOUR_S)
111 | (tm->tm_min << RDxR_MIN_S)
104 | tm->tm_sec; 112 | tm->tm_sec;
105} 113}
106 114
@@ -109,6 +117,7 @@ static void tm_calc(u32 rycr, u32 rdcr, struct rtc_time *tm)
109 tm->tm_year = ((rycr & RYxR_YEAR_MASK) >> RYxR_YEAR_S) - 1900; 117 tm->tm_year = ((rycr & RYxR_YEAR_MASK) >> RYxR_YEAR_S) - 1900;
110 tm->tm_mon = (((rycr & RYxR_MONTH_MASK) >> RYxR_MONTH_S)) - 1; 118 tm->tm_mon = (((rycr & RYxR_MONTH_MASK) >> RYxR_MONTH_S)) - 1;
111 tm->tm_mday = (rycr & RYxR_DAY_MASK); 119 tm->tm_mday = (rycr & RYxR_DAY_MASK);
120 tm->tm_wday = ((rycr & RDxR_DOW_MASK) >> RDxR_DOW_S) - 1;
112 tm->tm_hour = (rdcr & RDxR_HOUR_MASK) >> RDxR_HOUR_S; 121 tm->tm_hour = (rdcr & RDxR_HOUR_MASK) >> RDxR_HOUR_S;
113 tm->tm_min = (rdcr & RDxR_MIN_MASK) >> RDxR_MIN_S; 122 tm->tm_min = (rdcr & RDxR_MIN_MASK) >> RDxR_MIN_S;
114 tm->tm_sec = rdcr & RDxR_SEC_MASK; 123 tm->tm_sec = rdcr & RDxR_SEC_MASK;