From: Shawn Guo <shawn.guo@freescale.com>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: <linux-kernel@vger.kernel.org>,
<devicetree-discuss@lists.ozlabs.org>,
Mike Turquette <mturquette@ti.com>,
Sascha Hauer <kernel@pengutronix.de>,
Rob Herring <rob.herring@calxeda.com>
Subject: Re: [RFC v2 5/9] dt/clock: Add handling for fixed clocks and a clock node setup iterator
Date: Thu, 15 Dec 2011 23:19:51 +0800 [thread overview]
Message-ID: <20111215151950.GC2831@S2100-06.ap.freescale.net> (raw)
In-Reply-To: <1323727329-4989-5-git-send-email-grant.likely@secretlab.ca>
Hi Grant,
On Mon, Dec 12, 2011 at 03:02:05PM -0700, Grant Likely wrote:
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> ---
> drivers/of/clock.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> include/linux/of_clk.h | 4 ++++
> 2 files changed, 47 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/of/clock.c b/drivers/of/clock.c
> index 6519e96..1c189b4 100644
> --- a/drivers/of/clock.c
> +++ b/drivers/of/clock.c
> @@ -3,6 +3,7 @@
> */
>
> #include <linux/clk.h>
> +#include <linux/clkdev.h>
> #include <linux/err.h>
> #include <linux/errno.h>
> #include <linux/module.h>
> @@ -163,3 +164,45 @@ struct clk *of_clk_get_by_name(struct device_node *np, const char *name)
>
> return clk;
> }
> +
> +/**
> + * of_clk_init() - Scan and init clock providers from the DT
> + * @matches: array of compatible values and init functions for providers.
> + *
> + * This function scans the device tree for matching clock providers and
> + * calls their initialization functions
> + */
> +void __init of_clk_init(const struct of_device_id *matches)
> +{
> + struct device_node *np;
> +
> + for_each_matching_node(np, matches) {
> + const struct of_device_id *match = of_match_node(matches, np);
> + of_clk_init_cb_t clk_init_cb = match->data;
> + clk_init_cb(np);
> + }
> +}
> +
> +static struct clk *of_fixed_clk_get(struct of_phandle_args *a, void *data)
> +{
> + return data;
> +}
> +
> +/**
> + * of_fixed_clk_setup() - Setup function for simple fixed rate clock
> + */
> +void __init of_fixed_clk_setup(struct device_node *node)
> +{
> + struct clk *clk;
> + u32 rate;
> +
> + if (of_property_read_u32(node, "clock-frequency", &rate))
> + return;
> +
> + clk = kzalloc(sizeof(*clk), GFP_KERNEL);
> + if (!clk)
> + return;
> + clk->rate = rate;
> +
> + of_clk_add_provider(node, of_fixed_clk_get, clk);
> +}
Just take the fixed clk as example, I have a node below as a blob,
which has 3 fixed clks encoded.
ref_clk: ref {
compatible = "fixed-clock", "basic-clock";
#clock-cells = <1>;
clock-frequency = <24000000 32768 0>;
clock-output-name = "osc",
"ckil",
"ckih";
};
If this is valid, the of_fixed_clk_setup() should scan the node for
multiple clks, right?
--
Regards,
Shawn
next prev parent reply other threads:[~2011-12-15 15:10 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 22:02 [RFC v2 1/9] arm/versatile*: merge all versatile struct clk definitions Grant Likely
2011-12-12 22:02 ` [RFC v2 2/9] arm/versatile*: Consolidate clk_ops and setvco implementations Grant Likely
2011-12-12 22:02 ` [RFC v2 3/9] of: Add of_property_match_string() to find index into a string list Grant Likely
2011-12-12 22:02 ` [RFC v2 4/9] of: add clock providers Grant Likely
2011-12-12 23:29 ` Jamie Iles
2011-12-13 17:54 ` Grant Likely
2011-12-13 18:01 ` Rob Herring
2011-12-13 18:03 ` Grant Likely
2011-12-15 13:51 ` Shawn Guo
2011-12-15 14:23 ` Rob Herring
2011-12-15 15:13 ` Shawn Guo
2011-12-15 17:37 ` Grant Likely
2012-01-10 21:33 ` Jamie Iles
2012-01-12 4:46 ` Grant Likely
2012-01-12 10:07 ` Jamie Iles
2012-01-12 18:44 ` Turquette, Mike
2012-01-12 19:16 ` Grant Likely
2012-01-13 12:47 ` Shawn Guo
2012-01-14 4:30 ` Turquette, Mike
2012-01-14 5:40 ` Shawn Guo
2012-01-13 13:50 ` Shawn Guo
2012-01-13 14:05 ` Rob Herring
2012-01-13 14:38 ` Shawn Guo
2012-01-17 20:44 ` Stephen Warren
2012-01-17 22:47 ` Grant Likely
2012-01-17 23:37 ` Turquette, Mike
2012-01-17 23:49 ` Grant Likely
2012-01-18 0:05 ` Stephen Warren
2011-12-12 22:02 ` [RFC v2 5/9] dt/clock: Add handling for fixed clocks and a clock node setup iterator Grant Likely
2011-12-15 15:19 ` Shawn Guo [this message]
2011-12-12 22:02 ` [RFC v2 6/9] arm/dt: add devicetree support to sp804 timer support Grant Likely
2011-12-12 23:54 ` Rob Herring
2011-12-12 22:02 ` [RFC v2 7/9] arm/dt: Common plat-versatile support for icst and sp804 based system clocks Grant Likely
2012-01-17 21:05 ` Stephen Warren
2012-01-17 22:02 ` Rob Herring
2012-01-17 22:59 ` Grant Likely
2011-12-12 22:02 ` [RFC v2 8/9] dt/arm: versatile add clock parsing Grant Likely
2011-12-12 22:02 ` [RFC v2 9/9] arm/highbank: Use clock binding common support code Grant Likely
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=20111215151950.GC2831@S2100-06.ap.freescale.net \
--to=shawn.guo@freescale.com \
--cc=devicetree-discuss@lists.ozlabs.org \
--cc=grant.likely@secretlab.ca \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@ti.com \
--cc=rob.herring@calxeda.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®