From: robherring2@gmail.com (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 6/7] ARM: smp_twd: add clock api support
Date: Tue, 15 Mar 2011 07:40:58 -0500 [thread overview]
Message-ID: <4D7F5E5A.5020508@gmail.com> (raw)
In-Reply-To: <AANLkTi=NnwEwo4XYbvevqp2zDyGPypBz9yHgozrn2jEy@mail.gmail.com>
Colin,
On 03/14/2011 09:35 PM, Colin Cross wrote:
> On Tue, Mar 8, 2011 at 3:34 PM, Rob Herring<robherring2@gmail.com> wrote:
>> From: Rob Herring<rob.herring@calxeda.com>
>>
>> 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<rob.herring@calxeda.com>
>> ---
>> v3: Save struct clk pointer for later use (cpufreq).
>>
>> arch/arm/include/asm/smp_twd.h | 1 +
>> arch/arm/kernel/smp_twd.c | 14 ++++++++++++++
>> 2 files changed, 15 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/smp_twd.h b/arch/arm/include/asm/smp_twd.h
>> index fed9981..6b0f591 100644
>> --- a/arch/arm/include/asm/smp_twd.h
>> +++ b/arch/arm/include/asm/smp_twd.h
>> @@ -24,5 +24,6 @@ extern void __iomem *twd_base;
>>
>> int twd_timer_ack(void);
>> void twd_timer_setup(struct clock_event_device *);
>> +void twd_timer_init(void __iomem *base);
>>
>> #endif
>> diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
>> index 60636f4..cce1171 100644
>> --- a/arch/arm/kernel/smp_twd.c
>> +++ b/arch/arm/kernel/smp_twd.c
>> @@ -8,6 +8,8 @@
>> * it under the terms of the GNU General Public License version 2 as
>> * published by the Free Software Foundation.
>> */
>> +#include<linux/clk.h>
>> +#include<linux/err.h>
>> #include<linux/init.h>
>> #include<linux/kernel.h>
>> #include<linux/delay.h>
>> @@ -24,6 +26,7 @@
>> /* set up by the platform code */
>> void __iomem *twd_base;
>>
>> +static struct clk *twd_clk;
>> static unsigned long twd_timer_rate;
>>
>> static void twd_set_mode(enum clock_event_mode mode,
>> @@ -142,3 +145,14 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
>>
>> clockevents_register_device(clk);
>> }
>> +
>> +void __init twd_timer_init(void __iomem *base)
>> +{
>> + twd_clk = clk_get_sys("smp_twd", NULL);
>> + if (!IS_ERR(twd_clk))
>> + twd_timer_rate = clk_get_rate(twd_clk);
>> + else
>> + twd_clk = NULL;
>> +
>> + twd_base = base;
>> +}
> Why not leave the old twd_base intitialization and put the clock stuff
> in twd_timer_setup?
Well the original patch had base addr and a struct clk pointer passed in
for this function. So replacing the variable setting in platform code
with this function made sense then. Setting variables like twd_base
directly is generally disliked.
twd_timer_setup is called for each core, so it is probably cleaner to
have global init and per core init separate. Although, the clock could
be per core in future chips.
>
> Would it make sense to drop twd_calibrate_rate entirely and require a twd clock?
Yes I would like to, but the clock needs to be added to every platform
before twd_calibrate_rate could be removed.
Rob
next prev parent reply other threads:[~2011-03-15 12:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-08 23:34 [PATCH v3 0/7] ARM timer clock api support Rob Herring
2011-03-08 23:34 ` [PATCH v3 1/7] ARM: integrator cp: add sp804 clock Rob Herring
2011-03-08 23:34 ` [PATCH v3 2/7] ARM: realview: " Rob Herring
2011-03-08 23:34 ` [PATCH v3 3/7] ARM: versatile: " Rob Herring
2011-03-08 23:34 ` [PATCH v3 4/7] ARM: vexpress: " Rob Herring
2011-03-08 23:34 ` [PATCH v3 5/7] ARM: timer-sp: support timer clock freq other than 1MHz Rob Herring
2011-03-08 23:34 ` [PATCH v3 6/7] ARM: smp_twd: add clock api support Rob Herring
2011-03-15 2:35 ` Colin Cross
2011-03-15 12:40 ` Rob Herring [this message]
2011-03-08 23:34 ` [PATCH v3 7/7] ARM: vexpress: add smp_twd clock Rob Herring
2011-03-11 8:16 ` [PATCH v3 0/7] ARM timer clock api support Russell King - ARM Linux
2011-03-11 13:48 ` Rob Herring
2011-03-15 8:51 ` Russell King - ARM Linux
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D7F5E5A.5020508@gmail.com \
--to=robherring2@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).