diff options
Diffstat (limited to 'arch/arm/mach-omap2/timer.c')
-rw-r--r-- | arch/arm/mach-omap2/timer.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index b8ad6e632bb8..f62b509ed08d 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
@@ -131,7 +131,6 @@ static void omap2_gp_timer_set_mode(enum clock_event_mode mode, | |||
131 | static struct clock_event_device clockevent_gpt = { | 131 | static struct clock_event_device clockevent_gpt = { |
132 | .name = "gp_timer", | 132 | .name = "gp_timer", |
133 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, | 133 | .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, |
134 | .shift = 32, | ||
135 | .rating = 300, | 134 | .rating = 300, |
136 | .set_next_event = omap2_gp_timer_set_next_event, | 135 | .set_next_event = omap2_gp_timer_set_next_event, |
137 | .set_mode = omap2_gp_timer_set_mode, | 136 | .set_mode = omap2_gp_timer_set_mode, |
@@ -228,7 +227,7 @@ static int __init omap_dm_timer_init_one(struct omap_dm_timer *timer, | |||
228 | int r = 0; | 227 | int r = 0; |
229 | 228 | ||
230 | if (of_have_populated_dt()) { | 229 | if (of_have_populated_dt()) { |
231 | np = omap_get_timer_dt(omap_timer_match, NULL); | 230 | np = omap_get_timer_dt(omap_timer_match, property); |
232 | if (!np) | 231 | if (!np) |
233 | return -ENODEV; | 232 | return -ENODEV; |
234 | 233 | ||
@@ -336,17 +335,11 @@ static void __init omap2_gp_clockevent_init(int gptimer_id, | |||
336 | 335 | ||
337 | __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); | 336 | __omap_dm_timer_int_enable(&clkev, OMAP_TIMER_INT_OVERFLOW); |
338 | 337 | ||
339 | clockevent_gpt.mult = div_sc(clkev.rate, NSEC_PER_SEC, | ||
340 | clockevent_gpt.shift); | ||
341 | clockevent_gpt.max_delta_ns = | ||
342 | clockevent_delta2ns(0xffffffff, &clockevent_gpt); | ||
343 | clockevent_gpt.min_delta_ns = | ||
344 | clockevent_delta2ns(3, &clockevent_gpt); | ||
345 | /* Timer internal resynch latency. */ | ||
346 | |||
347 | clockevent_gpt.cpumask = cpu_possible_mask; | 338 | clockevent_gpt.cpumask = cpu_possible_mask; |
348 | clockevent_gpt.irq = omap_dm_timer_get_irq(&clkev); | 339 | clockevent_gpt.irq = omap_dm_timer_get_irq(&clkev); |
349 | clockevents_register_device(&clockevent_gpt); | 340 | clockevents_config_and_register(&clockevent_gpt, clkev.rate, |
341 | 3, /* Timer internal resynch latency */ | ||
342 | 0xffffffff); | ||
350 | 343 | ||
351 | pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", | 344 | pr_info("OMAP clockevent source: GPTIMER%d at %lu Hz\n", |
352 | gptimer_id, clkev.rate); | 345 | gptimer_id, clkev.rate); |
@@ -552,8 +545,10 @@ static inline void __init realtime_counter_init(void) | |||
552 | 545 | ||
553 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 546 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
554 | clksrc_nr, clksrc_src) \ | 547 | clksrc_nr, clksrc_src) \ |
555 | static void __init omap##name##_gptimer_timer_init(void) \ | 548 | void __init omap##name##_gptimer_timer_init(void) \ |
556 | { \ | 549 | { \ |
550 | if (omap_clk_init) \ | ||
551 | omap_clk_init(); \ | ||
557 | omap_dmtimer_init(); \ | 552 | omap_dmtimer_init(); \ |
558 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 553 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
559 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ | 554 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ |
@@ -561,8 +556,10 @@ static void __init omap##name##_gptimer_timer_init(void) \ | |||
561 | 556 | ||
562 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 557 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
563 | clksrc_nr, clksrc_src) \ | 558 | clksrc_nr, clksrc_src) \ |
564 | static void __init omap##name##_sync32k_timer_init(void) \ | 559 | void __init omap##name##_sync32k_timer_init(void) \ |
565 | { \ | 560 | { \ |
561 | if (omap_clk_init) \ | ||
562 | omap_clk_init(); \ | ||
566 | omap_dmtimer_init(); \ | 563 | omap_dmtimer_init(); \ |
567 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 564 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
568 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ | 565 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ |
@@ -572,33 +569,23 @@ static void __init omap##name##_sync32k_timer_init(void) \ | |||
572 | omap2_sync32k_clocksource_init(); \ | 569 | omap2_sync32k_clocksource_init(); \ |
573 | } | 570 | } |
574 | 571 | ||
575 | #define OMAP_SYS_TIMER(name, clksrc) \ | ||
576 | struct sys_timer omap##name##_timer = { \ | ||
577 | .init = omap##name##_##clksrc##_timer_init, \ | ||
578 | }; | ||
579 | |||
580 | #ifdef CONFIG_ARCH_OMAP2 | 572 | #ifdef CONFIG_ARCH_OMAP2 |
581 | OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", | 573 | OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", |
582 | 2, OMAP2_MPU_SOURCE); | 574 | 2, OMAP2_MPU_SOURCE); |
583 | OMAP_SYS_TIMER(2, sync32k); | ||
584 | #endif /* CONFIG_ARCH_OMAP2 */ | 575 | #endif /* CONFIG_ARCH_OMAP2 */ |
585 | 576 | ||
586 | #ifdef CONFIG_ARCH_OMAP3 | 577 | #ifdef CONFIG_ARCH_OMAP3 |
587 | OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", | 578 | OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", |
588 | 2, OMAP3_MPU_SOURCE); | 579 | 2, OMAP3_MPU_SOURCE); |
589 | OMAP_SYS_TIMER(3, sync32k); | ||
590 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", | 580 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", |
591 | 2, OMAP3_MPU_SOURCE); | 581 | 2, OMAP3_MPU_SOURCE); |
592 | OMAP_SYS_TIMER(3_secure, sync32k); | ||
593 | OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon", | 582 | OMAP_SYS_GP_TIMER_INIT(3_gp, 1, OMAP3_MPU_SOURCE, "ti,timer-alwon", |
594 | 2, OMAP3_MPU_SOURCE); | 583 | 2, OMAP3_MPU_SOURCE); |
595 | OMAP_SYS_TIMER(3_gp, gptimer); | ||
596 | #endif /* CONFIG_ARCH_OMAP3 */ | 584 | #endif /* CONFIG_ARCH_OMAP3 */ |
597 | 585 | ||
598 | #ifdef CONFIG_SOC_AM33XX | 586 | #ifdef CONFIG_SOC_AM33XX |
599 | OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", | 587 | OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", |
600 | 2, OMAP4_MPU_SOURCE); | 588 | 2, OMAP4_MPU_SOURCE); |
601 | OMAP_SYS_TIMER(3_am33xx, gptimer); | ||
602 | #endif /* CONFIG_SOC_AM33XX */ | 589 | #endif /* CONFIG_SOC_AM33XX */ |
603 | 590 | ||
604 | #ifdef CONFIG_ARCH_OMAP4 | 591 | #ifdef CONFIG_ARCH_OMAP4 |
@@ -606,7 +593,7 @@ OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | |||
606 | 2, OMAP4_MPU_SOURCE); | 593 | 2, OMAP4_MPU_SOURCE); |
607 | #ifdef CONFIG_LOCAL_TIMERS | 594 | #ifdef CONFIG_LOCAL_TIMERS |
608 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); | 595 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); |
609 | static void __init omap4_local_timer_init(void) | 596 | void __init omap4_local_timer_init(void) |
610 | { | 597 | { |
611 | omap4_sync32k_timer_init(); | 598 | omap4_sync32k_timer_init(); |
612 | /* Local timers are not supprted on OMAP4430 ES1.0 */ | 599 | /* Local timers are not supprted on OMAP4430 ES1.0 */ |
@@ -624,18 +611,17 @@ static void __init omap4_local_timer_init(void) | |||
624 | } | 611 | } |
625 | } | 612 | } |
626 | #else /* CONFIG_LOCAL_TIMERS */ | 613 | #else /* CONFIG_LOCAL_TIMERS */ |
627 | static void __init omap4_local_timer_init(void) | 614 | void __init omap4_local_timer_init(void) |
628 | { | 615 | { |
629 | omap4_sync32k_timer_init(); | 616 | omap4_sync32k_timer_init(); |
630 | } | 617 | } |
631 | #endif /* CONFIG_LOCAL_TIMERS */ | 618 | #endif /* CONFIG_LOCAL_TIMERS */ |
632 | OMAP_SYS_TIMER(4, local); | ||
633 | #endif /* CONFIG_ARCH_OMAP4 */ | 619 | #endif /* CONFIG_ARCH_OMAP4 */ |
634 | 620 | ||
635 | #ifdef CONFIG_SOC_OMAP5 | 621 | #ifdef CONFIG_SOC_OMAP5 |
636 | OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | 622 | OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", |
637 | 2, OMAP4_MPU_SOURCE); | 623 | 2, OMAP4_MPU_SOURCE); |
638 | static void __init omap5_realtime_timer_init(void) | 624 | void __init omap5_realtime_timer_init(void) |
639 | { | 625 | { |
640 | int err; | 626 | int err; |
641 | 627 | ||
@@ -646,7 +632,6 @@ static void __init omap5_realtime_timer_init(void) | |||
646 | if (err) | 632 | if (err) |
647 | pr_err("%s: arch_timer_register failed %d\n", __func__, err); | 633 | pr_err("%s: arch_timer_register failed %d\n", __func__, err); |
648 | } | 634 | } |
649 | OMAP_SYS_TIMER(5, realtime); | ||
650 | #endif /* CONFIG_SOC_OMAP5 */ | 635 | #endif /* CONFIG_SOC_OMAP5 */ |
651 | 636 | ||
652 | /** | 637 | /** |
@@ -702,8 +687,7 @@ static int __init omap_timer_init(struct omap_hwmod *oh, void *unused) | |||
702 | pdata->timer_errata = omap_dm_timer_get_errata(); | 687 | pdata->timer_errata = omap_dm_timer_get_errata(); |
703 | pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; | 688 | pdata->get_context_loss_count = omap_pm_get_dev_context_loss_count; |
704 | 689 | ||
705 | pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata), | 690 | pdev = omap_device_build(name, id, oh, pdata, sizeof(*pdata)); |
706 | NULL, 0, 0); | ||
707 | 691 | ||
708 | if (IS_ERR(pdev)) { | 692 | if (IS_ERR(pdev)) { |
709 | pr_err("%s: Can't build omap_device for %s: %s.\n", | 693 | pr_err("%s: Can't build omap_device for %s: %s.\n", |
@@ -738,7 +722,7 @@ static int __init omap2_dm_timer_init(void) | |||
738 | 722 | ||
739 | return 0; | 723 | return 0; |
740 | } | 724 | } |
741 | arch_initcall(omap2_dm_timer_init); | 725 | omap_arch_initcall(omap2_dm_timer_init); |
742 | 726 | ||
743 | /** | 727 | /** |
744 | * omap2_override_clocksource - clocksource override with user configuration | 728 | * omap2_override_clocksource - clocksource override with user configuration |