2 * arch/m68k/sun3/intersil.c
4 * basic routines for accessing the intersil clock within the sun3 machines
6 * started 11/12/1999 Sam Creasey
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
13 #include <linux/kernel.h>
14 #include <linux/rtc.h>
16 #include <asm/system.h>
18 #include <asm/intersil.h>
21 /* bits to set for start/run of the intersil */
22 #define STOP_VAL (INTERSIL_STOP | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
23 #define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
25 /* does this need to be implemented? */
26 unsigned long sun3_gettimeoffset(void)
31 void sun3_gettod (int *yearp, int *monp, int *dayp,
32 int *hourp, int *minp, int *secp)
35 volatile struct intersil_dt* todintersil;
38 todintersil = (struct intersil_dt *) &intersil_clock->counter;
42 intersil_clock->cmd_reg = STOP_VAL;
44 *secp = todintersil->csec;
45 *hourp = todintersil->hour;
46 *minp = todintersil->minute;
47 *secp = todintersil->second;
48 *monp = todintersil->month;
49 *dayp = todintersil->day;
50 *yearp = todintersil->year+68; /* The base year for sun3 is 1968 */
51 wday = todintersil->weekday;
53 intersil_clock->cmd_reg = START_VAL;
61 int sun3_hwclk(int set, struct rtc_time *t)
63 volatile struct intersil_dt *todintersil;
66 todintersil = (struct intersil_dt *) &intersil_clock->counter;
70 intersil_clock->cmd_reg = STOP_VAL;
72 /* set or read the clock */
74 todintersil->csec = 0;
75 todintersil->hour = t->tm_hour;
76 todintersil->minute = t->tm_min;
77 todintersil->second = t->tm_sec;
78 todintersil->month = t->tm_mon;
79 todintersil->day = t->tm_mday;
80 todintersil->year = t->tm_year - 68;
81 todintersil->weekday = t->tm_wday;
84 t->tm_sec = todintersil->csec;
85 t->tm_hour = todintersil->hour;
86 t->tm_min = todintersil->minute;
87 t->tm_sec = todintersil->second;
88 t->tm_mon = todintersil->month;
89 t->tm_mday = todintersil->day;
90 t->tm_year = todintersil->year + 68;
91 t->tm_wday = todintersil->weekday;
94 intersil_clock->cmd_reg = START_VAL;