From: richard.zhao@linaro.org (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC V2 5/8] ARM i.MX: clk: add generic support of gate2b
Date: Sun, 18 Dec 2011 16:06:21 +0800 [thread overview]
Message-ID: <20111218080619.GB1705@richard-laptop> (raw)
In-Reply-To: <CAPtuhTity_fnmi2ezvWgo0iGqjeT9BTjZLnFjhE1cSPKAA+oHw@mail.gmail.com>
On Fri, Dec 16, 2011 at 03:25:53PM -0800, Mike Turquette wrote:
> On Wed, Dec 14, 2011 at 1:23 AM, Richard Zhao <richard.zhao@linaro.org> wrote:
> > +static int clk_gate2b_enable(struct clk *clk)
> > +{
> > + ? ? ? struct clk_gate2b *gate2b = to_clk_gate2b(clk);
> > + ? ? ? unsigned long flags;
> > + ? ? ? u32 reg;
> > +
> > + ? ? ? if (gate2b->lock)
> > + ? ? ? ? ? ? ? spin_lock_irqsave(gate2b->lock, flags);
>
> Are their bits in this register used by other clocks which aren't
> protected by the enable_lock spinlock?
For now, no. If I remove the lock, it'll limit the gate2b usage.
>
> > +int clk_gate2b_set_val(struct clk *clk, int en, int dis)
> > +{
> > + ? ? ? struct clk_gate2b *gate2b = to_clk_gate2b(clk);
> > + ? ? ? unsigned long flags;
> > + ? ? ? u32 reg, val;
> > +
> > + ? ? ? en &= 0x3;
> > + ? ? ? dis &= 0x3;
> > +
> > + ? ? ? if (gate2b->lock)
> > + ? ? ? ? ? ? ? spin_lock_irqsave(gate2b->lock, flags);
> > +
> > + ? ? ? reg = __raw_readl(gate2b->reg);
> > + ? ? ? val = (reg >> gate2b->shift) & 0x3;
> > + ? ? ? reg &= ~(0x3 << gate2b->shift);
> > + ? ? ? if (val == gate2b->val_en && val != en)
> > + ? ? ? ? ? ? ? reg |= en << gate2b->shift;
> > + ? ? ? else if (val == gate2b->val_dis && val != dis)
> > + ? ? ? ? ? ? ? reg |= dis << gate2b->shift;
> > + ? ? ? __raw_writel(reg, gate2b->reg);
> > + ? ? ? gate2b->val_en = en;
> > + ? ? ? gate2b->val_dis = dis;
> > +
> > + ? ? ? if (gate2b->lock)
> > + ? ? ? ? ? ? ? spin_unlock_irqrestore(gate2b->lock, flags);
> > +
> > + ? ? ? return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(clk_gate2b_set_val);
>
> Who calls clk_gate2b_set_val, and why?
It's an interface for busfreq. When I enable a gate2b, I may want it to be
active when cpu is running but disabled when wfi. I may also want it to be
active all the time, if some dma device also need it.
So the value I set for enable/disable change at runtime.
Thanks
Richard
>
> Regards,
> Mike
next prev parent reply other threads:[~2011-12-18 8:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 9:23 [RFC V2 0/8] imx5 clock port to Mike's clkv4 Richard Zhao
2011-12-14 10:06 ` Richard Zhao
[not found] ` <1323854638-3455-2-git-send-email-richard.zhao@linaro.org>
2011-12-16 21:21 ` [RFC V2 1/8] clk: pass parent rate if recalc_rate is NULL Mike Turquette
[not found] ` <1323854638-3455-5-git-send-email-richard.zhao@linaro.org>
2011-12-16 23:17 ` [RFC V2 4/8] ARM i.MX: Add generic support for pllv2 Mike Turquette
2011-12-17 4:01 ` Richard Zhao
[not found] ` <1323854638-3455-6-git-send-email-richard.zhao@linaro.org>
2011-12-16 23:25 ` [RFC V2 5/8] ARM i.MX: clk: add generic support of gate2b Mike Turquette
2011-12-18 8:06 ` Richard Zhao [this message]
[not found] ` <1323854638-3455-7-git-send-email-richard.zhao@linaro.org>
2011-12-16 23:34 ` [RFC V2 6/8] ARM i.MX: prepare common clk support Mike Turquette
2011-12-18 7:59 ` Richard Zhao
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=20111218080619.GB1705@richard-laptop \
--to=richard.zhao@linaro.org \
--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