diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-08 15:21:04 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-08 15:21:04 -0500 |
commit | 988addf82e4c03739375279de73929580a2d4a6a (patch) | |
tree | 989ae1cd4e264bbad80c65f04480486246e7b9f3 /arch/arm/plat-omap/dmtimer.c | |
parent | 004c1c7096659d352b83047a7593e91d8a30e3c5 (diff) | |
parent | 25cf84cf377c0aae5dbcf937ea89bc7893db5176 (diff) |
Merge branch 'origin' into devel-stable
Conflicts:
arch/arm/mach-mx2/devices.c
arch/arm/mach-mx2/devices.h
sound/soc/pxa/pxa-ssp.c
Diffstat (limited to 'arch/arm/plat-omap/dmtimer.c')
-rw-r--r-- | arch/arm/plat-omap/dmtimer.c | 126 |
1 files changed, 55 insertions, 71 deletions
diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c index 08ccf8922520..4d99dfbc8bef 100644 --- a/arch/arm/plat-omap/dmtimer.c +++ b/arch/arm/plat-omap/dmtimer.c | |||
@@ -153,8 +153,7 @@ | |||
153 | struct omap_dm_timer { | 153 | struct omap_dm_timer { |
154 | unsigned long phys_base; | 154 | unsigned long phys_base; |
155 | int irq; | 155 | int irq; |
156 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 156 | #ifdef CONFIG_ARCH_OMAP2PLUS |
157 | defined(CONFIG_ARCH_OMAP4) | ||
158 | struct clk *iclk, *fclk; | 157 | struct clk *iclk, *fclk; |
159 | #endif | 158 | #endif |
160 | void __iomem *io_base; | 159 | void __iomem *io_base; |
@@ -163,20 +162,9 @@ struct omap_dm_timer { | |||
163 | unsigned posted:1; | 162 | unsigned posted:1; |
164 | }; | 163 | }; |
165 | 164 | ||
166 | #ifdef CONFIG_ARCH_OMAP1 | 165 | static int dm_timer_count; |
167 | |||
168 | #define omap_dm_clk_enable(x) | ||
169 | #define omap_dm_clk_disable(x) | ||
170 | #define omap2_dm_timers NULL | ||
171 | #define omap2_dm_source_names NULL | ||
172 | #define omap2_dm_source_clocks NULL | ||
173 | #define omap3_dm_timers NULL | ||
174 | #define omap3_dm_source_names NULL | ||
175 | #define omap3_dm_source_clocks NULL | ||
176 | #define omap4_dm_timers NULL | ||
177 | #define omap4_dm_source_names NULL | ||
178 | #define omap4_dm_source_clocks NULL | ||
179 | 166 | ||
167 | #ifdef CONFIG_ARCH_OMAP1 | ||
180 | static struct omap_dm_timer omap1_dm_timers[] = { | 168 | static struct omap_dm_timer omap1_dm_timers[] = { |
181 | { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, | 169 | { .phys_base = 0xfffb1400, .irq = INT_1610_GPTIMER1 }, |
182 | { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, | 170 | { .phys_base = 0xfffb1c00, .irq = INT_1610_GPTIMER2 }, |
@@ -188,20 +176,14 @@ static struct omap_dm_timer omap1_dm_timers[] = { | |||
188 | { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, | 176 | { .phys_base = 0xfffbd400, .irq = INT_1610_GPTIMER8 }, |
189 | }; | 177 | }; |
190 | 178 | ||
191 | static const int dm_timer_count = ARRAY_SIZE(omap1_dm_timers); | 179 | static const int omap1_dm_timer_count = ARRAY_SIZE(omap1_dm_timers); |
192 | |||
193 | #elif defined(CONFIG_ARCH_OMAP2) | ||
194 | 180 | ||
195 | #define omap_dm_clk_enable(x) clk_enable(x) | 181 | #else |
196 | #define omap_dm_clk_disable(x) clk_disable(x) | ||
197 | #define omap1_dm_timers NULL | 182 | #define omap1_dm_timers NULL |
198 | #define omap3_dm_timers NULL | 183 | #define omap1_dm_timer_count 0 |
199 | #define omap3_dm_source_names NULL | 184 | #endif /* CONFIG_ARCH_OMAP1 */ |
200 | #define omap3_dm_source_clocks NULL | ||
201 | #define omap4_dm_timers NULL | ||
202 | #define omap4_dm_source_names NULL | ||
203 | #define omap4_dm_source_clocks NULL | ||
204 | 185 | ||
186 | #ifdef CONFIG_ARCH_OMAP2 | ||
205 | static struct omap_dm_timer omap2_dm_timers[] = { | 187 | static struct omap_dm_timer omap2_dm_timers[] = { |
206 | { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, | 188 | { .phys_base = 0x48028000, .irq = INT_24XX_GPTIMER1 }, |
207 | { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, | 189 | { .phys_base = 0x4802a000, .irq = INT_24XX_GPTIMER2 }, |
@@ -225,20 +207,16 @@ static const char *omap2_dm_source_names[] __initdata = { | |||
225 | }; | 207 | }; |
226 | 208 | ||
227 | static struct clk *omap2_dm_source_clocks[3]; | 209 | static struct clk *omap2_dm_source_clocks[3]; |
228 | static const int dm_timer_count = ARRAY_SIZE(omap2_dm_timers); | 210 | static const int omap2_dm_timer_count = ARRAY_SIZE(omap2_dm_timers); |
229 | 211 | ||
230 | #elif defined(CONFIG_ARCH_OMAP3) | 212 | #else |
231 | |||
232 | #define omap_dm_clk_enable(x) clk_enable(x) | ||
233 | #define omap_dm_clk_disable(x) clk_disable(x) | ||
234 | #define omap1_dm_timers NULL | ||
235 | #define omap2_dm_timers NULL | 213 | #define omap2_dm_timers NULL |
214 | #define omap2_dm_timer_count 0 | ||
236 | #define omap2_dm_source_names NULL | 215 | #define omap2_dm_source_names NULL |
237 | #define omap2_dm_source_clocks NULL | 216 | #define omap2_dm_source_clocks NULL |
238 | #define omap4_dm_timers NULL | 217 | #endif /* CONFIG_ARCH_OMAP2 */ |
239 | #define omap4_dm_source_names NULL | ||
240 | #define omap4_dm_source_clocks NULL | ||
241 | 218 | ||
219 | #ifdef CONFIG_ARCH_OMAP3 | ||
242 | static struct omap_dm_timer omap3_dm_timers[] = { | 220 | static struct omap_dm_timer omap3_dm_timers[] = { |
243 | { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 }, | 221 | { .phys_base = 0x48318000, .irq = INT_24XX_GPTIMER1 }, |
244 | { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 }, | 222 | { .phys_base = 0x49032000, .irq = INT_24XX_GPTIMER2 }, |
@@ -261,33 +239,29 @@ static const char *omap3_dm_source_names[] __initdata = { | |||
261 | }; | 239 | }; |
262 | 240 | ||
263 | static struct clk *omap3_dm_source_clocks[2]; | 241 | static struct clk *omap3_dm_source_clocks[2]; |
264 | static const int dm_timer_count = ARRAY_SIZE(omap3_dm_timers); | 242 | static const int omap3_dm_timer_count = ARRAY_SIZE(omap3_dm_timers); |
265 | |||
266 | #elif defined(CONFIG_ARCH_OMAP4) | ||
267 | 243 | ||
268 | #define omap_dm_clk_enable(x) clk_enable(x) | 244 | #else |
269 | #define omap_dm_clk_disable(x) clk_disable(x) | ||
270 | #define omap1_dm_timers NULL | ||
271 | #define omap2_dm_timers NULL | ||
272 | #define omap2_dm_source_names NULL | ||
273 | #define omap2_dm_source_clocks NULL | ||
274 | #define omap3_dm_timers NULL | 245 | #define omap3_dm_timers NULL |
246 | #define omap3_dm_timer_count 0 | ||
275 | #define omap3_dm_source_names NULL | 247 | #define omap3_dm_source_names NULL |
276 | #define omap3_dm_source_clocks NULL | 248 | #define omap3_dm_source_clocks NULL |
249 | #endif /* CONFIG_ARCH_OMAP3 */ | ||
277 | 250 | ||
251 | #ifdef CONFIG_ARCH_OMAP4 | ||
278 | static struct omap_dm_timer omap4_dm_timers[] = { | 252 | static struct omap_dm_timer omap4_dm_timers[] = { |
279 | { .phys_base = 0x4a318000, .irq = INT_44XX_GPTIMER1 }, | 253 | { .phys_base = 0x4a318000, .irq = OMAP44XX_IRQ_GPT1 }, |
280 | { .phys_base = 0x48032000, .irq = INT_44XX_GPTIMER2 }, | 254 | { .phys_base = 0x48032000, .irq = OMAP44XX_IRQ_GPT2 }, |
281 | { .phys_base = 0x48034000, .irq = INT_44XX_GPTIMER3 }, | 255 | { .phys_base = 0x48034000, .irq = OMAP44XX_IRQ_GPT3 }, |
282 | { .phys_base = 0x48036000, .irq = INT_44XX_GPTIMER4 }, | 256 | { .phys_base = 0x48036000, .irq = OMAP44XX_IRQ_GPT4 }, |
283 | { .phys_base = 0x40138000, .irq = INT_44XX_GPTIMER5 }, | 257 | { .phys_base = 0x40138000, .irq = OMAP44XX_IRQ_GPT5 }, |
284 | { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER6 }, | 258 | { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT6 }, |
285 | { .phys_base = 0x4013a000, .irq = INT_44XX_GPTIMER7 }, | 259 | { .phys_base = 0x4013a000, .irq = OMAP44XX_IRQ_GPT7 }, |
286 | { .phys_base = 0x4013e000, .irq = INT_44XX_GPTIMER8 }, | 260 | { .phys_base = 0x4013e000, .irq = OMAP44XX_IRQ_GPT8 }, |
287 | { .phys_base = 0x4803e000, .irq = INT_44XX_GPTIMER9 }, | 261 | { .phys_base = 0x4803e000, .irq = OMAP44XX_IRQ_GPT9 }, |
288 | { .phys_base = 0x48086000, .irq = INT_44XX_GPTIMER10 }, | 262 | { .phys_base = 0x48086000, .irq = OMAP44XX_IRQ_GPT10 }, |
289 | { .phys_base = 0x48088000, .irq = INT_44XX_GPTIMER11 }, | 263 | { .phys_base = 0x48088000, .irq = OMAP44XX_IRQ_GPT11 }, |
290 | { .phys_base = 0x4a320000, .irq = INT_44XX_GPTIMER12 }, | 264 | { .phys_base = 0x4a320000, .irq = OMAP44XX_IRQ_GPT12 }, |
291 | }; | 265 | }; |
292 | static const char *omap4_dm_source_names[] __initdata = { | 266 | static const char *omap4_dm_source_names[] __initdata = { |
293 | "sys_ck", | 267 | "sys_ck", |
@@ -295,13 +269,14 @@ static const char *omap4_dm_source_names[] __initdata = { | |||
295 | NULL | 269 | NULL |
296 | }; | 270 | }; |
297 | static struct clk *omap4_dm_source_clocks[2]; | 271 | static struct clk *omap4_dm_source_clocks[2]; |
298 | static const int dm_timer_count = ARRAY_SIZE(omap4_dm_timers); | 272 | static const int omap4_dm_timer_count = ARRAY_SIZE(omap4_dm_timers); |
299 | 273 | ||
300 | #else | 274 | #else |
301 | 275 | #define omap4_dm_timers NULL | |
302 | #error OMAP architecture not supported! | 276 | #define omap4_dm_timer_count 0 |
303 | 277 | #define omap4_dm_source_names NULL | |
304 | #endif | 278 | #define omap4_dm_source_clocks NULL |
279 | #endif /* CONFIG_ARCH_OMAP4 */ | ||
305 | 280 | ||
306 | static struct omap_dm_timer *dm_timers; | 281 | static struct omap_dm_timer *dm_timers; |
307 | static const char **dm_source_names; | 282 | static const char **dm_source_names; |
@@ -450,8 +425,12 @@ void omap_dm_timer_enable(struct omap_dm_timer *timer) | |||
450 | if (timer->enabled) | 425 | if (timer->enabled) |
451 | return; | 426 | return; |
452 | 427 | ||
453 | omap_dm_clk_enable(timer->fclk); | 428 | #ifdef CONFIG_ARCH_OMAP2PLUS |
454 | omap_dm_clk_enable(timer->iclk); | 429 | if (cpu_class_is_omap2()) { |
430 | clk_enable(timer->fclk); | ||
431 | clk_enable(timer->iclk); | ||
432 | } | ||
433 | #endif | ||
455 | 434 | ||
456 | timer->enabled = 1; | 435 | timer->enabled = 1; |
457 | } | 436 | } |
@@ -462,8 +441,12 @@ void omap_dm_timer_disable(struct omap_dm_timer *timer) | |||
462 | if (!timer->enabled) | 441 | if (!timer->enabled) |
463 | return; | 442 | return; |
464 | 443 | ||
465 | omap_dm_clk_disable(timer->iclk); | 444 | #ifdef CONFIG_ARCH_OMAP2PLUS |
466 | omap_dm_clk_disable(timer->fclk); | 445 | if (cpu_class_is_omap2()) { |
446 | clk_disable(timer->iclk); | ||
447 | clk_disable(timer->fclk); | ||
448 | } | ||
449 | #endif | ||
467 | 450 | ||
468 | timer->enabled = 0; | 451 | timer->enabled = 0; |
469 | } | 452 | } |
@@ -506,8 +489,7 @@ __u32 omap_dm_timer_modify_idlect_mask(__u32 inputmask) | |||
506 | } | 489 | } |
507 | EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); | 490 | EXPORT_SYMBOL_GPL(omap_dm_timer_modify_idlect_mask); |
508 | 491 | ||
509 | #elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 492 | #else |
510 | defined(CONFIG_ARCH_OMAP4) | ||
511 | 493 | ||
512 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) | 494 | struct clk *omap_dm_timer_get_fclk(struct omap_dm_timer *timer) |
513 | { | 495 | { |
@@ -551,8 +533,7 @@ void omap_dm_timer_stop(struct omap_dm_timer *timer) | |||
551 | if (l & OMAP_TIMER_CTRL_ST) { | 533 | if (l & OMAP_TIMER_CTRL_ST) { |
552 | l &= ~0x1; | 534 | l &= ~0x1; |
553 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); | 535 | omap_dm_timer_write_reg(timer, OMAP_TIMER_CTRL_REG, l); |
554 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 536 | #ifdef CONFIG_ARCH_OMAP2PLUS |
555 | defined(CONFIG_ARCH_OMAP4) | ||
556 | /* Readback to make sure write has completed */ | 537 | /* Readback to make sure write has completed */ |
557 | omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); | 538 | omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG); |
558 | /* | 539 | /* |
@@ -764,17 +745,21 @@ int __init omap_dm_timer_init(void) | |||
764 | 745 | ||
765 | if (cpu_class_is_omap1()) { | 746 | if (cpu_class_is_omap1()) { |
766 | dm_timers = omap1_dm_timers; | 747 | dm_timers = omap1_dm_timers; |
748 | dm_timer_count = omap1_dm_timer_count; | ||
767 | map_size = SZ_2K; | 749 | map_size = SZ_2K; |
768 | } else if (cpu_is_omap24xx()) { | 750 | } else if (cpu_is_omap24xx()) { |
769 | dm_timers = omap2_dm_timers; | 751 | dm_timers = omap2_dm_timers; |
752 | dm_timer_count = omap2_dm_timer_count; | ||
770 | dm_source_names = omap2_dm_source_names; | 753 | dm_source_names = omap2_dm_source_names; |
771 | dm_source_clocks = omap2_dm_source_clocks; | 754 | dm_source_clocks = omap2_dm_source_clocks; |
772 | } else if (cpu_is_omap34xx()) { | 755 | } else if (cpu_is_omap34xx()) { |
773 | dm_timers = omap3_dm_timers; | 756 | dm_timers = omap3_dm_timers; |
757 | dm_timer_count = omap3_dm_timer_count; | ||
774 | dm_source_names = omap3_dm_source_names; | 758 | dm_source_names = omap3_dm_source_names; |
775 | dm_source_clocks = omap3_dm_source_clocks; | 759 | dm_source_clocks = omap3_dm_source_clocks; |
776 | } else if (cpu_is_omap44xx()) { | 760 | } else if (cpu_is_omap44xx()) { |
777 | dm_timers = omap4_dm_timers; | 761 | dm_timers = omap4_dm_timers; |
762 | dm_timer_count = omap4_dm_timer_count; | ||
778 | dm_source_names = omap4_dm_source_names; | 763 | dm_source_names = omap4_dm_source_names; |
779 | dm_source_clocks = omap4_dm_source_clocks; | 764 | dm_source_clocks = omap4_dm_source_clocks; |
780 | } | 765 | } |
@@ -793,8 +778,7 @@ int __init omap_dm_timer_init(void) | |||
793 | timer->io_base = ioremap(timer->phys_base, map_size); | 778 | timer->io_base = ioremap(timer->phys_base, map_size); |
794 | BUG_ON(!timer->io_base); | 779 | BUG_ON(!timer->io_base); |
795 | 780 | ||
796 | #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \ | 781 | #ifdef CONFIG_ARCH_OMAP2PLUS |
797 | defined(CONFIG_ARCH_OMAP4) | ||
798 | if (cpu_class_is_omap2()) { | 782 | if (cpu_class_is_omap2()) { |
799 | char clk_name[16]; | 783 | char clk_name[16]; |
800 | sprintf(clk_name, "gpt%d_ick", i + 1); | 784 | sprintf(clk_name, "gpt%d_ick", i + 1); |