Skip to contentSkip to conversation

OMAP3 timer: switch Beagle clockevents source to GPTIMER12

PATCH In review Paul Walmsley 2 participants 5 messages Aug 11, 2008 – Aug 13, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover OMAP3 timer: switch Beagle clockevents source to GPTIMER12

This patch series allows the clockevents source GPTIMER to be selectable via Kconfig, and changes the Beagle Kbuild config to use GPTIMER12 instead of GPTIMER1. The theory here is that GPTIMER12 has its own internal 32kHz secure oscillator, and does not depend on the external 32kHz clock source, which we suspect may be noisy.

---

size:
text data bss dec hex filename

3265520  145472  105480 3516472  35a838 vmlinux.beagle.orig
3265568  145472  105480 3516520  35a868 vmlinux.beagle
 arch/arm/configs/omap3_beagle_defconfig |    5 +++--
 arch/arm/mach-omap2/Kconfig             |   16 ++++++++++++++++
 arch/arm/mach-omap2/timer-gp.c          |    5 ++++-
 3 files changed, 23 insertions(+), 3 deletions(-)
#1 lore raw

PATCH 1/2 OMAP2/3 GPTIMER: allow system tick GPTIMER to be configurable at build

Add Kbuild code to allow the builder to select which GPTIMER block to use for the Linux clockevents timer. Practical choices at this point are GPTIMER1 or GPTIMER12. Both of these timers are in the WKUP powerdomain, and so are unaffected by chip power management. GPTIMER1 can use sys_clk as a source, for applications where a high-resolution timer is more important than power management. GPTIMER12 has the special property that it has the secure 32kHz oscillator as its source clock, which may be less prone to glitches than the off-chip 32kHz oscillator. But on HS devices, it may not be available for Linux use.

At this point, it appears that most boards are fine with GPTIMER1, but Beagle should use GPTIMER12.

---

 arch/arm/mach-omap2/Kconfig    |   16 ++++++++++++++++
 arch/arm/mach-omap2/timer-gp.c |    5 ++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/Kconfig +16 -0
index bb6d695..365b982 100644
@@ -122,3 +122,19 @@ config MACH_OMAP3EVM
 config MACH_OMAP3_BEAGLE
 	bool "OMAP3 BEAGLE board"
 	depends on ARCH_OMAP3 && ARCH_OMAP34XX
