All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] clk: shmobile: rcar-gen2: Fix clock parent all non-PLL clocks
Date: Wed, 05 Feb 2014 10:51:41 +0000	[thread overview]
Message-ID: <4232876.LkjsLLbJbc@avalon> (raw)
In-Reply-To: <52F213C9.2020501@codethink.co.uk>

Hi Ben,

On Wednesday 05 February 2014 10:34:49 Ben Dooks wrote:
> On 07/01/14 16:47, Laurent Pinchart wrote:
> > The lb, qspi, sdh, sd0 and sd1 clocks have the PLL1 (divided by 2) as
> > their parent, not the main clock. Fix it.
> 
> William Towle has already sent a patch to move this to device tree
> which I think is a better solution for this.

I actually disagree. The CPG is an IP core that generates a bunch of clocks 
from a single external parent. The fact that clocks are not flat but organized 
as a tree internally is an internal property of the CPG, and I prefer keeping 
it that way instead of exposing it in the device tree.

> Any chance of commenting on which to take please.
> 
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >   drivers/clk/shmobile/clk-rcar-gen2.c | 10 +++++++++-
> >   1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c
> > b/drivers/clk/shmobile/clk-rcar-gen2.c index a59ec21..8c7bcbd 100644
> > --- a/drivers/clk/shmobile/clk-rcar-gen2.c
> > +++ b/drivers/clk/shmobile/clk-rcar-gen2.c
> > @@ -186,7 +186,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np,
> > struct rcar_gen2_cpg *cpg,> 
> >   			     const char *name)
> >   {
> >   	const struct clk_div_table *table = NULL;
> > -	const char *parent_name = "main";
> > +	const char *parent_name;
> >   	unsigned int shift;
> >   	unsigned int mult = 1;
> >   	unsigned int div = 1;
> > @@ -201,23 +201,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np,
> > struct rcar_gen2_cpg *cpg,> 
> >   		 * the multiplier value.
> >   		 */
> >   		u32 value = clk_readl(cpg->reg + CPG_PLL0CR);
> > +		parent_name = "main";
> >   		mult = ((value >> 24) & ((1 << 7) - 1)) + 1;
> >   	} else if (!strcmp(name, "pll1")) {
> > +		parent_name = "main";
> >   		mult = config->pll1_mult / 2;
> >   	} else if (!strcmp(name, "pll3")) {
> > +		parent_name = "main";
> >   		mult = config->pll3_mult;
> >   	} else if (!strcmp(name, "lb")) {
> > +		parent_name = "pll1_div2";
> >   		div = cpg_mode & BIT(18) ? 36 : 24;
> >   	} else if (!strcmp(name, "qspi")) {
> > +		parent_name = "pll1_div2";
> >   		div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) = BIT(2)
> >   		    ? 16 : 20;
> >   	} else if (!strcmp(name, "sdh")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sdh_div_table;
> >   		shift = 8;
> >   	} else if (!strcmp(name, "sd0")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sd01_div_table;
> >   		shift = 4;
> >   	} else if (!strcmp(name, "sd1")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sd01_div_table;
> >   		shift = 0;
> >   	} else if (!strcmp(name, "z")) {

-- 
Regards,

Laurent Pinchart


WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] clk: shmobile: rcar-gen2: Fix clock parent all non-PLL clocks
Date: Wed, 05 Feb 2014 11:51:41 +0100	[thread overview]
Message-ID: <4232876.LkjsLLbJbc@avalon> (raw)
In-Reply-To: <52F213C9.2020501@codethink.co.uk>

Hi Ben,

On Wednesday 05 February 2014 10:34:49 Ben Dooks wrote:
> On 07/01/14 16:47, Laurent Pinchart wrote:
> > The lb, qspi, sdh, sd0 and sd1 clocks have the PLL1 (divided by 2) as
> > their parent, not the main clock. Fix it.
> 
> William Towle has already sent a patch to move this to device tree
> which I think is a better solution for this.

I actually disagree. The CPG is an IP core that generates a bunch of clocks 
from a single external parent. The fact that clocks are not flat but organized 
as a tree internally is an internal property of the CPG, and I prefer keeping 
it that way instead of exposing it in the device tree.

