summaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/mrst/vrtc.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-10-30 20:59:09 +0100
committerArnd Bergmann <arnd@arndb.de>2011-10-30 20:59:09 +0100
commitb8bc83971cc20cae3c3b65c26a804f350d74960c (patch)
tree2573e6367e1806c298344fa023bb49a16cc4d1e4 /arch/x86/platform/mrst/vrtc.c
parent11f0d9311c6e9ed928dc98ce6e9d14c0ee274b05 (diff)
parentbca7ab316edd819edd0e3d59f9ccb26c6b2173f5 (diff)
Merge branch 'pxa/devel' into next/devel2
Conflicts: arch/arm/mach-s3c2416/s3c2416.c
Diffstat (limited to 'arch/x86/platform/mrst/vrtc.c')
-rw-r--r--arch/x86/platform/mrst/vrtc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index 73d70d65e76..6d5dbcdd444 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -58,8 +58,11 @@ EXPORT_SYMBOL_GPL(vrtc_cmos_write);
unsigned long vrtc_get_time(void)
{
u8 sec, min, hour, mday, mon;
+ unsigned long flags;
u32 year;
+ spin_lock_irqsave(&rtc_lock, flags);
+
while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP))
cpu_relax();
@@ -70,6 +73,8 @@ unsigned long vrtc_get_time(void)
mon = vrtc_cmos_read(RTC_MONTH);
year = vrtc_cmos_read(RTC_YEAR);
+ spin_unlock_irqrestore(&rtc_lock, flags);
+
/* vRTC YEAR reg contains the offset to 1960 */
year += 1960;
@@ -83,8 +88,10 @@ unsigned long vrtc_get_time(void)
int vrtc_set_mmss(unsigned long nowtime)
{
int real_sec, real_min;
+ unsigned long flags;
int vrtc_min;
+ spin_lock_irqsave(&rtc_lock, flags);
vrtc_min = vrtc_cmos_read(RTC_MINUTES);
real_sec = nowtime % 60;
@@ -95,6 +102,8 @@ int vrtc_set_mmss(unsigned long nowtime)
vrtc_cmos_write(real_sec, RTC_SECONDS);
vrtc_cmos_write(real_min, RTC_MINUTES);
+ spin_unlock_irqrestore(&rtc_lock, flags);
+
return 0;
}