From: William Towle <william.towle@codethink.co.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] clk: shmobile: handle multiple parent clocks for cpg clocks
Date: Tue, 04 Feb 2014 18:17:38 +0000 [thread overview]
Message-ID: <1391537858-28593-4-git-send-email-william.towle@codethink.co.uk> (raw)
In-Reply-To: <1391537858-28593-1-git-send-email-william.towle@codethink.co.uk>
The current action on registering the cpg_clocks is to have
them all registered with a single parent clock. This is not
the correct action, as some of the clocks such as the SDHI
and QSPI are actually parented to PLL1 or PLL1/2.
This also requires a change to the device-tree files to make
sure that appropriate parent clocks are assigned.
[ben.dooks@codethink.co.uk: updated patch description]
Signed-off-by: William Towle <william.towle@codethink.co.uk>
Reviewed-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/clk/shmobile/clk-rcar-gen2.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c b/drivers/clk/shmobile/clk-rcar-gen2.c
index df4a1e6..57bc2e4 100644
--- a/drivers/clk/shmobile/clk-rcar-gen2.c
+++ b/drivers/clk/shmobile/clk-rcar-gen2.c
@@ -185,7 +185,7 @@ static u32 cpg_mode __initdata;
static struct clk * __init
rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
const struct cpg_pll_config *config,
- const char *name)
+ const char *name, int index)
{
const struct clk_div_table *table = NULL;
const char *parent_name = "main";
@@ -193,8 +193,13 @@ rcar_gen2_cpg_register_clock(struct device_node *np, struct rcar_gen2_cpg *cpg,
unsigned int mult = 1;
unsigned int div = 1;
+ parent_name = of_clk_get_parent_name(np, index);
+ if (!parent_name) {
+ pr_err("no parent set for clocks array\n");
+ return ERR_PTR(-ENOENT);
+ }
+
if (!strcmp(name, "main")) {
- parent_name = of_clk_get_parent_name(np, 0);
div = config->extal_div;
} else if (!strcmp(name, "pll0")) {
/* PLL0 is a configurable multiplier clock. Register it as a
@@ -279,7 +284,7 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)
of_property_read_string_index(np, "clock-output-names", i,
&name);
- clk = rcar_gen2_cpg_register_clock(np, cpg, config, name);
+ clk = rcar_gen2_cpg_register_clock(np, cpg, config, name, i);
if (IS_ERR(clk))
pr_err("%s: failed to register %s %s clock (%ld)\n",
__func__, np->name, name, PTR_ERR(clk));
--
1.7.10.4
prev parent reply other threads:[~2014-02-04 18:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-04 18:17 Clock divisor/parent settings changes William Towle
2014-02-04 18:17 ` [PATCH 1/3] clk: rcar-h2: fix sd0/sd1 divisor table William Towle
2014-02-05 10:56 ` Laurent Pinchart
2014-02-05 11:55 ` Ben Dooks
2014-02-05 12:41 ` Ben Dooks
2014-02-05 13:07 ` Laurent Pinchart
2014-02-06 0:43 ` Kuninori Morimoto
2014-02-07 6:43 ` Kuninori Morimoto
2014-02-07 9:55 ` Ben Dooks
2014-02-04 18:17 ` [PATCH 2/3] ARM: shmobile: r8a7790: specify multiple parents for cpg_clks William Towle
2014-02-05 9:15 ` [Linux-kernel] " Ben Dooks
2014-02-05 10:32 ` Laurent Pinchart
2014-02-05 10:36 ` Ben Dooks
2014-02-05 10:57 ` Laurent Pinchart
2014-02-04 18:17 ` William Towle [this message]
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=1391537858-28593-4-git-send-email-william.towle@codethink.co.uk \
--to=william.towle@codethink.co.uk \
--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).