diff options
Diffstat (limited to 'arch/sh/boards/sh03/rtc.c')
-rw-r--r-- | arch/sh/boards/sh03/rtc.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c index cbeca7037ba5..d609863cfe53 100644 --- a/arch/sh/boards/sh03/rtc.c +++ b/arch/sh/boards/sh03/rtc.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/kernel.h> | 9 | #include <linux/kernel.h> |
10 | #include <linux/sched.h> | 10 | #include <linux/sched.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/bcd.h> | ||
12 | #include <asm/io.h> | 13 | #include <asm/io.h> |
13 | #include <linux/rtc.h> | 14 | #include <linux/rtc.h> |
14 | #include <linux/spinlock.h> | 15 | #include <linux/spinlock.h> |
@@ -33,14 +34,6 @@ | |||
33 | #define RTC_BUSY 1 | 34 | #define RTC_BUSY 1 |
34 | #define RTC_STOP 2 | 35 | #define RTC_STOP 2 |
35 | 36 | ||
36 | #ifndef BCD_TO_BIN | ||
37 | #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10) | ||
38 | #endif | ||
39 | |||
40 | #ifndef BIN_TO_BCD | ||
41 | #define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10) | ||
42 | #endif | ||
43 | |||
44 | extern void (*rtc_get_time)(struct timespec *); | 37 | extern void (*rtc_get_time)(struct timespec *); |
45 | extern int (*rtc_set_time)(const time_t); | 38 | extern int (*rtc_set_time)(const time_t); |
46 | extern spinlock_t rtc_lock; | 39 | extern spinlock_t rtc_lock; |
@@ -48,13 +41,9 @@ extern spinlock_t rtc_lock; | |||
48 | unsigned long get_cmos_time(void) | 41 | unsigned long get_cmos_time(void) |
49 | { | 42 | { |
50 | unsigned int year, mon, day, hour, min, sec; | 43 | unsigned int year, mon, day, hour, min, sec; |
51 | int i; | ||
52 | 44 | ||
53 | spin_lock(&rtc_lock); | 45 | spin_lock(&rtc_lock); |
54 | again: | 46 | again: |
55 | for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */ | ||
56 | if (!(ctrl_inb(RTC_CTL) & RTC_BUSY)) | ||
57 | break; | ||
58 | do { | 47 | do { |
59 | sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10; | 48 | sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10; |
60 | min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10; | 49 | min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10; |