diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
| commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
| tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/mips/kernel/genrtc.c | |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/mips/kernel/genrtc.c')
| -rw-r--r-- | arch/mips/kernel/genrtc.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/mips/kernel/genrtc.c b/arch/mips/kernel/genrtc.c new file mode 100644 index 000000000000..288bf51ad4ec --- /dev/null +++ b/arch/mips/kernel/genrtc.c | |||
| @@ -0,0 +1,64 @@ | |||
| 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 spinlock_t mips_rtc_lock = SPIN_LOCK_UNLOCKED; | ||
| 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 | |||
