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/m68k/sun3/intersil.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/m68k/sun3/intersil.c')
-rw-r--r-- | arch/m68k/sun3/intersil.c | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c new file mode 100644 index 000000000000..db359d7402a6 --- /dev/null +++ b/arch/m68k/sun3/intersil.c | |||
@@ -0,0 +1,76 @@ | |||
1 | /* | ||
2 | * arch/m68k/sun3/intersil.c | ||
3 | * | ||
4 | * basic routines for accessing the intersil clock within the sun3 machines | ||
5 | * | ||
6 | * started 11/12/1999 Sam Creasey | ||
7 | * | ||
8 | * This file is subject to the terms and conditions of the GNU General Public | ||
9 | * License. See the file COPYING in the main directory of this archive | ||
10 | * for more details. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/rtc.h> | ||
15 | |||
16 | #include <asm/errno.h> | ||
17 | #include <asm/system.h> | ||
18 | #include <asm/semaphore.h> | ||
19 | #include <asm/rtc.h> | ||
20 | #include <asm/intersil.h> | ||
21 | |||
22 | |||
23 | /* bits to set for start/run of the intersil */ | ||
24 | #define STOP_VAL (INTERSIL_STOP | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE) | ||
25 | #define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE) | ||
26 | |||
27 | /* does this need to be implemented? */ | ||
28 | unsigned long sun3_gettimeoffset(void) | ||
29 | { | ||
30 | return 1; | ||
31 | } | ||
32 | |||
33 | |||
34 | /* get/set hwclock */ | ||
35 | |||
36 | int sun3_hwclk(int set, struct rtc_time *t) | ||
37 | { | ||
38 | volatile struct intersil_dt *todintersil; | ||
39 | unsigned long flags; | ||
40 | |||
41 | todintersil = (struct intersil_dt *) &intersil_clock->counter; | ||
42 | |||
43 | local_irq_save(flags); | ||
44 | |||
45 | intersil_clock->cmd_reg = STOP_VAL; | ||
46 | |||
47 | /* set or read the clock */ | ||
48 | if(set) { | ||
49 | todintersil->csec = 0; | ||
50 | todintersil->hour = t->tm_hour; | ||
51 | todintersil->minute = t->tm_min; | ||
52 | todintersil->second = t->tm_sec; | ||
53 | todintersil->month = t->tm_mon; | ||
54 | todintersil->day = t->tm_mday; | ||
55 | todintersil->year = t->tm_year - 68; | ||
56 | todintersil->weekday = t->tm_wday; | ||
57 | } else { | ||
58 | /* read clock */ | ||
59 | t->tm_sec = todintersil->csec; | ||
60 | t->tm_hour = todintersil->hour; | ||
61 | t->tm_min = todintersil->minute; | ||
62 | t->tm_sec = todintersil->second; | ||
63 | t->tm_mon = todintersil->month; | ||
64 | t->tm_mday = todintersil->day; | ||
65 | t->tm_year = todintersil->year + 68; | ||
66 | t->tm_wday = todintersil->weekday; | ||
67 | } | ||
68 | |||
69 | intersil_clock->cmd_reg = START_VAL; | ||
70 | |||
71 | local_irq_restore(flags); | ||
72 | |||
73 | return 0; | ||
74 | |||
75 | } | ||
76 | |||