From: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
Mike Turquette
<mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: [PATCH RFC 1/3] clk: of: helper for determining number of parent clocks
Date: Mon, 3 Jun 2013 10:53:08 -0700 [thread overview]
Message-ID: <1370281990-15090-2-git-send-email-mturquette@linaro.org> (raw)
In-Reply-To: <1370281990-15090-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Walks the "clocks" array of parent clock phandles and returns the
number.
Signed-off-by: Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
DT gurus, please let me know if this is stupid. I am unfamiliar with
parsing DT blobs and associated APIs.
drivers/clk/clk.c | 6 ++++++
include/linux/clk-provider.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index af0dbcc..73e0358 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -2082,6 +2082,12 @@ struct clk *of_clk_get_from_provider(struct of_phandle_args *clkspec)
return clk;
}
+int of_clk_get_parent_count(struct device_node *np)
+{
+ return of_count_phandle_with_args(np, "clocks", "#clock-cells");
+}
+EXPORT_SYMBOL_GPL(of_clk_get_parent_count);
+
const char *of_clk_get_parent_name(struct device_node *np, int index)
{
struct of_phandle_args clkspec;
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 265f384..f8d38f2 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -442,6 +442,7 @@ 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);
+int of_clk_get_parent_count(struct device_node *np);
const char *of_clk_get_parent_name(struct device_node *np, int index);
void of_clk_init(const struct of_device_id *matches);
--
1.8.1.2
next prev parent reply other threads:[~2013-06-03 17:53 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 17:53 [PATCH RFC 0/3] clk: dt: bindings for mux & divider clocks Mike Turquette
[not found] ` <1370281990-15090-1-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-03 17:53 ` Mike Turquette [this message]
2013-06-03 22:31 ` Heiko Stübner
2013-06-03 17:53 ` [PATCH RFC 2/3] clk: dt: binding for basic multiplexor clock Mike Turquette
2013-06-03 19:33 ` Heiko Stübner
2013-06-03 20:07 ` Mike Turquette
2013-06-03 20:15 ` Heiko Stübner
[not found] ` <201306032215.45983.heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>
2013-06-03 21:39 ` Heiko Stübner
2013-06-04 6:14 ` Mike Turquette
2013-06-03 17:53 ` [PATCH RFC 3/3] clk: dt: binding for basic divider clock Mike Turquette
[not found] ` <1370281990-15090-4-git-send-email-mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-06-03 22:18 ` Heiko Stübner
2013-06-13 2:41 ` Mike Turquette
2013-06-04 17:11 ` Stephen Boyd
2013-06-04 17:39 ` Matt Sealey
2013-06-04 19:22 ` Mike Turquette
2013-06-04 20:13 ` Matt Sealey
2013-06-06 0:09 ` Heiko Stübner
2013-06-07 5:51 ` [PATCH RFC 0/3] clk: dt: bindings for mux & divider clocks Shawn Guo
[not found] ` <20130607055128.GA20780-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-06-07 17:52 ` Mike Turquette
2013-06-08 3:02 ` Shawn Guo
[not found] ` <20130608030240.GB22134-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org>
2013-06-08 18:25 ` Mike Turquette
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=1370281990-15090-2-git-send-email-mturquette@linaro.org \
--to=mturquette-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.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).