diff options
| -rw-r--r-- | arch/arm/mach-omap2/timer.c | 128 | ||||
| -rw-r--r-- | arch/arm/plat-omap/Kconfig | 6 |
2 files changed, 58 insertions, 76 deletions
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c index b7f43a28e41f..bbe3cc2c1fca 100644 --- a/arch/arm/mach-omap2/timer.c +++ b/arch/arm/mach-omap2/timer.c | |||
| @@ -66,20 +66,6 @@ | |||
| 66 | #define OMAP3_32K_SOURCE "omap_32k_fck" | 66 | #define OMAP3_32K_SOURCE "omap_32k_fck" |
| 67 | #define OMAP4_32K_SOURCE "sys_32k_ck" | 67 | #define OMAP4_32K_SOURCE "sys_32k_ck" |
| 68 | 68 | ||
| 69 | #ifdef CONFIG_OMAP_32K_TIMER | ||
| 70 | #define OMAP2_CLKEV_SOURCE OMAP2_32K_SOURCE | ||
| 71 | #define OMAP3_CLKEV_SOURCE OMAP3_32K_SOURCE | ||
| 72 | #define OMAP4_CLKEV_SOURCE OMAP4_32K_SOURCE | ||
| 73 | #define OMAP3_SECURE_TIMER 12 | ||
| 74 | #define TIMER_PROP_SECURE "ti,timer-secure" | ||
| 75 | #else | ||
| 76 | #define OMAP2_CLKEV_SOURCE OMAP2_MPU_SOURCE | ||
| 77 | #define OMAP3_CLKEV_SOURCE OMAP3_MPU_SOURCE | ||
| 78 | #define OMAP4_CLKEV_SOURCE OMAP4_MPU_SOURCE | ||
| 79 | #define OMAP3_SECURE_TIMER 1 | ||
| 80 | #define TIMER_PROP_SECURE "ti,timer-alwon" | ||
| 81 | #endif | ||
| 82 | |||
| 83 | #define REALTIME_COUNTER_BASE 0x48243200 | 69 | #define REALTIME_COUNTER_BASE 0x48243200 |
| 84 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 | 70 | #define INCREMENTER_NUMERATOR_OFFSET 0x10 |
| 85 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 | 71 | #define INCREMENTER_DENUMERATOR_RELOAD_OFFSET 0x14 |
| @@ -400,7 +386,6 @@ static u32 notrace dmtimer_read_sched_clock(void) | |||
| 400 | return 0; | 386 | return 0; |
| 401 | } | 387 | } |
| 402 | 388 | ||
| 403 | #ifdef CONFIG_OMAP_32K_TIMER | ||
| 404 | static struct of_device_id omap_counter_match[] __initdata = { | 389 | static struct of_device_id omap_counter_match[] __initdata = { |
| 405 | { .compatible = "ti,omap-counter32k", }, | 390 | { .compatible = "ti,omap-counter32k", }, |
| 406 | { } | 391 | { } |
| @@ -466,12 +451,6 @@ static int __init omap2_sync32k_clocksource_init(void) | |||
| 466 | 451 | ||
| 467 | return ret; | 452 | return ret; |
| 468 | } | 453 | } |
| 469 | #else | ||
| 470 | static inline int omap2_sync32k_clocksource_init(void) | ||
| 471 | { | ||
| 472 | return -ENODEV; | ||
| 473 | } | ||
| 474 | #endif | ||
| 475 | 454 | ||
| 476 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, | 455 | static void __init omap2_gptimer_clocksource_init(int gptimer_id, |
| 477 | const char *fck_source) | 456 | const char *fck_source) |
| @@ -497,25 +476,6 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id, | |||
| 497 | gptimer_id, clksrc.rate); | 476 | gptimer_id, clksrc.rate); |
| 498 | } | 477 | } |
| 499 | 478 | ||
| 500 | static void __init omap2_clocksource_init(int gptimer_id, | ||
| 501 | const char *fck_source) | ||
| 502 | { | ||
| 503 | /* | ||
| 504 | * First give preference to kernel parameter configuration | ||
| 505 | * by user (clocksource="gp_timer"). | ||
| 506 | * | ||
| 507 | * In case of missing kernel parameter for clocksource, | ||
| 508 | * first check for availability for 32k-sync timer, in case | ||
| 509 | * of failure in finding 32k_counter module or registering | ||
| 510 | * it as clocksource, execution will fallback to gp-timer. | ||
| 511 | */ | ||
| 512 | if (use_gptimer_clksrc == true) | ||
| 513 | omap2_gptimer_clocksource_init(gptimer_id, fck_source); | ||
| 514 | else if (omap2_sync32k_clocksource_init()) | ||
| 515 | /* Fall back to gp-timer code */ | ||
| 516 | omap2_gptimer_clocksource_init(gptimer_id, fck_source); | ||
| 517 | } | ||
| 518 | |||
| 519 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER | 479 | #ifdef CONFIG_SOC_HAS_REALTIME_COUNTER |
| 520 | /* | 480 | /* |
| 521 | * The realtime counter also called master counter, is a free-running | 481 | * The realtime counter also called master counter, is a free-running |
| @@ -594,52 +554,62 @@ static inline void __init realtime_counter_init(void) | |||
| 594 | {} | 554 | {} |
| 595 | #endif | 555 | #endif |
| 596 | 556 | ||
| 597 | #define OMAP_SYS_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | 557 | #define OMAP_SYS_GP_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ |
| 558 | clksrc_nr, clksrc_src) \ | ||
| 559 | static void __init omap##name##_gptimer_timer_init(void) \ | ||
| 560 | { \ | ||
| 561 | omap_dmtimer_init(); \ | ||
| 562 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | ||
| 563 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src); \ | ||
| 564 | } | ||
| 565 | |||
| 566 | #define OMAP_SYS_32K_TIMER_INIT(name, clkev_nr, clkev_src, clkev_prop, \ | ||
| 598 | clksrc_nr, clksrc_src) \ | 567 | clksrc_nr, clksrc_src) \ |
| 599 | static void __init omap##name##_timer_init(void) \ | 568 | static void __init omap##name##_sync32k_timer_init(void) \ |
| 600 | { \ | 569 | { \ |
| 601 | omap_dmtimer_init(); \ | 570 | omap_dmtimer_init(); \ |
| 602 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ | 571 | omap2_gp_clockevent_init((clkev_nr), clkev_src, clkev_prop); \ |
| 603 | omap2_clocksource_init((clksrc_nr), clksrc_src); \ | 572 | /* Enable the use of clocksource="gp_timer" kernel parameter */ \ |
| 573 | if (use_gptimer_clksrc) \ | ||
| 574 | omap2_gptimer_clocksource_init((clksrc_nr), clksrc_src);\ | ||
| 575 | else \ | ||
| 576 | omap2_sync32k_clocksource_init(); \ | ||
| 604 | } | 577 | } |
| 605 | 578 | ||
| 606 | #define OMAP_SYS_TIMER(name) \ | 579 | #define OMAP_SYS_TIMER(name, clksrc) \ |
| 607 | struct sys_timer omap##name##_timer = { \ | 580 | struct sys_timer omap##name##_timer = { \ |
| 608 | .init = omap##name##_timer_init, \ | 581 | .init = omap##name##_##clksrc##_timer_init, \ |
| 609 | }; | 582 | }; |
| 610 | 583 | ||
| 611 | #ifdef CONFIG_ARCH_OMAP2 | 584 | #ifdef CONFIG_ARCH_OMAP2 |
| 612 | OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, "ti,timer-alwon", | 585 | OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon", |
| 613 | 2, OMAP2_MPU_SOURCE) | 586 | 2, OMAP2_MPU_SOURCE); |
| 614 | OMAP_SYS_TIMER(2) | 587 | OMAP_SYS_TIMER(2, sync32k); |
| 615 | #endif | 588 | #endif /* CONFIG_ARCH_OMAP2 */ |
| 616 | 589 | ||
| 617 | #ifdef CONFIG_ARCH_OMAP3 | 590 | #ifdef CONFIG_ARCH_OMAP3 |
| 618 | OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, "ti,timer-alwon", | 591 | OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon", |
| 619 | 2, OMAP3_MPU_SOURCE) | 592 | 2, OMAP3_MPU_SOURCE); |
| 620 | OMAP_SYS_TIMER(3) | 593 | OMAP_SYS_TIMER(3, sync32k); |
| 621 | OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE, | 594 | OMAP_SYS_32K_TIMER_INIT(3_secure, 12, OMAP3_32K_SOURCE, "ti,timer-secure", |
| 622 | TIMER_PROP_SECURE, 2, OMAP3_MPU_SOURCE) | 595 | 2, OMAP3_MPU_SOURCE); |
| 623 | OMAP_SYS_TIMER(3_secure) | 596 | OMAP_SYS_TIMER(3_secure, sync32k); |
| 624 | #endif | 597 | #endif /* CONFIG_ARCH_OMAP3 */ |
| 625 | 598 | ||
| 626 | #ifdef CONFIG_SOC_AM33XX | 599 | #ifdef CONFIG_SOC_AM33XX |
| 627 | OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", | 600 | OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", |
| 628 | 2, OMAP4_MPU_SOURCE) | 601 | 2, OMAP4_MPU_SOURCE); |
| 629 | OMAP_SYS_TIMER(3_am33xx) | 602 | OMAP_SYS_TIMER(3_am33xx, gptimer); |
| 630 | #endif | 603 | #endif /* CONFIG_SOC_AM33XX */ |
| 631 | 604 | ||
| 632 | #ifdef CONFIG_ARCH_OMAP4 | 605 | #ifdef CONFIG_ARCH_OMAP4 |
| 606 | OMAP_SYS_32K_TIMER_INIT(4, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", | ||
| 607 | 2, OMAP4_MPU_SOURCE); | ||
| 633 | #ifdef CONFIG_LOCAL_TIMERS | 608 | #ifdef CONFIG_LOCAL_TIMERS |
| 634 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, | 609 | static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29); |
| 635 | OMAP44XX_LOCAL_TWD_BASE, 29); | 610 | static void __init omap4_local_timer_init(void) |
| 636 | #endif | ||
| 637 | |||
| 638 | static void __init omap4_timer_init(void) | ||
| 639 | { | 611 | { |
| 640 | omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE, "ti,timer-alwon"); | 612 | omap4_sync32k_timer_init(); |
| 641 | omap2_clocksource_init(2, OMAP4_MPU_SOURCE); | ||
| 642 | #ifdef CONFIG_LOCAL_TIMERS | ||
| 643 | /* Local timers are not supprted on OMAP4430 ES1.0 */ | 613 | /* Local timers are not supprted on OMAP4430 ES1.0 */ |
| 644 | if (omap_rev() != OMAP4430_REV_ES1_0) { | 614 | if (omap_rev() != OMAP4430_REV_ES1_0) { |
| 645 | int err; | 615 | int err; |
| @@ -653,26 +623,32 @@ static void __init omap4_timer_init(void) | |||
| 653 | if (err) | 623 | if (err) |
| 654 | pr_err("twd_local_timer_register failed %d\n", err); | 624 | pr_err("twd_local_timer_register failed %d\n", err); |
| 655 | } | 625 | } |
| 656 | #endif | ||
| 657 | } | 626 | } |
| 658 | OMAP_SYS_TIMER(4) | 627 | #else /* CONFIG_LOCAL_TIMERS */ |
| 659 | #endif | 628 | static inline void omap4_local_timer_init(void) |
| 629 | { | ||
| 630 | omap4_sync32_timer_init(); | ||
| 631 | } | ||
| 632 | #endif /* CONFIG_LOCAL_TIMERS */ | ||
| 633 | OMAP_SYS_TIMER(4, local); | ||
| 634 | #endif /* CONFIG_ARCH_OMAP4 */ | ||
| 660 | 635 | ||
| 661 | #ifdef CONFIG_SOC_OMAP5 | 636 | #ifdef CONFIG_SOC_OMAP5 |
| 662 | static void __init omap5_timer_init(void) | 637 | OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon", |
| 638 | 2, OMAP4_MPU_SOURCE); | ||
| 639 | static void __init omap5_realtime_timer_init(void) | ||
| 663 | { | 640 | { |
| 664 | int err; | 641 | int err; |
| 665 | 642 | ||
| 666 | omap2_gp_clockevent_init(1, OMAP4_CLKEV_SOURCE, "ti,timer-alwon"); | 643 | omap5_sync32k_timer_init(); |
| 667 | omap2_clocksource_init(2, OMAP4_MPU_SOURCE); | ||
| 668 | realtime_counter_init(); | ||
