From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] clk: add of_clk_src_onecell_get() support
Date: Thu, 16 Aug 2012 16:08:45 +0800 [thread overview]
Message-ID: <1345104526-14797-2-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <1345104526-14797-1-git-send-email-shawn.guo@linaro.org>
For those SoCs that have hundreds of clock outputs, their clock
DT bindings could reasonably define #clock-cells as 1 and require
the client device specify the index of the clock it consumes in the
cell of its "clocks" phandle.
Add a generic of_clk_src_onecell_get() function for this purpose.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/clk/clk.c | 15 +++++++++++++++
include/linux/clk-provider.h | 1 +
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index efdfd00..06bc0b5 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1582,6 +1582,21 @@ struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
}
EXPORT_SYMBOL_GPL(of_clk_src_simple_get);
+struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data)
+{
+ const char *clk_name;
+ int idx = clkspec->args[0];
+ int ret;
+
+ ret = of_property_read_string_index(clkspec->np, "clock-output-names",
+ idx, &clk_name);
+ if (ret < 0)
+ return ERR_PTR(ret);
+
+ return __clk_lookup(clk_name);
+}
+EXPORT_SYMBOL_GPL(of_clk_src_onecell_get);
+
/**
* of_clk_add_provider() - Register a clock provider for a node
* @np: Device node pointer associated with clock provider
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 77335fa..2afcadf 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -360,6 +360,7 @@ int of_clk_add_provider(struct device_node *np,
void of_clk_del_provider(struct device_node *np);
struct clk *of_clk_src_simple_get(struct of_phandle_args *clkspec,
void *data);
+struct clk *of_clk_src_onecell_get(struct of_phandle_args *clkspec, void *data);
const char *of_clk_get_parent_name(struct device_node *np, int index);
void of_clk_init(const struct of_device_id *matches);
--
1.7.5.4
next prev parent reply other threads:[~2012-08-16 8:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-16 8:08 [PATCH 0/2] Move imx6q clock lookup over to device tree Shawn Guo
2012-08-16 8:08 ` Shawn Guo [this message]
2012-08-20 14:30 ` [PATCH 1/2] clk: add of_clk_src_onecell_get() support Shawn Guo
2012-08-16 8:08 ` [PATCH 2/2] ARM: imx6q: replace clk_register_clkdev with clock DT lookup Shawn Guo
2012-08-20 12:51 ` Rob Herring
2012-08-20 14:54 ` Matt Sealey
2012-08-20 15:16 ` Shawn Guo
2012-08-20 17:22 ` Matt Sealey
2012-08-21 12:27 ` Russell King - ARM Linux
2012-08-21 13:11 ` Rob Herring
2012-08-22 8:32 ` Russell King - ARM Linux
2012-08-22 9:27 ` Shawn Guo
2012-08-21 12:53 ` Rob Herring
2012-08-22 22:50 ` Matt Sealey
2012-08-23 0:08 ` Matt Sealey
2012-08-23 1:32 ` Rob Herring
2012-08-22 2:47 ` Shawn Guo
2012-08-19 14:05 ` [PATCH 3/4] clk: mxs: replace imx28 " Shawn Guo
2012-08-19 14:05 ` [PATCH 4/4] clk: mxs: replace imx23 " Shawn Guo
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=1345104526-14797-2-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@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).