From: Stephen Boyd <sboyd@codeaurora.org>
To: Mike Turquette <mturquette@linaro.org>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Josh Cartwright <josh.cartwright@ni.com>,
Soren Brinkmann <soren.brinkmann@xilinx.com>
Subject: [PATCH 4/4] clk: zynq: Use of_init_clk_data()
Date: Mon, 17 Dec 2012 13:02:15 -0800 [thread overview]
Message-ID: <1355778135-32458-5-git-send-email-sboyd@codeaurora.org> (raw)
In-Reply-To: <1355778135-32458-1-git-send-email-sboyd@codeaurora.org>
Reduce lines of code and simplify this driver by using the
generic clock binding parsing function. This also fixes a bug
where the 'flags' member of the init struct is not initialized.
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Josh Cartwright <josh.cartwright@ni.com>
Cc: Soren Brinkmann <soren.brinkmann@xilinx.com>
---
drivers/clk/clk-zynq.c | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/drivers/clk/clk-zynq.c b/drivers/clk/clk-zynq.c
index 37a3051..0fcc23d 100644
--- a/drivers/clk/clk-zynq.c
+++ b/drivers/clk/clk-zynq.c
@@ -48,7 +48,6 @@ static void __init zynq_pll_clk_setup(struct device_node *np)
{
struct clk_init_data init;
struct zynq_pll_clk *pll;
- const char *parent_name;
struct clk *clk;
u32 regs[2];
int ret;
@@ -64,12 +63,10 @@ static void __init zynq_pll_clk_setup(struct device_node *np)
pll->pll_ctrl = slcr_base + regs[0];
pll->pll_cfg = slcr_base + regs[1];
- of_property_read_string(np, "clock-output-names", &init.name);
-
+ ret = of_init_clk_data(np, &init);
+ if (WARN_ON(ret))
+ return;
init.ops = &zynq_pll_clk_ops;
- parent_name = of_clk_get_parent_name(np, 0);
- init.parent_names = &parent_name;
- init.num_parents = 1;
pll->hw.init = &init;
@@ -119,13 +116,11 @@ static const struct clk_ops zynq_periph_clk_ops = {
static void __init zynq_periph_clk_setup(struct device_node *np)
{
struct zynq_periph_clk *periph;
- const char *parent_names[3];
struct clk_init_data init;
int clk_num = 0, err;
const char *name;
struct clk *clk;
u32 reg;
- int i;
err = of_property_read_u32(np, "reg", ®);
if (WARN_ON(err))
@@ -138,12 +133,10 @@ static void __init zynq_periph_clk_setup(struct device_node *np)
periph->clk_ctrl = slcr_base + reg;
spin_lock_init(&periph->clkact_lock);
- init.name = np->name;
+ err = of_init_clk_data(np, &init);
+ if (WARN_ON(err))
+ return;
init.ops = &zynq_periph_clk_ops;
- for (i = 0; i < ARRAY_SIZE(parent_names); i++)
- parent_names[i] = of_clk_get_parent_name(np, i);
- init.parent_names = parent_names;
- init.num_parents = ARRAY_SIZE(parent_names);
periph->hw.init = &init;
@@ -315,7 +308,6 @@ err_read_output_name:
static void __init zynq_cpu_clk_setup(struct device_node *np)
{
struct zynq_cpu_clk *cpuclk;
- const char *parent_names[3];
struct clk_init_data init;
void __iomem *clk_621;
struct clk *clk;
@@ -335,12 +327,10 @@ static void __init zynq_cpu_clk_setup(struct device_node *np)
clk_621 = slcr_base + reg[1];
spin_lock_init(&cpuclk->clkact_lock);
- init.name = np->name;
+ err = of_init_clk_data(np, &init);
+ if (WARN_ON(err))
+ return;
init.ops = &zynq_cpu_clk_ops;
- for (i = 0; i < ARRAY_SIZE(parent_names); i++)
- parent_names[i] = of_clk_get_parent_name(np, i);
- init.parent_names = parent_names;
- init.num_parents = ARRAY_SIZE(parent_names);
cpuclk->hw.init = &init;
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2012-12-17 21:02 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 21:02 [PATCH 0/4] Introduce of_init_clk_data() for DT clock parsing Stephen Boyd
2012-12-17 21:02 ` [PATCH 1/4] clk: Add of_init_clk_data() to parse common clock bindings Stephen Boyd
2012-12-17 21:02 ` [PATCH 2/4] clk: highbank: Use of_init_clk_data() Stephen Boyd
2012-12-17 21:02 ` [PATCH 3/4] clk: vt8500: " Stephen Boyd
2012-12-18 6:20 ` Tony Prisk
2012-12-17 21:02 ` Stephen Boyd [this message]
2012-12-19 17:26 ` [PATCH 4/4] clk: zynq: " Josh Cartwright
2012-12-19 18:20 ` Stephen Boyd
2012-12-19 18:36 ` Josh Cartwright
2012-12-19 19:12 ` Stephen Boyd
2012-12-19 19:22 ` Soren Brinkmann
2012-12-19 20:30 ` Stephen Boyd
2012-12-19 20:53 ` Josh Cartwright
2012-12-21 15:28 ` Michal Simek
2012-12-21 15:48 ` Josh Cartwright
2012-12-28 15:11 ` Michal Simek
2012-12-19 20:54 ` Stephen Boyd
2012-12-21 15:52 ` Rob Herring
2012-12-20 0:41 ` Soren Brinkmann
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=1355778135-32458-5-git-send-email-sboyd@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=josh.cartwright@ni.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@linaro.org \
--cc=soren.brinkmann@xilinx.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;
as well as URLs for NNTP newsgroup(s).