From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Wan ZongShun <mcuos.com@gmail.com>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NUC900: patch for implement clk_get_rate
Date: Thu, 15 Jul 2010 12:39:39 +0100 [thread overview]
Message-ID: <20100715113939.GE29322@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <4C175ED4.8080303@gmail.com>
On Tue, Jun 15, 2010 at 07:07:00PM +0800, Wan ZongShun wrote:
> According to Baruch's advice, I re-orgnize previous patch named
> 'Add platform support for nuc900 i2c driver'.
>
> This patch is for implementing clk_get_rate, there are four clk
> rates were needed to get, cpufreq,ahb,apb and external crystal.
> clk_get_rate return value is for external crystal.
>
> ---
> arch/arm/mach-w90x900/clock.c | 9 +++++++
> arch/arm/mach-w90x900/clock.h | 5 ++++
> arch/arm/mach-w90x900/cpu.c | 50 +++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 64 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-w90x900/clock.c b/arch/arm/mach-w90x900/clock.c
> index 2c371ff..6325642 100644
> --- a/arch/arm/mach-w90x900/clock.c
> +++ b/arch/arm/mach-w90x900/clock.c
> @@ -57,6 +57,15 @@ EXPORT_SYMBOL(clk_disable);
>
> unsigned long clk_get_rate(struct clk *clk)
> {
> + unsigned long flags, ret;
> +
> + if (clk == NULL || IS_ERR(clk))
> + return -EPERM;
Is there a reason to check for these cases?
> + spin_lock_irqsave(&clocks_lock, flags);
> + ret = nuc900_get_cpuclock(&clk->cpufreq, &clk->ahbfreq, &clk->apbfreq);
> + spin_unlock_irqrestore(&clocks_lock, flags);
> + if (ret)
> + return ret;
Hmm, I don't follow this - and it doesn't seem to sit with the clk API
model at all well. cpufreq/ahbfreq/apbfreq seem to only ever be
written, but never read. I'm not sure either why every struct clk has
to have these - they seem to be separate clocks unrelated to the
struct clk that's being dealt with.
Wouldn't it make more sense to have these three as separate struct clks?
The other issue is that we're introducing an "apb_pclk" for all
primecells using drivers/amba/bus.c in order to support SoCs which gate
the APB pclk signal to individual primecells. It sounds like this clock
would be the natural owner what you call 'apbfreq' in your patch.
prev parent reply other threads:[~2010-07-15 11:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-15 11:07 Wan ZongShun
2010-07-15 11:39 ` Russell King - ARM Linux [this message]
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=20100715113939.GE29322@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcuos.com@gmail.com \
/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
all inboxes | Powered by JetHome®