aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-m68k/rtc.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/asm-m68k/rtc.h
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 'include/asm-m68k/rtc.h')
-rw-r--r--include/asm-m68k/rtc.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/include/asm-m68k/rtc.h b/include/asm-m68k/rtc.h
new file mode 100644
index 000000000000..71406fc4e599
--- /dev/null
+++ b/include/asm-m68k/rtc.h
@@ -0,0 +1,76 @@
1/* asm-m68k/rtc.h
2 *
3 * Copyright Richard Zidlicky
4 * implementation details for genrtc/q40rtc driver
5 */
6/* permission is hereby granted to copy, modify and redistribute this code
7 * in terms of the GNU Library General Public License, Version 2 or later,
8 * at your option.
9 */
10
11#ifndef _ASM_RTC_H
12#define _ASM_RTC_H
13
14#ifdef __KERNEL__
15
16#include <linux/rtc.h>
17#include <asm/errno.h>
18#include <asm/machdep.h>
19
20#define RTC_PIE 0x40 /* periodic interrupt enable */
21#define RTC_AIE 0x20 /* alarm interrupt enable */
22#define RTC_UIE 0x10 /* update-finished interrupt enable */
23
24/* some dummy definitions */
25#define RTC_BATT_BAD 0x100 /* battery bad */
26#define RTC_SQWE 0x08 /* enable square-wave output */
27#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
28#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
29#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
30
31static inline unsigned int get_rtc_time(struct rtc_time *time)
32{
33 /*
34 * Only the values that we read from the RTC are set. We leave
35 * tm_wday, tm_yday and tm_isdst untouched. Even though the
36 * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
37 * by the RTC when initially set to a non-zero value.
38 */
39 mach_hwclk(0, time);
40 return RTC_24H;
41}
42
43static inline int set_rtc_time(struct rtc_time *time)
44{
45 return mach_hwclk(1, time);
46}
47
48static inline unsigned int get_rtc_ss(void)
49{
50 if (mach_get_ss)
51 return mach_get_ss();
52 else{
53 struct rtc_time h;
54
55 get_rtc_time(&h);
56 return h.tm_sec;
57 }
58}
59
60static inline int get_rtc_pll(struct rtc_pll_info *pll)
61{
62 if (mach_get_rtc_pll)
63 return mach_get_rtc_pll(pll);
64 else
65 return -EINVAL;
66}
67static inline int set_rtc_pll(struct rtc_pll_info *pll)
68{
69 if (mach_set_rtc_pll)
70 return mach_set_rtc_pll(pll);
71 else
72 return -EINVAL;
73}
74#endif /* __KERNEL__ */
75
76#endif /* _ASM__RTC_H */