From: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, Mike Turquette <mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>, Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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
WARNING: multiple messages have this Message-ID (diff)
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: 36+ 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 [not found] ` <1345104526-14797-1-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2012-08-16 8:08 ` Shawn Guo [this message] 2012-08-16 8:08 ` [PATCH 1/2] clk: add of_clk_src_onecell_get() support Shawn Guo [not found] ` <1345104526-14797-2-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2012-08-20 14:30 ` Shawn Guo 2012-08-20 14:30 ` Shawn Guo 2012-08-16 8:08 ` [PATCH 2/2] ARM: imx6q: replace clk_register_clkdev with clock DT lookup Shawn Guo 2012-08-16 8:08 ` Shawn Guo [not found] ` <1345104526-14797-3-git-send-email-shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 2012-08-20 12:51 ` Rob Herring 2012-08-20 12:51 ` Rob Herring [not found] ` <503232E0.3000007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2012-08-20 14:54 ` Matt Sealey 2012-08-20 14:54 ` Matt Sealey [not found] ` <CAKGA1bn2uCWE8YkGR4EzTxZ_bXJ_ov2diq63uxQ=dT7b6Fu9GQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-08-20 15:16 ` Shawn Guo 2012-08-20 15:16 ` Shawn Guo [not found] ` <20120820151609.GN24242-rvtDTF3kK1ictlrPMvKcciBecyulp+rMXqFh9Ls21Oc@public.gmane.org> 2012-08-20 17:22 ` Matt Sealey 2012-08-20 17:22 ` Matt Sealey [not found] ` <CAKGA1bnfhMC8QG9OqBbpy5iq6ZAfEgrYMg_LVd50U7yikLhDAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-08-21 12:27 ` Russell King - ARM Linux 2012-08-21 12:27 ` Russell King - ARM Linux [not found] ` <20120821122753.GU18957-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org> 2012-08-21 13:11 ` Rob Herring 2012-08-21 13:11 ` Rob Herring 2012-08-22 8:32 ` Russell King - ARM Linux 2012-08-22 8:32 ` Russell King - ARM Linux [not found] ` <20120822083223.GW18957-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org> 2012-08-22 9:27 ` Shawn Guo 2012-08-22 9:27 ` Shawn Guo 2012-08-22 2:47 ` Shawn Guo 2012-08-22 2:47 ` Shawn Guo 2012-08-21 12:53 ` Rob Herring 2012-08-21 12:53 ` Rob Herring [not found] ` <503384E3.4030705-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> 2012-08-22 22:50 ` Matt Sealey 2012-08-22 22:50 ` Matt Sealey [not found] ` <CAKGA1bkNGJhsCGVBsHnaQn=Dg5T==QP_JnqOXycq8jQn-W-0Kw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-08-23 0:08 ` Matt Sealey 2012-08-23 0:08 ` Matt Sealey [not found] ` <CAKGA1bnCk=FqANsVFD123y3uP5dn9AMZydR__mMXrzh6StrBjg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2012-08-23 1:32 ` Rob Herring 2012-08-23 1:32 ` Rob Herring 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-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \ --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \ --cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.