aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-sh.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-sh.c')
-rw-r--r--drivers/rtc/rtc-sh.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index fcead4c4cd1f..1ec297128ea6 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -324,23 +324,23 @@ static int sh_rtc_read_time(struct device *dev, struct rtc_time *tm)
324 324
325 sec128 = readb(rtc->regbase + R64CNT); 325 sec128 = readb(rtc->regbase + R64CNT);
326 326
327 tm->tm_sec = BCD2BIN(readb(rtc->regbase + RSECCNT)); 327 tm->tm_sec = bcd2bin(readb(rtc->regbase + RSECCNT));
328 tm->tm_min = BCD2BIN(readb(rtc->regbase + RMINCNT)); 328 tm->tm_min = bcd2bin(readb(rtc->regbase + RMINCNT));
329 tm->tm_hour = BCD2BIN(readb(rtc->regbase + RHRCNT)); 329 tm->tm_hour = bcd2bin(readb(rtc->regbase + RHRCNT));
330 tm->tm_wday = BCD2BIN(readb(rtc->regbase + RWKCNT)); 330 tm->tm_wday = bcd2bin(readb(rtc->regbase + RWKCNT));
331 tm->tm_mday = BCD2BIN(readb(rtc->regbase + RDAYCNT)); 331 tm->tm_mday = bcd2bin(readb(rtc->regbase + RDAYCNT));
332 tm->tm_mon = BCD2BIN(readb(rtc->regbase + RMONCNT)) - 1; 332 tm->tm_mon = bcd2bin(readb(rtc->regbase + RMONCNT)) - 1;
333 333
334 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) { 334 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) {
335 yr = readw(rtc->regbase + RYRCNT); 335 yr = readw(rtc->regbase + RYRCNT);
336 yr100 = BCD2BIN(yr >> 8); 336 yr100 = bcd2bin(yr >> 8);
337 yr &= 0xff; 337 yr &= 0xff;
338 } else { 338 } else {
339 yr = readb(rtc->regbase + RYRCNT); 339 yr = readb(rtc->regbase + RYRCNT);
340 yr100 = BCD2BIN((yr == 0x99) ? 0x19 : 0x20); 340 yr100 = bcd2bin((yr == 0x99) ? 0x19 : 0x20);
341 } 341 }
342 342
343 tm->tm_year = (yr100 * 100 + BCD2BIN(yr)) - 1900; 343 tm->tm_year = (yr100 * 100 + bcd2bin(yr)) - 1900;
344 344
345 sec2 = readb(rtc->regbase + R64CNT); 345 sec2 = readb(rtc->regbase + R64CNT);
346 cf_bit = readb(rtc->regbase + RCR1) & RCR1_CF; 346 cf_bit = readb(rtc->regbase + RCR1) & RCR1_CF;
@@ -382,20 +382,20 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
382 tmp &= ~RCR2_START; 382 tmp &= ~RCR2_START;
383 writeb(tmp, rtc->regbase + RCR2); 383 writeb(tmp, rtc->regbase + RCR2);
384 384
385 writeb(BIN2BCD(tm->tm_sec), rtc->regbase + RSECCNT); 385 writeb(bin2bcd(tm->tm_sec), rtc->regbase + RSECCNT);
386 writeb(BIN2BCD(tm->tm_min), rtc->regbase + RMINCNT); 386 writeb(bin2bcd(tm->tm_min), rtc->regbase + RMINCNT);
387 writeb(BIN2BCD(tm->tm_hour), rtc->regbase + RHRCNT); 387 writeb(bin2bcd(tm->tm_hour), rtc->regbase + RHRCNT);
388 writeb(BIN2BCD(tm->tm_wday), rtc->regbase + RWKCNT); 388 writeb(bin2bcd(tm->tm_wday), rtc->regbase + RWKCNT);
389 writeb(BIN2BCD(tm->tm_mday), rtc->regbase + RDAYCNT); 389 writeb(bin2bcd(tm->tm_mday), rtc->regbase + RDAYCNT);
390 writeb(BIN2BCD(tm->tm_mon + 1), rtc->regbase + RMONCNT); 390 writeb(bin2bcd(tm->tm_mon + 1), rtc->regbase + RMONCNT);
391 391
392 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) { 392 if (rtc->capabilities & RTC_CAP_4_DIGIT_YEAR) {
393 year = (BIN2BCD((tm->tm_year + 1900) / 100) << 8) | 393 year = (bin2bcd((tm->tm_year + 1900) / 100) << 8) |
394 BIN2BCD(tm->tm_year % 100); 394 bin2bcd(tm->tm_year % 100);
395 writew(year, rtc->regbase + RYRCNT); 395 writew(year, rtc->regbase + RYRCNT);
396 } else { 396 } else {
397 year = tm->tm_year % 100; 397 year = tm->tm_year % 100;
398 writeb(BIN2BCD(year), rtc->regbase + RYRCNT); 398 writeb(bin2bcd(year), rtc->regbase + RYRCNT);
399 } 399 }
400 400
401 /* Start RTC */ 401 /* Start RTC */
@@ -417,7 +417,7 @@ static inline int sh_rtc_read_alarm_value(struct sh_rtc *rtc, int reg_off)
417 byte = readb(rtc->regbase + reg_off); 417 byte = readb(rtc->regbase + reg_off);
418 if (byte & AR_ENB) { 418 if (byte & AR_ENB) {
419 byte &= ~AR_ENB; /* strip the enable bit */ 419 byte &= ~AR_ENB; /* strip the enable bit */
420 value = BCD2BIN(byte); 420 value = bcd2bin(byte);
421 } 421 }
422 422
423 return value; 423 return value;
@@ -455,7 +455,7 @@ static inline void sh_rtc_write_alarm_value(struct sh_rtc *rtc,
455 if (value < 0) 455 if (value < 0)
456 writeb(0, rtc->regbase + reg_off); 456 writeb(0, rtc->regbase + reg_off);
457 else 457 else
458 writeb(BIN2BCD(value) | AR_ENB, rtc->regbase + reg_off); 458 writeb(bin2bcd(value) | AR_ENB, rtc->regbase + reg_off);
459} 459}
460 460
461static int sh_rtc_check_alarm(struct rtc_time *tm) 461static int sh_rtc_check_alarm(struct rtc_time *tm)