From: richard.zhao@linaro.org (Richard Zhao)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC V2 6/8] ARM i.MX: prepare common clk support
Date: Sun, 18 Dec 2011 15:59:33 +0800 [thread overview]
Message-ID: <20111218075930.GA1705@richard-laptop> (raw)
In-Reply-To: <CAPtuhTim42ZjqPA5i+O0eHqEmfmO2Z5nJnBAA+TWS753gH8m5w@mail.gmail.com>
On Fri, Dec 16, 2011 at 03:34:14PM -0800, Mike Turquette wrote:
> On Wed, Dec 14, 2011 at 1:23 AM, Richard Zhao <richard.zhao@linaro.org> wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > Add static clock help macros, clock register spinlock.
> >
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> > Signed-off-by: Richard Zhao <richard.zhao@linaro.org>
> > ---
> > ?arch/arm/plat-mxc/clock.c ? ? ? ? ? ? ?| ? ?8 ++++++
> > ?arch/arm/plat-mxc/include/mach/clock.h | ? 42 +++++++++++++++++++++++++++++--
> > ?2 files changed, 47 insertions(+), 3 deletions(-)
> >
> ...
> >
> > +extern spinlock_t imx_ccm_lock;
> > +
> > +#define DEFINE_CLK_GATE2B(_name, _parent, _reg, _shift) \
> > + ? ? ? struct clk_gate2b _name = { \
> > + ? ? ? ? ? ? ? .clk = { \
> > + ? ? ? ? ? ? ? ? ? ? ? .name = #_name, \
> > + ? ? ? ? ? ? ? ? ? ? ? .ops = &clk_gate2b_ops, \
> > + ? ? ? ? ? ? ? ? ? ? ? .parent = _parent, \
> > + ? ? ? ? ? ? ? }, \
> > + ? ? ? ? ? ? ? .reg = (_reg), \
> > + ? ? ? ? ? ? ? .shift = (_shift) * 2, \
> > + ? ? ? ? ? ? ? .val_en = 0x3, \
> > + ? ? ? ? ? ? ? .val_dis = 0x0, \
> > + ? ? ? ? ? ? ? .lock = &imx_ccm_lock, \
> > + ? ? ? }
> > +
> > +#define IMX_DEFINE_CLK_DIVIDER(_name, _parent, _flags, _reg, _shift, _width) \
> > + ? ? ? DEFINE_CLK_DIVIDER(_name, _parent, _flags, _reg, _shift, _width, \
> > + ? ? ? ? ? ? ? ? ? ? ? &imx_ccm_lock)
> > +
> > +#define IMX_DEFINE_CLK_MUX(_name, _reg, _shift, _width, _clks) \
> > + ? ? ? DEFINE_CLK_MUX(_name, _reg, _shift, _width, _clks, &imx_ccm_lock)
>
> gate2b, basic div and basic mux clks all use the imx_ccm_lock. How
> many registers are we talking about here? If the number is very high
> then maybe per-register locking makes sense for you?
per-register/per-register group locking make me feel complicated. How do I group the
registers? and register layout may change for different SoCs.
Considering prepare_lock and enable_lock, only gate register that share with other
non-gate clocks needs a lock. Keeping the rule in mind is strange, and easy to come
with faults.
Another way is to use a global lock. Do normal register read/write in the lock. but for
status busy wait checking, it's read only, we can release the lock temporarily.
Thanks
Richard
>
> Also, do you need locking added to the basic gated clk type, or any of
> the others? I'll probably add it anyways but just curious...
I think yes. Give usr an option to use the lock.
Thanks
Richard
>
> Regards,
> Mike
prev parent reply other threads:[~2011-12-18 7:59 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
[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 [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=20111218075930.GA1705@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;
as well as URLs for NNTP newsgroup(s).