diff options
author | Mark Salter <msalter@redhat.com> | 2010-10-27 12:28:57 -0400 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2010-10-27 12:28:57 -0400 |
commit | 730c1fad0ee22a170d2ee76a904709ee304931c0 (patch) | |
tree | 365289c84b02c5c54d43238f2bc9b14b143cafbc /arch/mn10300/unit-asb2303 | |
parent | 2502c64eeb125c5d57e3e7dc38320b500d69e088 (diff) |
MN10300: Generic time support
Implement generic time support for MN10300.
Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'arch/mn10300/unit-asb2303')
-rw-r--r-- | arch/mn10300/unit-asb2303/include/unit/timex.h | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/arch/mn10300/unit-asb2303/include/unit/timex.h b/arch/mn10300/unit-asb2303/include/unit/timex.h index d1b8dafe7d7..cc18fe7d8b9 100644 --- a/arch/mn10300/unit-asb2303/include/unit/timex.h +++ b/arch/mn10300/unit-asb2303/include/unit/timex.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* ASB2303-specific timer specifications | 1 | /* ASB2303-specific timer specifications |
2 | * | 2 | * |
3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2007, 2010 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -24,10 +24,6 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #define TMJCBR_MAX 0xffff | 26 | #define TMJCBR_MAX 0xffff |
27 | #define TMJCBC TM01BC | ||
28 | |||
29 | #define TMJCMD TM01MD | ||
30 | #define TMJCBR TM01BR | ||
31 | #define TMJCIRQ TM1IRQ | 27 | #define TMJCIRQ TM1IRQ |
32 | #define TMJCICR TM1ICR | 28 | #define TMJCICR TM1ICR |
33 | 29 | ||
@@ -61,34 +57,32 @@ | |||
61 | #define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) | 57 | #define MN10300_JC_PER_HZ ((MN10300_JCCLK + HZ / 2) / HZ) |
62 | #define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) | 58 | #define MN10300_TSC_PER_HZ ((MN10300_TSCCLK + HZ / 2) / HZ) |
63 | 59 | ||
64 | static inline void startup_jiffies_counter(void) | 60 | static inline void stop_jiffies_counter(void) |
65 | { | 61 | { |
66 | u16 md, t16; | 62 | u16 tmp; |
63 | TM01MD = JC_TIMER_CLKSRC | TM1MD_SRC_TM0CASCADE << 8; | ||
64 | tmp = TM01MD; | ||
65 | } | ||
67 | 66 | ||
68 | md = JC_TIMER_CLKSRC; | 67 | static inline void reload_jiffies_counter(u32 cnt) |
69 | TMJCBR = MN10300_JC_PER_HZ - 1; | 68 | { |
70 | t16 = TMJCBR; | 69 | u32 tmp; |
71 | 70 | ||
72 | TMJCMD = | 71 | TM01BR = cnt; |
73 | md | | 72 | tmp = TM01BR; |
74 | TM1MD_SRC_TM0CASCADE << 8 | | ||
75 | TM0MD_INIT_COUNTER | | ||
76 | TM1MD_INIT_COUNTER << 8; | ||
77 | 73 | ||
78 | TMJCMD = | 74 | TM01MD = JC_TIMER_CLKSRC | \ |
79 | md | | 75 | TM1MD_SRC_TM0CASCADE << 8 | \ |
80 | TM1MD_SRC_TM0CASCADE << 8 | | 76 | TM0MD_INIT_COUNTER | \ |
81 | TM0MD_COUNT_ENABLE | | 77 | TM1MD_INIT_COUNTER << 8; |
82 | TM1MD_COUNT_ENABLE << 8; | ||
83 | 78 | ||
84 | t16 = TMJCMD; | ||
85 | 79 | ||
86 | TMJCICR |= GxICR_ENABLE | GxICR_DETECT | GxICR_REQUEST; | 80 | TM01MD = JC_TIMER_CLKSRC | \ |
87 | t16 = TMJCICR; | 81 | TM1MD_SRC_TM0CASCADE << 8 | \ |
88 | } | 82 | TM0MD_COUNT_ENABLE | \ |
83 | TM1MD_COUNT_ENABLE << 8; | ||
89 | 84 | ||
90 | static inline void shutdown_jiffies_counter(void) | 85 | tmp = TM01MD; |
91 | { | ||
92 | } | 86 | } |
93 | 87 | ||
94 | #endif /* !__ASSEMBLY__ */ | 88 | #endif /* !__ASSEMBLY__ */ |
@@ -148,7 +142,7 @@ typedef unsigned long cycles_t; | |||
148 | 142 | ||
149 | static inline cycles_t read_timestamp_counter(void) | 143 | static inline cycles_t read_timestamp_counter(void) |
150 | { | 144 | { |
151 | return (cycles_t)TMTSCBC; | 145 | return (cycles_t)~TMTSCBC; |
152 | } | 146 | } |
153 | 147 | ||
154 | #endif /* !__ASSEMBLY__ */ | 148 | #endif /* !__ASSEMBLY__ */ |