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/errno.h>
17 #include <asm/intersil.h>
18 #include <asm/machdep.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)
27 int sun3_hwclk(int set
, struct rtc_time
*t
)
29 volatile struct intersil_dt
*todintersil
;
32 todintersil
= (struct intersil_dt
*) &intersil_clock
->counter
;
34 local_irq_save(flags
);
36 intersil_clock
->cmd_reg
= STOP_VAL
;
38 /* set or read the clock */
40 todintersil
->csec
= 0;
41 todintersil
->hour
= t
->tm_hour
;
42 todintersil
->minute
= t
->tm_min
;
43 todintersil
->second
= t
->tm_sec
;
44 todintersil
->month
= t
->tm_mon
+ 1;
45 todintersil
->day
= t
->tm_mday
;
46 todintersil
->year
= (t
->tm_year
- 68) % 100;
47 todintersil
->weekday
= t
->tm_wday
;
50 t
->tm_sec
= todintersil
->csec
;
51 t
->tm_hour
= todintersil
->hour
;
52 t
->tm_min
= todintersil
->minute
;
53 t
->tm_sec
= todintersil
->second
;
54 t
->tm_mon
= todintersil
->month
- 1;
55 t
->tm_mday
= todintersil
->day
;
56 t
->tm_year
= todintersil
->year
+ 68;
57 t
->tm_wday
= todintersil
->weekday
;
62 intersil_clock
->cmd_reg
= START_VAL
;
64 local_irq_restore(flags
);