aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/ddb5xxx/common/rtc_ds1386.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/ddb5xxx/common/rtc_ds1386.c')
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
index f5b11508ff2f..995896ac0e39 100644
--- a/arch/mips/ddb5xxx/common/rtc_ds1386.c
+++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c
@@ -41,7 +41,9 @@ rtc_ds1386_get_time(void)
41 u8 byte; 41 u8 byte;
42 u8 temp; 42 u8 temp;
43 unsigned int year, month, day, hour, minute, second; 43 unsigned int year, month, day, hour, minute, second;
44 unsigned long flags;
44 45
46 spin_lock_irqsave(&rtc_lock, flags);
45 /* let us freeze external registers */ 47 /* let us freeze external registers */
46 byte = READ_RTC(0xB); 48 byte = READ_RTC(0xB);
47 byte &= 0x3f; 49 byte &= 0x3f;
@@ -60,6 +62,7 @@ rtc_ds1386_get_time(void)
60 /* enable time transfer */ 62 /* enable time transfer */
61 byte |= 0x80; 63 byte |= 0x80;
62 WRITE_RTC(0xB, byte); 64 WRITE_RTC(0xB, byte);
65 spin_unlock_irqrestore(&rtc_lock, flags);
63 66
64 /* calc hour */ 67 /* calc hour */
65 if (temp & 0x40) { 68 if (temp & 0x40) {
@@ -81,7 +84,9 @@ rtc_ds1386_set_time(unsigned long t)
81 u8 byte; 84 u8 byte;
82 u8 temp; 85 u8 temp;
83 u8 year, month, day, hour, minute, second; 86 u8 year, month, day, hour, minute, second;
87 unsigned long flags;
84 88
89 spin_lock_irqsave(&rtc_lock, flags);
85 /* let us freeze external registers */ 90 /* let us freeze external registers */
86 byte = READ_RTC(0xB); 91 byte = READ_RTC(0xB);
87 byte &= 0x3f; 92 byte &= 0x3f;
@@ -133,6 +138,7 @@ rtc_ds1386_set_time(unsigned long t)
133 if (second != READ_RTC(0x1)) { 138 if (second != READ_RTC(0x1)) {
134 WRITE_RTC(0x1, second); 139 WRITE_RTC(0x1, second);
135 } 140 }
141 spin_unlock_irqrestore(&rtc_lock, flags);
136 142
137 return 0; 143 return 0;
138} 144}