> Any chance of commenting on which to take please.
> 
> > Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> > Signed-off-by: Laurent Pinchart
> > <laurent.pinchart+renesas@ideasonboard.com>
> > ---
> > 
> >   drivers/clk/shmobile/clk-rcar-gen2.c | 10 +++++++++-
> >   1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/clk/shmobile/clk-rcar-gen2.c
> > b/drivers/clk/shmobile/clk-rcar-gen2.c index a59ec21..8c7bcbd 100644
> > --- a/drivers/clk/shmobile/clk-rcar-gen2.c
> > +++ b/drivers/clk/shmobile/clk-rcar-gen2.c
> > @@ -186,7 +186,7 @@ rcar_gen2_cpg_register_clock(struct device_node *np,
> > struct rcar_gen2_cpg *cpg,> 
> >   			     const char *name)
> >   {
> >   	const struct clk_div_table *table = NULL;
> > -	const char *parent_name = "main";
> > +	const char *parent_name;
> >   	unsigned int shift;
> >   	unsigned int mult = 1;
> >   	unsigned int div = 1;
> > @@ -201,23 +201,31 @@ rcar_gen2_cpg_register_clock(struct device_node *np,
> > struct rcar_gen2_cpg *cpg,> 
> >   		 * the multiplier value.
> >   		 */
> >   		u32 value = clk_readl(cpg->reg + CPG_PLL0CR);
> > +		parent_name = "main";
> >   		mult = ((value >> 24) & ((1 << 7) - 1)) + 1;
> >   	} else if (!strcmp(name, "pll1")) {
> > +		parent_name = "main";
> >   		mult = config->pll1_mult / 2;
> >   	} else if (!strcmp(name, "pll3")) {
> > +		parent_name = "main";
> >   		mult = config->pll3_mult;
> >   	} else if (!strcmp(name, "lb")) {
> > +		parent_name = "pll1_div2";
> >   		div = cpg_mode & BIT(18) ? 36 : 24;
> >   	} else if (!strcmp(name, "qspi")) {
> > +		parent_name = "pll1_div2";
> >   		div = (cpg_mode & (BIT(3) | BIT(2) | BIT(1))) == BIT(2)
> >   		    ? 16 : 20;
> >   	} else if (!strcmp(name, "sdh")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sdh_div_table;
> >   		shift = 8;
> >   	} else if (!strcmp(name, "sd0")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sd01_div_table;
> >   		shift = 4;
> >   	} else if (!strcmp(name, "sd1")) {
> > +		parent_name = "pll1_div2";
> >   		table = cpg_sd01_div_table;
> >   		shift = 0;
> >   	} else if (!strcmp(name, "z")) {

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2014-02-05 10:51 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-07 16:47 [PATCH 0/2] clk: shmobile rcar-gen2 fixes Laurent Pinchart
2014-01-07 16:47 ` Laurent Pinchart
2014-01-07 16:47 ` [PATCH 1/2] clk: shmobile: rcar-gen2: Fix clock parent all non-PLL clocks Laurent Pinchart
2014-01-07 16:47   ` Laurent Pinchart
2014-02-05 10:34   ` Ben Dooks
2014-02-05 10:34     ` Ben Dooks
2014-02-05 10:51     ` Laurent Pinchart [this message]
2014-02-05 10:51       ` Laurent Pinchart
2014-02-05 12:05       ` Ben Dooks
2014-02-05 12:05         ` Ben Dooks
2014-01-07 16:47 ` [PATCH 2/2] clk: shmobile: rcar-gen2: Fix qspi divisor Laurent Pinchart
2014-01-07 16:47   ` Laurent Pinchart
2014-01-07 16:59 ` [PATCH 0/2] clk: shmobile rcar-gen2 fixes Geert Uytterhoeven
2014-01-07 16:59   ` Geert Uytterhoeven
2014-01-07 23:06   ` Laurent Pinchart
2014-01-07 23:06     ` Laurent Pinchart
2014-01-21 12:59     ` Laurent Pinchart
2014-01-21 13:00       ` Laurent Pinchart
2014-01-27 20:44       ` Mike Turquette
2014-02-05 10:31     ` Laurent Pinchart
2014-02-05 10:31       ` Laurent Pinchart
2014-02-05 14:39       ` Mike Turquette
2014-01-08  0:25   ` Simon Horman
2014-01-08  0:25     ` Simon Horman

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=4232876.LkjsLLbJbc@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --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 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.