diff options
-rw-r--r-- | arch/mips/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/mips/kernel/genrtc.c | 64 | ||||
-rw-r--r-- | include/asm-mips/rtc.h | 53 |
3 files changed, 48 insertions, 71 deletions
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile index 4c09e1acafd7..0213b3496170 100644 --- a/arch/mips/kernel/Makefile +++ b/arch/mips/kernel/Makefile | |||
@@ -59,8 +59,6 @@ obj-$(CONFIG_PROC_FS) += proc.o | |||
59 | 59 | ||
60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o | 60 | obj-$(CONFIG_64BIT) += cpu-bugs64.o |
61 | 61 | ||
62 | obj-$(CONFIG_GEN_RTC) += genrtc.o | ||
63 | |||
64 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) | 62 | CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) |
65 | CFLAGS_ioctl32.o += -Ifs/ | 63 | CFLAGS_ioctl32.o += -Ifs/ |
66 | 64 | ||
diff --git a/arch/mips/kernel/genrtc.c b/arch/mips/kernel/genrtc.c deleted file mode 100644 index 71416e7bbbaa..000000000000 --- a/arch/mips/kernel/genrtc.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * A glue layer that provides RTC read/write to drivers/char/genrtc.c driver | ||
3 | * based on MIPS internal RTC routines. It does take care locking | ||
4 | * issues so that we are SMP/Preemption safe. | ||
5 | * | ||
6 | * Copyright (C) 2004 MontaVista Software Inc. | ||
7 | * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net | ||
8 | * | ||
9 | * Please read the COPYING file for all license details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/spinlock.h> | ||
13 | |||
14 | #include <asm/rtc.h> | ||
15 | #include <asm/time.h> | ||
16 | |||
17 | static DEFINE_SPINLOCK(mips_rtc_lock); | ||
18 | |||
19 | unsigned int get_rtc_time(struct rtc_time *time) | ||
20 | { | ||
21 | unsigned long nowtime; | ||
22 | |||
23 | spin_lock(&mips_rtc_lock); | ||
24 | nowtime = rtc_get_time(); | ||
25 | to_tm(nowtime, time); | ||
26 | time->tm_year -= 1900; | ||
27 | spin_unlock(&mips_rtc_lock); | ||
28 | |||
29 | return RTC_24H; | ||
30 | } | ||
31 | |||
32 | int set_rtc_time(struct rtc_time *time) | ||
33 | { | ||
34 | unsigned long nowtime; | ||
35 | int ret; | ||
36 | |||
37 | spin_lock(&mips_rtc_lock); | ||
38 | nowtime = mktime(time->tm_year+1900, time->tm_mon+1, | ||
39 | time->tm_mday, time->tm_hour, time->tm_min, | ||
40 | time->tm_sec); | ||
41 | ret = rtc_set_time(nowtime); | ||
42 | spin_unlock(&mips_rtc_lock); | ||
43 | |||
44 | return ret; | ||
45 | } | ||
46 | |||
47 | unsigned int get_rtc_ss(void) | ||
48 | { | ||
49 | struct rtc_time h; | ||
50 | |||
51 | get_rtc_time(&h); | ||
52 | return h.tm_sec; | ||
53 | } | ||
54 | |||
55 | int get_rtc_pll(struct rtc_pll_info *pll) | ||
56 | { | ||
57 | return -EINVAL; | ||
58 | } | ||
59 | |||
60 | int set_rtc_pll(struct rtc_pll_info *pll) | ||
61 | { | ||
62 | return -EINVAL; | ||
63 | } | ||
64 | |||
diff --git a/include/asm-mips/rtc.h b/include/asm-mips/rtc.h index 3c4b637fd925..a60e0dc7c9b9 100644 --- a/include/asm-mips/rtc.h +++ b/include/asm-mips/rtc.h | |||
@@ -14,7 +14,9 @@ | |||
14 | 14 | ||
15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
16 | 16 | ||
17 | #include <linux/spinlock.h> | ||
17 | #include <linux/rtc.h> | 18 | #include <linux/rtc.h> |
19 | #include <asm/time.h> | ||
18 | 20 | ||
19 | #define RTC_PIE 0x40 /* periodic interrupt enable */ | 21 | #define RTC_PIE 0x40 /* periodic interrupt enable */ |
20 | #define RTC_AIE 0x20 /* alarm interrupt enable */ | 22 | #define RTC_AIE 0x20 /* alarm interrupt enable */ |
@@ -27,11 +29,52 @@ | |||
27 | #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ | 29 | #define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */ |
28 | #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ | 30 | #define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */ |
29 | 31 | ||
30 | unsigned int get_rtc_time(struct rtc_time *time); | 32 | static DEFINE_SPINLOCK(mips_rtc_lock); |
31 | int set_rtc_time(struct rtc_time *time); | ||
32 | unsigned int get_rtc_ss(void); | ||
33 | int get_rtc_pll(struct rtc_pll_info *pll); | ||
34 | int set_rtc_pll(struct rtc_pll_info *pll); | ||
35 | 33 | ||
34 | static inline unsigned int get_rtc_time(struct rtc_time *time) | ||
35 | { | ||
36 | unsigned long nowtime; | ||
37 | |||
38 | spin_lock(&mips_rtc_lock); | ||
39 | nowtime = rtc_get_time(); | ||
40 | to_tm(nowtime, time); | ||
41 | time->tm_year -= 1900; | ||
42 | spin_unlock(&mips_rtc_lock); | ||
43 | |||
44 | return RTC_24H; | ||
45 | } | ||
46 | |||
47 | static inline int set_rtc_time(struct rtc_time *time) | ||
48 | { | ||
49 | unsigned long nowtime; | ||
50 | int ret; | ||
51 | |||
52 | spin_lock(&mips_rtc_lock); | ||
53 | nowtime = mktime(time->tm_year+1900, time->tm_mon+1, | ||
54 | time->tm_mday, time->tm_hour, time->tm_min, | ||
55 | time->tm_sec); | ||
56 | ret = rtc_set_time(nowtime); | ||
57 | spin_unlock(&mips_rtc_lock); | ||
58 | |||
59 | return ret; | ||
60 | } | ||
61 | |||
62 | static inline unsigned int get_rtc_ss(void) | ||
63 | { | ||
64 | struct rtc_time h; | ||
65 | |||
66 | get_rtc_time(&h); | ||
67 | return h.tm_sec; | ||
68 | } | ||
69 | |||
70 | static inline int get_rtc_pll(struct rtc_pll_info *pll) | ||
71 | { | ||
72 | return -EINVAL; | ||
73 | } | ||
74 | |||
75 | static inline int set_rtc_pll(struct rtc_pll_info *pll) | ||
76 | { | ||
77 | return -EINVAL; | ||
78 | } | ||
36 | #endif | 79 | #endif |
37 | #endif | 80 | #endif |