diff options
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/dec/time.c | 18 | ||||
-rw-r--r-- | arch/mips/include/asm/mc146818-time.h | 18 | ||||
-rw-r--r-- | arch/mips/pmc-sierra/yosemite/setup.c | 30 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/rtc_m41t81.c | 26 | ||||
-rw-r--r-- | arch/mips/sibyte/swarm/rtc_xicor1241.c | 26 |
5 files changed, 59 insertions, 59 deletions
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c index 3965fda94a89..1359c03ded51 100644 --- a/arch/mips/dec/time.c +++ b/arch/mips/dec/time.c | |||
@@ -45,12 +45,12 @@ unsigned long read_persistent_clock(void) | |||
45 | spin_unlock_irqrestore(&rtc_lock, flags); | 45 | spin_unlock_irqrestore(&rtc_lock, flags); |
46 | 46 | ||
47 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | 47 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
48 | sec = BCD2BIN(sec); | 48 | sec = bcd2bin(sec); |
49 | min = BCD2BIN(min); | 49 | min = bcd2bin(min); |
50 | hour = BCD2BIN(hour); | 50 | hour = bcd2bin(hour); |
51 | day = BCD2BIN(day); | 51 | day = bcd2bin(day); |
52 | mon = BCD2BIN(mon); | 52 | mon = bcd2bin(mon); |
53 | year = BCD2BIN(year); | 53 | year = bcd2bin(year); |
54 | } | 54 | } |
55 | 55 | ||
56 | year += real_year - 72 + 2000; | 56 | year += real_year - 72 + 2000; |
@@ -83,7 +83,7 @@ int rtc_mips_set_mmss(unsigned long nowtime) | |||
83 | 83 | ||
84 | cmos_minutes = CMOS_READ(RTC_MINUTES); | 84 | cmos_minutes = CMOS_READ(RTC_MINUTES); |
85 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 85 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
86 | cmos_minutes = BCD2BIN(cmos_minutes); | 86 | cmos_minutes = bcd2bin(cmos_minutes); |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * since we're only adjusting minutes and seconds, | 89 | * since we're only adjusting minutes and seconds, |
@@ -99,8 +99,8 @@ int rtc_mips_set_mmss(unsigned long nowtime) | |||
99 | 99 | ||
100 | if (abs(real_minutes - cmos_minutes) < 30) { | 100 | if (abs(real_minutes - cmos_minutes) < 30) { |
101 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | 101 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
102 | real_seconds = BIN2BCD(real_seconds); | 102 | real_seconds = bin2bcd(real_seconds); |
103 | real_minutes = BIN2BCD(real_minutes); | 103 | real_minutes = bin2bcd(real_minutes); |
104 | } | 104 | } |
105 | CMOS_WRITE(real_seconds, RTC_SECONDS); | 105 | CMOS_WRITE(real_seconds, RTC_SECONDS); |
106 | CMOS_WRITE(real_minutes, RTC_MINUTES); | 106 | CMOS_WRITE(real_minutes, RTC_MINUTES); |
diff --git a/arch/mips/include/asm/mc146818-time.h b/arch/mips/include/asm/mc146818-time.h index cdc379a0a94e..199b45733a95 100644 --- a/arch/mips/include/asm/mc146818-time.h +++ b/arch/mips/include/asm/mc146818-time.h | |||
@@ -44,7 +44,7 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime) | |||
44 | 44 | ||
45 | cmos_minutes = CMOS_READ(RTC_MINUTES); | 45 | cmos_minutes = CMOS_READ(RTC_MINUTES); |
46 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) | 46 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) |
47 | BCD_TO_BIN(cmos_minutes); | 47 | cmos_minutes = bcd2bin(cmos_minutes); |
48 | 48 | ||
49 | /* | 49 | /* |
50 | * since we're only adjusting minutes and seconds, | 50 | * since we're only adjusting minutes and seconds, |
@@ -60,8 +60,8 @@ static inline int mc146818_set_rtc_mmss(unsigned long nowtime) | |||
60 | 60 | ||
61 | if (abs(real_minutes - cmos_minutes) < 30) { | 61 | if (abs(real_minutes - cmos_minutes) < 30) { |
62 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | 62 | if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
63 | BIN_TO_BCD(real_seconds); | 63 | real_seconds = bin2bcd(real_seconds); |
64 | BIN_TO_BCD(real_minutes); | 64 | real_minutes = bin2bcd(real_minutes); |
65 | } | 65 | } |
66 | CMOS_WRITE(real_seconds, RTC_SECONDS); | 66 | CMOS_WRITE(real_seconds, RTC_SECONDS); |
67 | CMOS_WRITE(real_minutes, RTC_MINUTES); | 67 | CMOS_WRITE(real_minutes, RTC_MINUTES); |
@@ -103,12 +103,12 @@ static inline unsigned long mc146818_get_cmos_time(void) | |||
103 | } while (sec != CMOS_READ(RTC_SECONDS)); | 103 | } while (sec != CMOS_READ(RTC_SECONDS)); |
104 | 104 | ||
105 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { | 105 | if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { |
106 | BCD_TO_BIN(sec); | 106 | sec = bcd2bin(sec); |
107 | BCD_TO_BIN(min); | 107 | min = bcd2bin(min); |
108 | BCD_TO_BIN(hour); | 108 | hour = bcd2bin(hour); |
109 | BCD_TO_BIN(day); | 109 | day = bcd2bin(day); |
110 | BCD_TO_BIN(mon); | 110 | mon = bcd2bin(mon); |
111 | BCD_TO_BIN(year); | 111 | year = bcd2bin(year); |
112 | } | 112 | } |
113 | spin_unlock_irqrestore(&rtc_lock, flags); | 113 | spin_unlock_irqrestore(&rtc_lock, flags); |
114 | year = mc146818_decode_year(year); | 114 | year = mc146818_decode_year(year); |
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c index 6537d90a25bb..2d3c0dca275d 100644 --- a/arch/mips/pmc-sierra/yosemite/setup.c +++ b/arch/mips/pmc-sierra/yosemite/setup.c | |||
@@ -79,14 +79,14 @@ unsigned long read_persistent_clock(void) | |||
79 | /* Stop the update to the time */ | 79 | /* Stop the update to the time */ |
80 | m48t37_base->control = 0x40; | 80 | m48t37_base->control = 0x40; |
81 | 81 | ||
82 | year = BCD2BIN(m48t37_base->year); | 82 | year = bcd2bin(m48t37_base->year); |
83 | year += BCD2BIN(m48t37_base->century) * 100; | 83 | year += bcd2bin(m48t37_base->century) * 100; |
84 | 84 | ||
85 | month = BCD2BIN(m48t37_base->month); | 85 | month = bcd2bin(m48t37_base->month); |
86 | day = BCD2BIN(m48t37_base->date); | 86 | day = bcd2bin(m48t37_base->date); |
87 | hour = BCD2BIN(m48t37_base->hour); | 87 | hour = bcd2bin(m48t37_base->hour); |
88 | min = BCD2BIN(m48t37_base->min); | 88 | min = bcd2bin(m48t37_base->min); |
89 | sec = BCD2BIN(m48t37_base->sec); | 89 | sec = bcd2bin(m48t37_base->sec); |
90 | 90 | ||
91 | /* Start the update to the time again */ | 91 | /* Start the update to the time again */ |
92 | m48t37_base->control = 0x00; | 92 | m48t37_base->control = 0x00; |
@@ -113,22 +113,22 @@ int rtc_mips_set_time(unsigned long tim) | |||
113 | m48t37_base->control = 0x80; | 113 | m48t37_base->control = 0x80; |
114 | 114 | ||
115 | /* year */ | 115 | /* year */ |
116 | m48t37_base->year = BIN2BCD(tm.tm_year % 100); | 116 | m48t37_base->year = bin2bcd(tm.tm_year % 100); |
117 | m48t37_base->century = BIN2BCD(tm.tm_year / 100); | 117 | m48t37_base->century = bin2bcd(tm.tm_year / 100); |
118 | 118 | ||
119 | /* month */ | 119 | /* month */ |
120 | m48t37_base->month = BIN2BCD(tm.tm_mon); | 120 | m48t37_base->month = bin2bcd(tm.tm_mon); |
121 | 121 | ||
122 | /* day */ | 122 | /* day */ |
123 | m48t37_base->date = BIN2BCD(tm.tm_mday); | 123 | m48t37_base->date = bin2bcd(tm.tm_mday); |
124 | 124 | ||
125 | /* hour/min/sec */ | 125 | /* hour/min/sec */ |
126 | m48t37_base->hour = BIN2BCD(tm.tm_hour); | 126 | m48t37_base->hour = bin2bcd(tm.tm_hour); |
127 | m48t37_base->min = BIN2BCD(tm.tm_min); | 127 | m48t37_base->min = bin2bcd(tm.tm_min); |
128 | m48t37_base->sec = BIN2BCD(tm.tm_sec); | 128 | m48t37_base->sec = bin2bcd(tm.tm_sec); |
129 | 129 | ||
130 | /* day of week -- not really used, but let's keep it up-to-date */ | 130 | /* day of week -- not really used, but let's keep it up-to-date */ |
131 | m48t37_base->day = BIN2BCD(tm.tm_wday + 1); | 131 | m48t37_base->day = bin2bcd(tm.tm_wday + 1); |
132 | 132 | ||
133 | /* disable writing */ | 133 | /* disable writing */ |
134 | m48t37_base->control = 0x00; | 134 | m48t37_base->control = 0x00; |
diff --git a/arch/mips/sibyte/swarm/rtc_m41t81.c b/arch/mips/sibyte/swarm/rtc_m41t81.c index 26fbff4c15b1..b732600b47f5 100644 --- a/arch/mips/sibyte/swarm/rtc_m41t81.c +++ b/arch/mips/sibyte/swarm/rtc_m41t81.c | |||
@@ -156,32 +156,32 @@ int m41t81_set_time(unsigned long t) | |||
156 | */ | 156 | */ |
157 | 157 | ||
158 | spin_lock_irqsave(&rtc_lock, flags); | 158 | spin_lock_irqsave(&rtc_lock, flags); |
159 | tm.tm_sec = BIN2BCD(tm.tm_sec); | 159 | tm.tm_sec = bin2bcd(tm.tm_sec); |
160 | m41t81_write(M41T81REG_SC, tm.tm_sec); | 160 | m41t81_write(M41T81REG_SC, tm.tm_sec); |
161 | 161 | ||
162 | tm.tm_min = BIN2BCD(tm.tm_min); | 162 | tm.tm_min = bin2bcd(tm.tm_min); |
163 | m41t81_write(M41T81REG_MN, tm.tm_min); | 163 | m41t81_write(M41T81REG_MN, tm.tm_min); |
164 | 164 | ||
165 | tm.tm_hour = BIN2BCD(tm.tm_hour); | 165 | tm.tm_hour = bin2bcd(tm.tm_hour); |
166 | tm.tm_hour = (tm.tm_hour & 0x3f) | (m41t81_read(M41T81REG_HR) & 0xc0); | 166 | tm.tm_hour = (tm.tm_hour & 0x3f) | (m41t81_read(M41T81REG_HR) & 0xc0); |
167 | m41t81_write(M41T81REG_HR, tm.tm_hour); | 167 | m41t81_write(M41T81REG_HR, tm.tm_hour); |
168 | 168 | ||
169 | /* tm_wday starts from 0 to 6 */ | 169 | /* tm_wday starts from 0 to 6 */ |
170 | if (tm.tm_wday == 0) tm.tm_wday = 7; | 170 | if (tm.tm_wday == 0) tm.tm_wday = 7; |
171 | tm.tm_wday = BIN2BCD(tm.tm_wday); | 171 | tm.tm_wday = bin2bcd(tm.tm_wday); |
172 | m41t81_write(M41T81REG_DY, tm.tm_wday); | 172 | m41t81_write(M41T81REG_DY, tm.tm_wday); |
173 | 173 | ||
174 | tm.tm_mday = BIN2BCD(tm.tm_mday); | 174 | tm.tm_mday = bin2bcd(tm.tm_mday); |
175 | m41t81_write(M41T81REG_DT, tm.tm_mday); | 175 | m41t81_write(M41T81REG_DT, tm.tm_mday); |
176 | 176 | ||
177 | /* tm_mon starts from 0, *ick* */ | 177 | /* tm_mon starts from 0, *ick* */ |
178 | tm.tm_mon ++; | 178 | tm.tm_mon ++; |
179 | tm.tm_mon = BIN2BCD(tm.tm_mon); | 179 | tm.tm_mon = bin2bcd(tm.tm_mon); |
180 | m41t81_write(M41T81REG_MO, tm.tm_mon); | 180 | m41t81_write(M41T81REG_MO, tm.tm_mon); |
181 | 181 | ||
182 | /* we don't do century, everything is beyond 2000 */ | 182 | /* we don't do century, everything is beyond 2000 */ |
183 | tm.tm_year %= 100; | 183 | tm.tm_year %= 100; |
184 | tm.tm_year = BIN2BCD(tm.tm_year); | 184 | tm.tm_year = bin2bcd(tm.tm_year); |
185 | m41t81_write(M41T81REG_YR, tm.tm_year); | 185 | m41t81_write(M41T81REG_YR, tm.tm_year); |
186 | spin_unlock_irqrestore(&rtc_lock, flags); | 186 | spin_unlock_irqrestore(&rtc_lock, flags); |
187 | 187 | ||
@@ -209,12 +209,12 @@ unsigned long m41t81_get_time(void) | |||
209 | year = m41t81_read(M41T81REG_YR); | 209 | year = m41t81_read(M41T81REG_YR); |
210 | spin_unlock_irqrestore(&rtc_lock, flags); | 210 | spin_unlock_irqrestore(&rtc_lock, flags); |
211 | 211 | ||
212 | sec = BCD2BIN(sec); | 212 | sec = bcd2bin(sec); |
213 | min = BCD2BIN(min); | 213 | min = bcd2bin(min); |
214 | hour = BCD2BIN(hour); | 214 | hour = bcd2bin(hour); |
215 | day = BCD2BIN(day); | 215 | day = bcd2bin(day); |
216 | mon = BCD2BIN(mon); | 216 | mon = bcd2bin(mon); |
217 | year = BCD2BIN(year); | 217 | year = bcd2bin(year); |
218 | 218 | ||
219 | year += 2000; | 219 | year += 2000; |
220 | 220 | ||
diff --git a/arch/mips/sibyte/swarm/rtc_xicor1241.c b/arch/mips/sibyte/swarm/rtc_xicor1241.c index ff3e5dabb348..4438b2195c44 100644 --- a/arch/mips/sibyte/swarm/rtc_xicor1241.c +++ b/arch/mips/sibyte/swarm/rtc_xicor1241.c | |||
@@ -124,18 +124,18 @@ int xicor_set_time(unsigned long t) | |||
124 | xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL); | 124 | xicor_write(X1241REG_SR, X1241REG_SR_WEL | X1241REG_SR_RWEL); |
125 | 125 | ||
126 | /* trivial ones */ | 126 | /* trivial ones */ |
127 | tm.tm_sec = BIN2BCD(tm.tm_sec); | 127 | tm.tm_sec = bin2bcd(tm.tm_sec); |
128 | xicor_write(X1241REG_SC, tm.tm_sec); | 128 | xicor_write(X1241REG_SC, tm.tm_sec); |
129 | 129 | ||
130 | tm.tm_min = BIN2BCD(tm.tm_min); | 130 | tm.tm_min = bin2bcd(tm.tm_min); |
131 | xicor_write(X1241REG_MN, tm.tm_min); | 131 | xicor_write(X1241REG_MN, tm.tm_min); |
132 | 132 | ||
133 | tm.tm_mday = BIN2BCD(tm.tm_mday); | 133 | tm.tm_mday = bin2bcd(tm.tm_mday); |
134 | xicor_write(X1241REG_DT, tm.tm_mday); | 134 | xicor_write(X1241REG_DT, tm.tm_mday); |
135 | 135 | ||
136 | /* tm_mon starts from 0, *ick* */ | 136 | /* tm_mon starts from 0, *ick* */ |
137 | tm.tm_mon ++; | 137 | tm.tm_mon ++; |
138 | tm.tm_mon = BIN2BCD(tm.tm_mon); | 138 | tm.tm_mon = bin2bcd(tm.tm_mon); |
139 | xicor_write(X1241REG_MO, tm.tm_mon); | 139 | xicor_write(X1241REG_MO, tm.tm_mon); |
140 | 140 | ||
141 | /* year is split */ | 141 | /* year is split */ |
@@ -148,7 +148,7 @@ int xicor_set_time(unsigned long t) | |||
148 | tmp = xicor_read(X1241REG_HR); | 148 | tmp = xicor_read(X1241REG_HR); |
149 | if (tmp & X1241REG_HR_MIL) { | 149 | if (tmp & X1241REG_HR_MIL) { |
150 | /* 24 hour format */ | 150 | /* 24 hour format */ |
151 | tm.tm_hour = BIN2BCD(tm.tm_hour); | 151 | tm.tm_hour = bin2bcd(tm.tm_hour); |
152 | tmp = (tmp & ~0x3f) | (tm.tm_hour & 0x3f); | 152 | tmp = (tmp & ~0x3f) | (tm.tm_hour & 0x3f); |
153 | } else { | 153 | } else { |
154 | /* 12 hour format, with 0x2 for pm */ | 154 | /* 12 hour format, with 0x2 for pm */ |
@@ -157,7 +157,7 @@ int xicor_set_time(unsigned long t) | |||
157 | tmp |= 0x20; | 157 | tmp |= 0x20; |
158 | tm.tm_hour -= 12; | 158 | tm.tm_hour -= 12; |
159 | } | 159 | } |
160 | tm.tm_hour = BIN2BCD(tm.tm_hour); | 160 | tm.tm_hour = bin2bcd(tm.tm_hour); |
161 | tmp |= tm.tm_hour; | 161 | tmp |= tm.tm_hour; |
162 | } | 162 | } |
163 | xicor_write(X1241REG_HR, tmp); | 163 | xicor_write(X1241REG_HR, tmp); |
@@ -191,13 +191,13 @@ unsigned long xicor_get_time(void) | |||
191 | y2k = xicor_read(X1241REG_Y2K); | 191 | y2k = xicor_read(X1241REG_Y2K); |
192 | spin_unlock_irqrestore(&rtc_lock, flags); | 192 | spin_unlock_irqrestore(&rtc_lock, flags); |
193 | 193 | ||
194 | sec = BCD2BIN(sec); | 194 | sec = bcd2bin(sec); |
195 | min = BCD2BIN(min); | 195 | min = bcd2bin(min); |
196 | hour = BCD2BIN(hour); | 196 | hour = bcd2bin(hour); |
197 | day = BCD2BIN(day); | 197 | day = bcd2bin(day); |
198 | mon = BCD2BIN(mon); | 198 | mon = bcd2bin(mon); |
199 | year = BCD2BIN(year); | 199 | year = bcd2bin(year); |
200 | y2k = BCD2BIN(y2k); | 200 | y2k = bcd2bin(y2k); |
201 | 201 | ||
202 | year += (y2k * 100); | 202 | year += (y2k * 100); |
203 | 203 | ||