2 * linux/arch/m68k/sun3x/time.c
4 * Sun3x-specific time handling
7 #include <linux/types.h>
8 #include <linux/init.h>
9 #include <linux/sched.h>
10 #include <linux/kernel_stat.h>
11 #include <linux/interrupt.h>
15 #include <asm/system.h>
16 #include <asm/traps.h>
17 #include <asm/sun3x.h>
21 #define M_CONTROL 0xf8
35 #define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10)
38 void sun3x_gettod (int *yearp
, int *monp
, int *dayp
,
39 int *hourp
, int *minp
, int *secp
)
41 volatile unsigned char *eeprom
= (unsigned char *)SUN3X_EEPROM
;
44 *(eeprom
+ M_CONTROL
) |= C_READ
;
47 *yearp
= BCD_TO_BIN(*(eeprom
+ M_YEAR
));
48 *monp
= BCD_TO_BIN(*(eeprom
+ M_MONTH
));
49 *dayp
= BCD_TO_BIN(*(eeprom
+ M_DATE
));
50 *hourp
= BCD_TO_BIN(*(eeprom
+ M_HOUR
));
51 *minp
= BCD_TO_BIN(*(eeprom
+ M_MIN
));
52 *secp
= BCD_TO_BIN(*(eeprom
+ M_SEC
));
55 *(eeprom
+ M_CONTROL
) &= ~C_READ
;
58 /* Not much we can do here */
59 unsigned long sun3x_gettimeoffset (void)
64 static void sun3x_timer_tick(int irq
, void *dev_id
, struct pt_regs
*regs
)
66 void (*vector
)(int, void *, struct pt_regs
*) = dev_id
;
68 /* Clear the pending interrupt - pulse the enable line low */
72 vector(irq
, NULL
, regs
);
75 void __init
sun3x_sched_init(void (*vector
)(int, void *, struct pt_regs
*))
77 sys_request_irq(5, sun3x_timer_tick
, IRQ_FLG_STD
, "timer tick", vector
);
79 /* Pulse enable low to get the clock started */