aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/pmc-sierra
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/pmc-sierra')
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index bdc2ab55bed6..059755b5ed57 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -73,7 +73,9 @@ void __init bus_error_init(void)
73unsigned long m48t37y_get_time(void) 73unsigned long m48t37y_get_time(void)
74{ 74{
75 unsigned int year, month, day, hour, min, sec; 75 unsigned int year, month, day, hour, min, sec;
76 unsigned long flags;
76 77
78 spin_lock_irqsave(&rtc_lock, flags);
77 /* Stop the update to the time */ 79 /* Stop the update to the time */
78 m48t37_base->control = 0x40; 80 m48t37_base->control = 0x40;
79 81
@@ -88,6 +90,7 @@ unsigned long m48t37y_get_time(void)
88 90
89 /* Start the update to the time again */ 91 /* Start the update to the time again */
90 m48t37_base->control = 0x00; 92 m48t37_base->control = 0x00;
93 spin_unlock_irqrestore(&rtc_lock, flags);
91 94
92 return mktime(year, month, day, hour, min, sec); 95 return mktime(year, month, day, hour, min, sec);
93} 96}
@@ -95,11 +98,13 @@ unsigned long m48t37y_get_time(void)
95int m48t37y_set_time(unsigned long sec) 98int m48t37y_set_time(unsigned long sec)
96{ 99{
97 struct rtc_time tm; 100 struct rtc_time tm;
101 unsigned long flags;
98 102
99 /* convert to a more useful format -- note months count from 0 */ 103 /* convert to a more useful format -- note months count from 0 */
100 to_tm(sec, &tm); 104 to_tm(sec, &tm);
101 tm.tm_mon += 1; 105 tm.tm_mon += 1;
102 106
107 spin_lock_irqsave(&rtc_lock, flags);
103 /* enable writing */ 108 /* enable writing */
104 m48t37_base->control = 0x80; 109 m48t37_base->control = 0x80;
105 110
@@ -123,6 +128,7 @@ int m48t37y_set_time(unsigned long sec)
123 128
124 /* disable writing */ 129 /* disable writing */
125 m48t37_base->control = 0x00; 130 m48t37_base->control = 0x00;
131 spin_unlock_irqrestore(&rtc_lock, flags);
126 132
127 return 0; 133 return 0;
128} 134}