aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIgor Grinberg <grinberg@compulab.co.il>2012-11-20 02:17:15 -0500
committerTony Lindgren <tony@atomide.com>2012-11-21 13:15:59 -0500
commit6f80b3bb8a0ae4ae376dbdc69acf1fca8b4e2c9c (patch)
tree6cdd7a8ffce1a9212eada8f6e48d0b047badf1d0
parent48b0023607c4e524e893a7a378a1dd42234c41a7 (diff)
ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
CONFIG_OMAP_32K_TIMER is kind of standing on the single zImage way. Make OMAP2+ timer code independant from the CONFIG_OMAP_32K_TIMER setting. To remove the dependancy, several conversions/additions had to be done: 1) Timer initialization functions are named by the platform name and the clock source in use. This also makes it possible to define and use the GPTIMER as the clock source instead of the 32K timer on platforms that do not have the 32K timer ip block or the 32K timer is not wired on the board. Currently, the the timer is chosen in the machine_desc structure on per board basis. Later, DT should be used to choose the timer. 2) Settings under the CONFIG_OMAP_32K_TIMER option are used as defaults and those under !CONFIG_OMAP_32K_TIMER are removed. This removes the CONFIG_OMAP_32K_TIMER on OMAP2+ timer code. 3) Since we have all the timers defined inside machine_desc structure and we no longer need the fallback to gp_timer clock source in case 32k_timer clock source is unavailable (namely on AM33xx), we no longer need the #ifdef around omap2_sync32k_clocksource_init() function. Remove the #ifdef CONFIG_OMAP_32K_TIMER around the omap2_sync32k_clocksource_init() function. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Cc: Jon Hunter <jon-hunter@ti.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Vaibhav Hiremath <hvaibhav@ti.com> Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Reviewed-by: Jon Hunter <jon-hunter@ti.com>
-rw-r--r--arch/arm/mach-omap2/timer.c128
-rw-r--r--arch/arm/plat-omap/Kconfig6
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
404static struct of_device_id omap_counter_match[] __initdata = { 389static 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
470static inline int omap2_sync32k_clocksource_init(void)
471{
472 return -ENODEV;
473}
474#endif
475 454
476static void __init omap2_gptimer_clocksource_init(int gptimer_id, 455static 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
500static 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) \
559static 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) \
599static void __init omap##name##_timer_init(void) \ 568static 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) \
607struct sys_timer omap##name##_timer = { \ 580struct 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
612OMAP_SYS_TIMER_INIT(2, 1, OMAP2_CLKEV_SOURCE, "ti,timer-alwon", 585OMAP_SYS_32K_TIMER_INIT(2, 1, OMAP2_32K_SOURCE, "ti,timer-alwon",
613 2, OMAP2_MPU_SOURCE) 586 2, OMAP2_MPU_SOURCE);
614OMAP_SYS_TIMER(2) 587OMAP_SYS_TIMER(2, sync32k);
615#endif 588#endif /* CONFIG_ARCH_OMAP2 */
616 589
617#ifdef CONFIG_ARCH_OMAP3 590#ifdef CONFIG_ARCH_OMAP3
618OMAP_SYS_TIMER_INIT(3, 1, OMAP3_CLKEV_SOURCE, "ti,timer-alwon", 591OMAP_SYS_32K_TIMER_INIT(3, 1, OMAP3_32K_SOURCE, "ti,timer-alwon",
619 2, OMAP3_MPU_SOURCE) 592 2, OMAP3_MPU_SOURCE);
620OMAP_SYS_TIMER(3) 593OMAP_SYS_TIMER(3, sync32k);
621OMAP_SYS_TIMER_INIT(3_secure, OMAP3_SECURE_TIMER, OMAP3_CLKEV_SOURCE, 594OMAP_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);
623OMAP_SYS_TIMER(3_secure) 596OMAP_SYS_TIMER(3_secure, sync32k);
624#endif 597#endif /* CONFIG_ARCH_OMAP3 */
625 598
626#ifdef CONFIG_SOC_AM33XX 599#ifdef CONFIG_SOC_AM33XX
627OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon", 600OMAP_SYS_GP_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, "ti,timer-alwon",
628 2, OMAP4_MPU_SOURCE) 601 2, OMAP4_MPU_SOURCE);
629OMAP_SYS_TIMER(3_am33xx) 602OMAP_SYS_TIMER(3_am33xx, gptimer);
630#endif 603#endif /* CONFIG_SOC_AM33XX */
631 604
632#ifdef CONFIG_ARCH_OMAP4 605#ifdef CONFIG_ARCH_OMAP4
606OMAP_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
634static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, 609static DEFINE_TWD_LOCAL_TIMER(twd_local_timer, OMAP44XX_LOCAL_TWD_BASE, 29);
635 OMAP44XX_LOCAL_TWD_BASE, 29); 610static void __init omap4_local_timer_init(void)
636#endif
637
638static 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}
658OMAP_SYS_TIMER(4) 627#else /* CONFIG_LOCAL_TIMERS */
659#endif 628static inline void omap4_local_timer_init(void)
629{
630 omap4_sync32_timer_init();
631}
632#endif /* CONFIG_LOCAL_TIMERS */
633OMAP_SYS_TIMER(4, local);
634#endif /* CONFIG_ARCH_OMAP4 */
660 635
661#ifdef CONFIG_SOC_OMAP5 636#ifdef CONFIG_SOC_OMAP5
662static void __init omap5_timer_init(void) 637OMAP_SYS_32K_TIMER_INIT(5, 1, OMAP4_32K_SOURCE, "ti,timer-alwon",
638 2, OMAP4_MPU_SOURCE);
639static 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(); 644 realtime_counter_init();
669 645
670 err = arch_timer_of_register(); 646 err = arch_timer_of_register();
671 if (err) 647 if (err)
672 pr_err("%s: arch_timer_register failed %d\n", __func__, err); 648 pr_err("%s: arch_timer_register failed %d\n", __func__, err);
673} 649}
674OMAP_SYS_TIMER(5) 650OMAP_SYS_TIMER(5, realtime);
675#endif 651#endif /* CONFIG_SOC_OMAP5 */
676 652
677/** 653/**
678 * omap_timer_init - build and register timer device with an 654 * omap_timer_init - build and register timer device with an
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 82fcb206b5b2..665870dce3c8 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -154,6 +154,12 @@ config OMAP_32K_TIMER
154 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is 154 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
155 currently only available for OMAP16XX, 24XX, 34XX and OMAP4/5. 155 currently only available for OMAP16XX, 24XX, 34XX and OMAP4/5.
156 156
157 On OMAP2PLUS this value is only used for CONFIG_HZ and
158 CLOCK_TICK_RATE compile time calculation.
159 The actual timer selection is done in the board file
160 through the (DT_)MACHINE_START structure.
161
162
157config OMAP3_L2_AUX_SECURE_SAVE_RESTORE 163config OMAP3_L2_AUX_SECURE_SAVE_RESTORE
158 bool "OMAP3 HS/EMU save and restore for L2 AUX control register" 164 bool "OMAP3 HS/EMU save and restore for L2 AUX control register"
159 depends on ARCH_OMAP3 && PM 165 depends on ARCH_OMAP3 && PM