aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/momentum/ocelot_3/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/momentum/ocelot_3/setup.c')
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index a7803e08f9d..c9b7ff8148e 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -135,7 +135,9 @@ void setup_wired_tlb_entries(void)
135unsigned long m48t37y_get_time(void) 135unsigned long m48t37y_get_time(void)
136{ 136{
137 unsigned int year, month, day, hour, min, sec; 137 unsigned int year, month, day, hour, min, sec;
138 unsigned long flags;
138 139
140 spin_lock_irqsave(&rtc_lock, flags);
139 /* stop the update */ 141 /* stop the update */
140 rtc_base[0x7ff8] = 0x40; 142 rtc_base[0x7ff8] = 0x40;
141 143
@@ -152,6 +154,7 @@ unsigned long m48t37y_get_time(void)
152 154
153 /* start the update */ 155 /* start the update */
154 rtc_base[0x7ff8] = 0x00; 156 rtc_base[0x7ff8] = 0x00;
157 spin_unlock_irqrestore(&rtc_lock, flags);
155 158
156 return mktime(year, month, day, hour, min, sec); 159 return mktime(year, month, day, hour, min, sec);
157} 160}
@@ -159,11 +162,13 @@ unsigned long m48t37y_get_time(void)
159int m48t37y_set_time(unsigned long sec) 162int m48t37y_set_time(unsigned long sec)
160{ 163{
161 struct rtc_time tm; 164 struct rtc_time tm;
165 unsigned long flags;
162 166
163 /* convert to a more useful format -- note months count from 0 */ 167 /* convert to a more useful format -- note months count from 0 */
164 to_tm(sec, &tm); 168 to_tm(sec, &tm);
165 tm.tm_mon += 1; 169 tm.tm_mon += 1;
166 170
171 spin_lock_irqsave(&rtc_lock, flags);
167 /* enable writing */ 172 /* enable writing */
168 rtc_base[0x7ff8] = 0x80; 173 rtc_base[0x7ff8] = 0x80;
169 174
@@ -187,6 +192,7 @@ int m48t37y_set_time(unsigned long sec)
187 192
188 /* disable writing */ 193 /* disable writing */
189 rtc_base[0x7ff8] = 0x00; 194 rtc_base[0x7ff8] = 0x00;
195 spin_unlock_irqrestore(&rtc_lock, flags);
190 196
191 return 0; 197 return 0;
192} 198}