OMAP2/3: GPTIMER12 fixes
Paul Walmsley
maintainercover OMAP2/3: GPTIMER12 fixes
Hello,
This following series of fixes implements support in mainline for using GPTIMER12 as the system tick timer. Currently this is only needed for some BeagleBoards. Detailed comments are in the patch descriptions.
This is being posted for any brief comments before submitting upstream as part of a fix series.
- Paul
---
Kevin Hilman (1):
OMAP: dmtimer: enable all timers to be wakeup events
Paul Walmsley (2):
OMAP2/3 GPTIMER: allow system tick GPTIMER to be changed in board-*.c files OMAP3 GPTIMER: fix GPTIMER12 IRQ
arch/arm/mach-omap2/board-omap3beagle.c | 4 ++ arch/arm/mach-omap2/clock24xx.c | 1 + arch/arm/mach-omap2/clock24xx.h | 10 +++++- arch/arm/mach-omap2/clock34xx.h | 1 - arch/arm/mach-omap2/timer-gp.c | 48 ++++++++++++++++++++++++++-- arch/arm/plat-omap/dmtimer.c | 28 ++++++++++------ arch/arm/plat-omap/include/mach/dmtimer.h | 2 + arch/arm/plat-omap/include/mach/timer-gp.h | 17 ++++++++++ 8 files changed, 94 insertions(+), 17 deletions(-) create mode 100644 arch/arm/plat-omap/include/mach/timer-gp.h
Paul Walmsley
maintainerPATCH 1/3 OMAP3 GPTIMER: fix GPTIMER12 IRQ
GPTIMER12 IRQ is at IRQ 95 on OMAP3, unlike OMAP2. (ref: OMAP34xx Multimedia High Security (HS) Device Silicon Revision 3.0 Security Addendum Rev. B, SWPU119B)
--- arch/arm/plat-omap/dmtimer.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/plat-omap/dmtimer.c +1 -1
@@ -238,7 +238,7 @@ static struct omap_dm_timer omap3_dm_timers[] = { { .phys_base = 0x49040000, .irq = INT_24XX_GPTIMER9 }, { .phys_base = 0x48086000, .irq = INT_24XX_GPTIMER10 }, { .phys_base = 0x48088000, .irq = INT_24XX_GPTIMER11 }, - { .phys_base = 0x48304000, .irq = INT_24XX_GPTIMER12 }, + { .phys_base = 0x48304000, .irq = INT_34XX_GPT12_IRQ }, }; static const char *omap3_dm_source_names[] __initdata = {
Tony Lindgren
maintainerPATCH 1/3 OMAP3 GPTIMER: fix GPTIMER12 IRQ
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Initial commit ID (Likely to change): 248d0ba812f675991dbd5a924188f5c893df9ede
PatchWorks
http://patchwork.kernel.org/patch/16347/
Paul Walmsley
maintainerPATCH 2/3 OMAP2/3 GPTIMER: allow system tick GPTIMER to be changed in board-*.c files
In reply to Paul WalmsleyAdd a function omap2_gp_clockevent_set_gptimer() for board-*.c files to use in .init_irq functions to configure the system tick GPTIMER. 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.
It appears that most boards are fine with GPTIMER1, but BeagleBoard should use GPTIMER12 when using a 32KiHz timer source, due to hardware bugs in revisions B4 and below. Modify board-omap3beagle.c to use GPTIMER12.
This patch originally used a Kbuild config option to select the GPTIMER, but was changed to allow this to be specified in board-*.c files, per Tony's request.
Tested on Beagle rev B4 ES2.1, with and without CONFIG_OMAP_32K_TIMER, and 3430SDP.
--- arch/arm/mach-omap2/board-omap3beagle.c | 4 ++ arch/arm/mach-omap2/clock24xx.c | 1 + arch/arm/mach-omap2/clock24xx.h | 10 +++++- arch/arm/mach-omap2/clock34xx.h | 1 - arch/arm/mach-omap2/timer-gp.c | 48 ++++++++++++++++++++++++++-- arch/arm/plat-omap/dmtimer.c | 20 ++++++++---- arch/arm/plat-omap/include/mach/dmtimer.h | 2 + arch/arm/plat-omap/include/mach/timer-gp.h | 17 ++++++++++ 8 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 arch/arm/plat-omap/include/mach/timer-gp.h
arch/arm/mach-omap2/board-omap3beagle.c +4 -0
@@ -42,6 +42,7 @@#include <mach/nand.h> #include <mach/mux.h> #include <mach/usb.h> +#include <mach/timer-gp.h> #include "mmc-twl4030.h"
@@ -186,6 +187,9 @@ static void __init omap3_beagle_init_irq(void) {omap2_init_common_hw (NULL );omap_init_irq (); +#ifdef CONFIG_OMAP_32K_TIMER +omap2_gp_clockevent_set_gptimer (12 ); +#endif omap_gpio_init (); }
arch/arm/mach-omap2/clock24xx.c +1 -0
@@ -66,6 +66,7 @@ struct omap_clk {static struct omap_clk omap24xx_clks[] = {/* external root sources */ CLK (NULL ,"func_32k_ck" , &func_32k_ck,CK_243X |CK_242X ), +CLK (NULL ,"secure_32k_ck" , &secure_32k_ck,CK_243X |CK_242X ),CLK (NULL ,"osc_ck" , &osc_ck,CK_243X |CK_242X ),CLK (NULL ,"sys_ck" , &sys_ck,CK_243X |CK_242X ),CLK (NULL ,"alt_ck" , &alt_ck,CK_243X |CK_242X ),
arch/arm/mach-omap2/clock24xx.h +9 -1
@@ -625,6 +625,14 @@ static struct clk func_32k_ck = { .clkdm_name = "wkup_clkdm", }; +static struct clk secure_32k_fck = { + .name ="secure_32k_fck" , + .ops = &clkops_null, + .rate =32768 , + .flags =RATE_FIXED , + .clkdm_name ="wkup_clkdm" , +}; +/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ static struct clk osc_ck = {/* (*12, *13, 19.2, *26, 38.4)MHz */ .name ="osc_ck" ,
@@ -1790,7 +1798,7 @@ static struct clk gpt12_ick = {static struct clk gpt12_fck = { .name ="gpt12_fck" , .ops = &clkops_omap2_dflt_wait, - .parent = &func_32k_ck, + .parent = &secure_32k_ck, .clkdm_name ="core_l4_clkdm" , .enable_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_FCLKEN1 ), .enable_bit =OMAP24XX_EN_GPT12_SHIFT ,
arch/arm/mach-omap2/clock34xx.h +0 -1
@@ -2901,7 +2901,6 @@ static struct clk sr_l4_ick = {/* SECURE_32K_FCK clocks */ -/* XXX This clock no longer exists in 3430 TRM rev F */ static struct clk gpt12_fck = { .name ="gpt12_fck" , .ops = &clkops_null,
arch/arm/mach-omap2/timer-gp.c +45 -3
85 lines not on this page · raw message
arch/arm/plat-omap/dmtimer.c +14 -6
@@ -511,7 +511,7 @@ EXPORT_SYMBOL_GPL(omap_dm_timer_stop);#ifdef CONFIG_ARCH_OMAP1 -void omap_dm_timer_set_source (struct omap_dm_timer *timer,int source) +int omap_dm_timer_set_source (struct omap_dm_timer *timer,int source) {int n = (timer - dm_timers) <<1 ;u32 l;
@@ -519,23 +519,31 @@ void omap_dm_timer_set_source(struct omap_dm_timer *timer, int source) l =omap_readl (MOD_CONF_CTRL_1 ) & ~(0x03 << n); l |= source << n;omap_writel (l,MOD_CONF_CTRL_1 ); + + return 0; }EXPORT_SYMBOL_GPL (omap_dm_timer_set_source);#else -void omap_dm_timer_set_source (struct omap_dm_timer *timer,int source) +int omap_dm_timer_set_source (struct omap_dm_timer *timer,int source) { +int ret = -EINVAL ; +if (source <0 || source >=3 ) -return ; +return -EINVAL ;clk_disable (timer->fclk); -clk_set_parent (timer->fclk, dm_source_clocks[source]); + ret =clk_set_parent (timer->fclk, dm_source_clocks[source]);clk_enable (timer->fclk); -/* When the functional clock disappears, too quick writes seem to -* cause an abort. */ +/* +* When the functional clock disappears, too quick writes seem +* to cause an abort. XXX Is this still necessary? +*/ __delay (150000 ); + +return ret; }EXPORT_SYMBOL_GPL (omap_dm_timer_set_source);
arch/arm/plat-omap/include/mach/dmtimer.h +1 -1
@@ -64,7 +64,7 @@ void omap_dm_timer_trigger(struct omap_dm_timer *timer);void omap_dm_timer_start (struct omap_dm_timer *timer);void omap_dm_timer_stop (struct omap_dm_timer *timer); -void omap_dm_timer_set_source (struct omap_dm_timer *timer,int source); +int omap_dm_timer_set_source (struct omap_dm_timer *timer,int source);void omap_dm_timer_set_load (struct omap_dm_timer *timer,int autoreload,unsigned int value);void omap_dm_timer_set_load_start (struct omap_dm_timer *timer,int autoreload,unsigned int value);void omap_dm_timer_set_match (struct omap_dm_timer *timer,int enable,unsigned int match);
arch/arm/plat-omap/include/mach/timer-gp.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* OMAP2/3 GPTIMER support.headers +* +* Copyright (C) 2009 Nokia Corporation +* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +*/ + +#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H +#define __ARCH_ARM_PLAT_OMAP_INCLUDE_MACH_TIMER_GP_H + +int __init omap2_gp_clockevent_set_gptimer (u8 id); + +#endif +
Tony Lindgren
maintainerPATCH 2/3 OMAP2/3 GPTIMER: allow system tick GPTIMER to be changed
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Initial commit ID (Likely to change): 6e8877aec8c20678553e7af9c7c3f1beff01e1f5
PatchWorks
http://patchwork.kernel.org/patch/16348/
Paul Walmsley
maintainerPATCH 3/3 OMAP: dmtimer: enable all timers to be wakeup events
In reply to Paul WalmsleyFrom: Kevin Hilman <[email protected]>
All GP timers on OMAP2/3 can generate wakeup events. The wakeup status is cleared in the PRCM interrupt handler.
--- arch/arm/mach-omap2/clock24xx.h | 4 ++-- arch/arm/plat-omap/dmtimer.c | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/clock24xx.h +2 -2
@@ -625,8 +625,8 @@ static struct clk func_32k_ck = { .clkdm_name = "wkup_clkdm", }; -static struct clk secure_32k_fck = { - .name ="secure_32k_fck" , +static struct clk secure_32k_ck = { + .name ="secure_32k_ck" , .ops = &clkops_null, .rate =32768 , .flags =RATE_FIXED ,
arch/arm/plat-omap/dmtimer.c +2 -4
@@ -321,11 +321,9 @@ static void omap_dm_timer_reset(struct omap_dm_timer *timer) l |=0x2 <<8 ;/* Set clock activity to perserve f-clock on idle */ /* -* Enable wake-up only for GPT1 on OMAP2 CPUs. -* FIXME: All timers should have wake-up enabled and clear -* PRCM status. +* Enable wake-up on OMAP2 CPUs. */ -if (cpu_class_is_omap2 () && (timer == &dm_timers[0 ])) +if (cpu_class_is_omap2 ()) l |=1 <<2 ;omap_dm_timer_write_reg (timer,OMAP_TIMER_OCP_CFG_REG , l);
Tony Lindgren
maintainerPATCH 3/3 OMAP: dmtimer: enable all timers to be wakeup events
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.
Initial commit ID (Likely to change): 7287a91be3de9ee00f8da7c07f19b368fd0969ae
PatchWorks
http://patchwork.kernel.org/patch/16349/
Tony Lindgren
maintainerRe: [APPLIED] [PATCH 3/3] OMAP: dmtimer: enable all timers to be wakeup events
Quoted 10 lines · Tony Lindgren
This patch has been applied to the linux-omap
by youw fwiendly patch wobot.Initial commit ID (Likely to change):
7287a91be3de9ee00f8da7c07f19b368fd0969aePatchWorks
http://patchwork.kernel.org/patch/16349/
Well let's change the order of these patches, if you can sink #3 before #3 as we discussed on the phone. This way if adding the gpt 12 support for Beagle is considered too intrusive, it's easier to drop from omap-fixes and move to for-next instead.
So dropping all three until you have the updated series available.
Thanks,
Tony