From mboxrd@z Thu Jan 1 00:00:00 1970 From: robherring2@gmail.com (Rob Herring) Date: Thu, 30 Sep 2010 21:03:39 -0500 Subject: [PATCH 3/3] ARM: twd_smp: add clock api support In-Reply-To: References: <1285886952-30888-1-git-send-email-robherring2@gmail.com> <1285886952-30888-3-git-send-email-robherring2@gmail.com> Message-ID: <4CA5417B.5020200@gmail.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 09/30/2010 07:49 PM, Colin Cross wrote: > On Thu, Sep 30, 2010 at 3:49 PM, Rob Herring wrote: >> From: Rob Herring >> >> The private timer freq is currently dynamically detected >> using jiffies count to determine the rate. This method adds >> a delay to boot-up, so use the clock api instead to get the >> clock rate. >> >> Signed-off-by: Rob Herring >> --- >> arch/arm/include/asm/smp_twd.h | 2 ++ >> arch/arm/kernel/smp_twd.c | 7 +++++++ >> 2 files changed, 9 insertions(+), 0 deletions(-) >> >> diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h >> index 634f357..bafad52 100644 >> --- a/arch/arm/include/asm/smp_twd.h >> +++ b/arch/arm/include/asm/smp_twd.h >> @@ -19,11 +19,13 @@ >> #define TWD_TIMER_CONTROL_IT_ENABLE (1<< 2) >> >> struct clock_event_device; >> +struct clk; >> >> extern void __iomem *twd_base; >> >> void twd_timer_stop(void); >> int twd_timer_ack(void); >> void twd_timer_setup(struct clock_event_device *); >> +void twd_timer_init(void __iomem *base, struct clk *clk); >> >> #endif >> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c >> index 35882fb..1a3c959 100644 >> --- a/arch/arm/kernel/smp_twd.c >> +++ b/arch/arm/kernel/smp_twd.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> >> #include >> #include >> @@ -151,6 +152,12 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk) >> clockevents_register_device(clk); >> } >> >> +void __init twd_timer_init(void __iomem *base, struct clk *clk) >> +{ >> + twd_base = base; >> + twd_timer_rate = clk_get_rate(clk); >> +} >> + >> #ifdef CONFIG_HOTPLUG_CPU >> /* >> * take a local timer down > > The local timers run off the PERIPHCLK in the CPU, which is specified > as the CPU clock divided by an implementation defined integer>= 2. > If you take the divider value as a parameter to twd_timer_init, the > clock that is passed in can be the cpu's clock. That is an implementation detail of the A9. Future designs could be completely asynchronous. Using the clock api works either way. Rob