+
+config OMAP_TICK_GPTIMER
+	int "GPTIMER used for system tick timer"
+	depends on ARCH_OMAP2 || ARCH_OMAP3
+	range 1 12
+	default 1
+	help
+	  Linux uses one of the twelve on-board OMAP GPTIMER blocks to generate
+	  system tick interrupts.  The twelve GPTIMERs have slightly
+	  different powerdomain, source clock, and security properties
+	  (mostly documented in the OMAP3 TRMs) that can affect the selection
+	  of which GPTIMER to use.  The historical default is GPTIMER1.
+	  If CONFIG_OMAP_32K_TIMER is selected, Beagle may require GPTIMER12
+	  due to hardware sensitivity to glitches on the OMAP 32kHz clock
+	  input.
+
arch/arm/mach-omap2/timer-gp.c +4 -1
index 557603f..691a7f8 100644
@@ -99,7 +99,7 @@ static void __init omap2_gp_clockevent_init(void)
 {
 	u32 tick_rate;
 
-	gptimer = omap_dm_timer_request_specific(1);
+	gptimer = omap_dm_timer_request_specific(CONFIG_OMAP_TICK_GPTIMER);
 	BUG_ON(gptimer == NULL);
 
 #if defined(CONFIG_OMAP_32K_TIMER)
@@ -109,6 +109,9 @@ static void __init omap2_gp_clockevent_init(void)
 #endif
 	tick_rate = clk_get_rate(omap_dm_timer_get_fclk(gptimer));
 
+	pr_info("OMAP clockevent source: GPTIMER%d at %u Hz\n",
+		CONFIG_OMAP_TICK_GPTIMER, tick_rate);
+
 	omap2_gp_timer_irq.dev_id = (void *)gptimer;
 	setup_irq(omap_dm_timer_get_irq(gptimer), &omap2_gp_timer_irq);
 	omap_dm_timer_set_int_enable(gptimer, OMAP_TIMER_INT_OVERFLOW);
#2 lore raw

PATCH 2/2 BeagleBoard: make Beagle use GPTIMER12 for system ticks

In reply to Paul Walmsley

There is suspicion that the 32kHz input clock to the OMAP may be noisy on BeagleBoards. On OMAP2/3 GPTIMER1, this can cause the timer counter register to warp to unknown values or miss interrupt conditions. So, use GPTIMER12 instead, which apparently has its own secure 32kHz oscillator and will hopefully not be prone to the suspected sys_32k glitches.

This is only a workaround. If sys_32k is noisy, other system peripherals may be affected.

This workaround is a collective product of several people, most notably Philip Balister <[email protected]>, Dirk Behme <[email protected]>, Koen Kooi <[email protected]>, Tony Lindgren <[email protected]>, Steve Sakoman <[email protected]>, Khasim Syed Mohammed <[email protected]> Richard Woodruff <[email protected]>. I apologize if there is anyone whom I've missed.

Cc Khasim Syed Mohammed <[email protected]>
Cc Koen Kooi <[email protected]>
Cc Steve Sakoman <[email protected]>
Cc Richard Woodruff <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Philip Balister <[email protected]>
Cc Dirk Behme <[email protected]>

---

 arch/arm/configs/omap3_beagle_defconfig |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/configs/omap3_beagle_defconfig +3 -2
index e1b16d0..7805995 100644
@@ -182,8 +182,8 @@ CONFIG_OMAP_BOOT_REASON=y
 # CONFIG_OMAP_MCBSP is not set
 # CONFIG_OMAP_MMU_FWK is not set
 # CONFIG_OMAP_MBOX_FWK is not set
-CONFIG_OMAP_MPU_TIMER=y
-# CONFIG_OMAP_32K_TIMER is not set
+# CONFIG_OMAP_MPU_TIMER is not set
+CONFIG_OMAP_32K_TIMER=y
 CONFIG_OMAP_DM_TIMER=y
 # CONFIG_OMAP_LL_DEBUG_UART1 is not set
 # CONFIG_OMAP_LL_DEBUG_UART2 is not set
@@ -198,6 +198,7 @@ CONFIG_ARCH_OMAP3430=y
 # CONFIG_MACH_OMAP_3430SDP is not set
 # CONFIG_MACH_OMAP3EVM is not set
 CONFIG_MACH_OMAP3_BEAGLE=y
+CONFIG_OMAP_TICK_GPTIMER=12
 
 #
 # Boot options
#3 lore raw

Re: [PATCH 2/2] BeagleBoard: make Beagle use GPTIMER12 for system ticks

Quoted 6 lines · Paul Walmsley

This workaround is a collective product of several people, most notably Philip Balister <[email protected]>, Dirk Behme <[email protected]>, Koen Kooi <[email protected]>, Tony Lindgren <[email protected]>, Steve Sakoman <[email protected]>, Khasim Syed Mohammed <[email protected]> Richard Woodruff <[email protected]>. I apologize if there is anyone whom I've missed.

And of course I think of someone right after I hit send: Kevin Hilman <[email protected]> as well.

- Paul

maintainer
#4 lore raw
In reply to Paul Walmsley
Quoted 5 lines · Paul Walmsley

This patch series allows the clockevents source GPTIMER to be selectable via Kconfig, and changes the Beagle Kbuild config to use GPTIMER12 instead of GPTIMER1. The theory here is that GPTIMER12 has its own internal 32kHz secure oscillator, and does not depend on the external 32kHz clock source, which we suspect may be noisy.

Pushing these today.

Tony

Quoted 18 lines

---

size:
text data bss dec hex filename

3265520  145472  105480 3516472  35a838 vmlinux.beagle.orig
3265568  145472  105480 3516520  35a868 vmlinux.beagle
 arch/arm/configs/omap3_beagle_defconfig |    5 +++--
 arch/arm/mach-omap2/Kconfig             |   16 ++++++++++++++++
 arch/arm/mach-omap2/timer-gp.c          |    5 ++++-
 3 files changed, 23 insertions(+), 3 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html