diff options
-rw-r--r-- | arch/blackfin/kernel/gptimers.c | 47 | ||||
-rw-r--r-- | include/asm-blackfin/gptimers.h | 2 |
2 files changed, 42 insertions, 7 deletions
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c index cb7ba9bfc79..5cf4bdb1df3 100644 --- a/arch/blackfin/kernel/gptimers.c +++ b/arch/blackfin/kernel/gptimers.c | |||
@@ -20,8 +20,7 @@ | |||
20 | #else | 20 | #else |
21 | # define tassert(expr) \ | 21 | # define tassert(expr) \ |
22 | if (!(expr)) \ | 22 | if (!(expr)) \ |
23 | printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", \ | 23 | printk(KERN_DEBUG "%s:%s:%i: Assertion failed: " #expr "\n", __FILE__, __func__, __LINE__); |
24 | __FILE__, __func__, __LINE__); | ||
25 | #endif | 24 | #endif |
26 | 25 | ||
27 | #define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1) | 26 | #define BFIN_TIMER_NUM_GROUP (BFIN_TIMER_OCTET(MAX_BLACKFIN_GPTIMERS - 1) + 1) |
@@ -70,7 +69,7 @@ static volatile GPTIMER_group_regs *const group_regs[BFIN_TIMER_NUM_GROUP] = | |||
70 | #endif | 69 | #endif |
71 | }; | 70 | }; |
72 | 71 | ||
73 | static uint32_t const dis_mask[MAX_BLACKFIN_GPTIMERS] = | 72 | static uint32_t const trun_mask[MAX_BLACKFIN_GPTIMERS] = |
74 | { | 73 | { |
75 | TIMER_STATUS_TRUN0, | 74 | TIMER_STATUS_TRUN0, |
76 | TIMER_STATUS_TRUN1, | 75 | TIMER_STATUS_TRUN1, |
@@ -90,7 +89,27 @@ static uint32_t const dis_mask[MAX_BLACKFIN_GPTIMERS] = | |||
90 | #endif | 89 | #endif |
91 | }; | 90 | }; |
92 | 91 | ||
93 | static uint32_t const irq_mask[MAX_BLACKFIN_GPTIMERS] = | 92 | static uint32_t const tovf_mask[MAX_BLACKFIN_GPTIMERS] = |
93 | { | ||
94 | TIMER_STATUS_TOVF0, | ||
95 | TIMER_STATUS_TOVF1, | ||
96 | TIMER_STATUS_TOVF2, | ||
97 | #if (MAX_BLACKFIN_GPTIMERS > 3) | ||
98 | TIMER_STATUS_TOVF3, | ||
99 | TIMER_STATUS_TOVF4, | ||
100 | TIMER_STATUS_TOVF5, | ||
101 | TIMER_STATUS_TOVF6, | ||
102 | TIMER_STATUS_TOVF7, | ||
103 | #endif | ||
104 | #if (MAX_BLACKFIN_GPTIMERS > 8) | ||
105 | TIMER_STATUS_TOVF8, | ||
106 | TIMER_STATUS_TOVF9, | ||
107 | TIMER_STATUS_TOVF10, | ||
108 | TIMER_STATUS_TOVF11, | ||
109 | #endif | ||
110 | }; | ||
111 | |||
112 | static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] = | ||
94 | { | 113 | { |
95 | TIMER_STATUS_TIMIL0, | 114 | TIMER_STATUS_TIMIL0, |
96 | TIMER_STATUS_TIMIL1, | 115 | TIMER_STATUS_TIMIL1, |
@@ -165,17 +184,31 @@ EXPORT_SYMBOL(set_gptimer_status); | |||
165 | uint16_t get_gptimer_intr(int timer_id) | 184 | uint16_t get_gptimer_intr(int timer_id) |
166 | { | 185 | { |
167 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 186 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
168 | return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & irq_mask[timer_id]) ? 1 : 0; | 187 | return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]) ? 1 : 0; |
169 | } | 188 | } |
170 | EXPORT_SYMBOL(get_gptimer_intr); | 189 | EXPORT_SYMBOL(get_gptimer_intr); |
171 | 190 | ||
172 | void clear_gptimer_intr(int timer_id) | 191 | void clear_gptimer_intr(int timer_id) |
173 | { | 192 | { |
174 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 193 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
175 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = irq_mask[timer_id]; | 194 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id]; |
176 | } | 195 | } |
177 | EXPORT_SYMBOL(clear_gptimer_intr); | 196 | EXPORT_SYMBOL(clear_gptimer_intr); |
178 | 197 | ||
198 | uint16_t get_gptimer_over(int timer_id) | ||
199 | { | ||
200 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | ||
201 | return (group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]) ? 1 : 0; | ||
202 | } | ||
203 | EXPORT_SYMBOL(get_gptimer_over); | ||
204 | |||
205 | void clear_gptimer_over(int timer_id) | ||
206 | { | ||
207 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | ||
208 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id]; | ||
209 | } | ||
210 | EXPORT_SYMBOL(clear_gptimer_over); | ||
211 | |||
179 | void set_gptimer_config(int timer_id, uint16_t config) | 212 | void set_gptimer_config(int timer_id, uint16_t config) |
180 | { | 213 | { |
181 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 214 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
@@ -214,7 +247,7 @@ void disable_gptimers(uint16_t mask) | |||
214 | } | 247 | } |
215 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) | 248 | for (i = 0; i < MAX_BLACKFIN_GPTIMERS; ++i) |
216 | if (mask & (1 << i)) | 249 | if (mask & (1 << i)) |
217 | group_regs[BFIN_TIMER_OCTET(i)]->status |= dis_mask[i]; | 250 | group_regs[BFIN_TIMER_OCTET(i)]->status |= trun_mask[i]; |
218 | SSYNC(); | 251 | SSYNC(); |
219 | } | 252 | } |
220 | EXPORT_SYMBOL(disable_gptimers); | 253 | EXPORT_SYMBOL(disable_gptimers); |
diff --git a/include/asm-blackfin/gptimers.h b/include/asm-blackfin/gptimers.h index c97ab03e43a..8265ea473d5 100644 --- a/include/asm-blackfin/gptimers.h +++ b/include/asm-blackfin/gptimers.h | |||
@@ -197,6 +197,8 @@ uint32_t get_gptimer_period (int timer_id); | |||
197 | uint32_t get_gptimer_count (int timer_id); | 197 | uint32_t get_gptimer_count (int timer_id); |
198 | uint16_t get_gptimer_intr (int timer_id); | 198 | uint16_t get_gptimer_intr (int timer_id); |
199 | void clear_gptimer_intr (int timer_id); | 199 | void clear_gptimer_intr (int timer_id); |
200 | uint16_t get_gptimer_over (int timer_id); | ||
201 | void clear_gptimer_over (int timer_id); | ||
200 | void set_gptimer_config (int timer_id, uint16_t config); | 202 | void set_gptimer_config (int timer_id, uint16_t config); |
201 | uint16_t get_gptimer_config (int timer_id); | 203 | uint16_t get_gptimer_config (int timer_id); |
202 | void set_gptimer_pulse_hi (int timer_id); | 204 | void set_gptimer_pulse_hi (int timer_id); |