From: Ryan Mallon <rmallon@gmail.com>
To: Mike Turquette <mturquette@linaro.org>
Cc: linux@arm.linux.org.uk, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
jeremy.kerr@canonical.com, paul@pwsan.com,
broonie@opensource.wolfsonmicro.com, tglx@linutronix.de,
linus.walleij@stericsson.com, amit.kucheria@linaro.org,
dsaxena@linaro.org, patches@linaro.org,
linaro-dev@lists.linaro.org, grant.likely@secretlab.ca,
sboyd@quicinc.com, shawn.guo@freescale.com, skannan@quicinc.com,
magnus.damm@gmail.com, arnd.bergmann@linaro.org,
eric.miao@linaro.org, richard.zhao@linaro.org, mturquette@ti.com,
andrew@lunn.ch, Jamie Iles <jamie@jamieiles.com>
Subject: Re: [PATCH v4 5/6] clk: basic gateable and fixed-rate clks
Date: Wed, 14 Dec 2011 16:15:01 +1100 [thread overview]
Message-ID: <4EE830D5.5070305@gmail.com> (raw)
In-Reply-To: <1323834838-2206-6-git-send-email-mturquette@linaro.org>
On 14/12/11 14:53, Mike Turquette wrote:
> Many platforms support simple gateable clks and fixed-rate clks that
> should not be re-implemented by every platform.
>
> This patch introduces a gateable clk with a common programming model of
> gate control via a write of 1 bit to a register. Both set-to-enable and
> clear-to-enable are supported.
>
> Also introduced is a fixed-rate clk which has no reprogrammable aspects.
>
> The purpose of both types of clks is documented in drivers/clk/basic.c.
>
> TODO: add support for a simple divider, simple mux and a dummy clk for
> stubbing out platform support.
>
> Based on original patch by Jeremy Kerr and contribution by Jamie Iles.
>
> Signed-off-by: Mike Turquette <mturquette@linaro.org>
> Cc: Jeremy Kerr <jeremy.kerr@canonical.com>
> Cc: Jamie Iles <jamie@jamieiles.com>
<snip>
> +int clk_register_gate(struct device *dev, const char *name, unsigned long flags,
> + struct clk *fixed_parent, void __iomem *reg, u8 bit_idx,
> + int set_to_enable)
> +{
> + struct clk_hw_gate *gclk;
> + struct clk *clk;
> +
> + gclk = kmalloc(sizeof(struct clk_hw_gate), GFP_KERNEL);
> +
> + if (!gclk) {
> + pr_err("%s: could not allocate gated clk\n", __func__);
> + return -ENOMEM;
> + }
> +
> + clk = &gclk->clk;
> +
> + /* struct clk_hw_gate assignments */
> + gclk->fixed_parent = fixed_parent;
> + gclk->reg = reg;
> + gclk->bit_idx = bit_idx;
> +
> + /* struct clk assignments */
> + clk->name = name;
> + clk->flags = flags;
> +
> + if (set_to_enable)
> + clk->ops = &clk_hw_gate_set_enable_ops;
> + else
> + clk->ops = &clk_hw_gate_set_disable_ops;
You could avoid having two sets of operations if you stored the
set_to_enable value in struct clk_hw_gate. It might be useful to store
additional information in struct clk_hw_gate if you also want to extend
to supporting non-32bit registers (readb, etc), clocks with write only
registers, or support clocks which require more than one bit to be set
or cleared to enable them, etc. See the basic mmio gpio driver for a
similar case.
~Ryan
next prev parent reply other threads:[~2011-12-14 5:15 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-14 3:53 [PATCH v4 0/6] common clk framework Mike Turquette
[not found] ` <1323834838-2206-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2011-12-14 3:53 ` [PATCH v4 1/6] clk: Kconfig: add entry for HAVE_CLK_PREPARE Mike Turquette
2011-12-14 3:53 ` [PATCH v4 2/6] Documentation: common clk API Mike Turquette
2012-01-05 14:31 ` Amit Kucheria
2012-01-05 20:04 ` Turquette, Mike
2011-12-14 3:53 ` [PATCH v4 3/6] clk: introduce the common clock framework Mike Turquette
2011-12-14 4:52 ` Ryan Mallon
[not found] ` <4EE82B76.2000204-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-14 19:07 ` Turquette, Mike
2011-12-14 7:50 ` Richard Zhao
2011-12-14 13:18 ` Thomas Gleixner
2011-12-17 0:45 ` Turquette, Mike
2011-12-17 11:04 ` Russell King - ARM Linux
2012-01-14 4:18 ` Saravana Kannan
[not found] ` <4F11021A.8070407-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-01-14 4:39 ` Turquette, Mike
2012-01-14 4:51 ` Saravana Kannan
[not found] ` <CAJOA=zO=gM2r4pCVo+orLqE9Q1SSw4h5nXsAHo-e_SHZAfvKDA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-04 2:15 ` Richard Zhao
2012-01-04 14:32 ` Rob Herring
[not found] ` <4F0462FF.1000308-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-01-05 1:01 ` Turquette, Mike
2012-01-05 1:23 ` Richard Zhao
2012-01-05 2:11 ` Rob Herring
2012-01-05 4:07 ` Turquette, Mike
[not found] ` <CAJOA=zPgwiOSoyZK1SpzZVZfTOmwruTR=WO+gRdVZrZVzNuPSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-01-12 13:13 ` Amit Kucheria
2012-01-13 0:04 ` Saravana Kannan
2012-01-13 0:48 ` Rob Herring
2012-01-13 1:19 ` Saravana Kannan
[not found] ` <4F0F7507.3080501-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2012-01-13 14:53 ` Shawn Guo
2011-12-14 3:53 ` [PATCH v4 4/6] clk: introduce rate change notifiers Mike Turquette
2011-12-14 3:53 ` [PATCH v4 5/6] clk: basic gateable and fixed-rate clks Mike Turquette
2011-12-14 5:15 ` Ryan Mallon [this message]
[not found] ` <4EE830D5.5070305-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2011-12-17 0:57 ` Turquette, Mike
2011-12-14 3:53 ` [PATCH v4 6/6] clk: export the clk tree topology to debugfs Mike Turquette
2011-12-14 4:02 ` [PATCH v4 0/6] common clk framework Turquette, Mike
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=4EE830D5.5070305@gmail.com \
--to=rmallon@gmail.com \
--cc=amit.kucheria@linaro.org \
--cc=andrew@lunn.ch \
--cc=arnd.bergmann@linaro.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dsaxena@linaro.org \
--cc=eric.miao@linaro.org \
--cc=grant.likely@secretlab.ca \
--cc=jamie@jamieiles.com \
--cc=jeremy.kerr@canonical.com \
--cc=linaro-dev@lists.linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=mturquette@linaro.org \
--cc=mturquette@ti.com \
--cc=patches@linaro.org \
--cc=paul@pwsan.com \
--cc=richard.zhao@linaro.org \
--cc=sboyd@quicinc.com \
--cc=shawn.guo@freescale.com \
--cc=skannan@quicinc.com \
--cc=tglx@linutronix.de \
/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).