1 /*
2  *
3  * This file is subject to the terms and conditions of the GNU General Public
4  * License.  See the file "COPYING" in the main directory of this archive
5  * for more details.
6  *
7  * Copyright (C) 2000-2003 Silicon Graphics, Inc. All rights reserved.
8  */
9 
10 /*
11  * This file contains definitions for accessing a platform supported high resolution
12  * clock. The clock is monitonically increasing and can be accessed from any node
13  * in the system. The clock is synchronized across nodes - all nodes see the
14  * same value.
15  *
16  *	RTC_COUNTER_ADDR - contains the address of the counter
17  *
18  *	GET_RTC_COUNTER() - macro to read the value of the clock
19  *
20  *	RTC_CYCLES_PER_SEC - clock frequency in ticks per second
21  *
22  */
23 
24 #ifndef _ASM_IA64_SN_CLKSUPPORT_H
25 #define _ASM_IA64_SN_CLKSUPPORT_H
26 
27 #include <linux/config.h>
28 #include <asm/sn/arch.h>
29 #include <asm/sn/addrs.h>
30 
31 typedef long clkreg_t;
32 
33 extern unsigned long sn_rtc_cycles_per_second;
34 extern unsigned long sn_rtc_usec_per_cyc;
35 extern unsigned long sn_rtc_per_itc;
36 extern unsigned long sn_rtc_delta;
37 
38 
39 #include <asm/sn/addrs.h>
40 #include <asm/sn/sn2/addrs.h>
41 #include <asm/sn/sn2/shubio.h>
42 #include <asm/sn/sn2/shub_mmr.h>
43 #define RTC_MASK		SH_RTC_MASK
44 #define RTC_COUNTER_ADDR	((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
45 #define RTC_COMPARE_A_ADDR      ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
46 #define RTC_COMPARE_B_ADDR      ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
47 #define RTC_INT_PENDING_A_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
48 #define RTC_INT_PENDING_B_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
49 #define RTC_INT_ENABLED_A_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
50 #define RTC_INT_ENABLED_B_ADDR  ((clkreg_t*)LOCAL_MMR_ADDR(SH_RTC))
51 
52 #define SN_RTC_PER_ITC_SHIFT	34
53 #define GET_RTC_COUNTER()	(*RTC_COUNTER_ADDR)
54 #define rtc_time()		GET_RTC_COUNTER()
55 
56 #define RTC_CYCLES_PER_SEC	sn_rtc_cycles_per_second
57 
58 #endif /* _ASM_IA64_SN_CLKSUPPORT_H */
59