]>
git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blob - arch/mn10300/unit-asb2364/include/unit/timex.h
1 /* timex.h: MN2WS0038 architecture timer specifications
3 * Copyright (C) 2002 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
11 #ifndef _ASM_UNIT_TIMEX_H
12 #define _ASM_UNIT_TIMEX_H
15 #include <linux/irq.h>
16 #endif /* __ASSEMBLY__ */
18 #include <asm/timer-regs.h>
19 #include <unit/clock.h>
20 #include <asm/param.h>
23 * jiffies counter specifications
26 #define TMJCBR_MAX 0xffffff /* 24bit */
31 #define TMJCIRQ TMTIRQ
32 #define TMJCICR TMTICR
36 #define MN10300_SRC_IOBCLK MN10300_IOBCLK
39 # error HZ undeclared.
42 #define MN10300_JCCLK (MN10300_SRC_IOBCLK)
43 #define MN10300_TSCCLK (MN10300_SRC_IOBCLK)
45 #define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ)
46 #define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ)
48 /* Check bit width of MTM interval value that sets base register */
49 #if (MN10300_JC_PER_HZ - 1) > TMJCBR_MAX
50 # error MTM tick timer interval value is overflow.
54 static inline void startup_jiffies_counter(void)
58 TMJCBR
= MN10300_JC_PER_HZ
- 1;
61 TMJCMD
= TMTMD_TMTLDE
;
62 TMJCMD
= TMTMD_TMTCNE
;
65 TMJCICR
|= GxICR_ENABLE
| GxICR_DETECT
| GxICR_REQUEST
;
69 static inline void shutdown_jiffies_counter(void)
73 #endif /* !__ASSEMBLY__ */
77 * timestamp counter specifications
80 #define TMTSCBR_MAX 0xffffffff
84 #define TMTSCICR TMSICR
88 static inline void startup_timestamp_counter(void)
92 /* set up TMS(Timestamp) 32bit timer register to count real time
93 * - count down from 4Gig-1 to 0 and wrap at IOBCLK rate
96 TMTSCBR
= TMTSCBR_MAX
;
102 TMTSCMD
= TMTMD_TMTLDE
;
103 TMTSCMD
= TMTMD_TMTCNE
;
107 static inline void shutdown_timestamp_counter(void)
113 * we use a cascaded pair of 16-bit down-counting timers to count I/O
114 * clock cycles for the purposes of time keeping
116 typedef unsigned long cycles_t
;
118 static inline cycles_t
read_timestamp_counter(void)
120 return (cycles_t
)TMTSCBC
;
123 #endif /* !__ASSEMBLY__ */
125 #endif /* _ASM_UNIT_TIMEX_H */