All of lore.kernel.org
 help / color / mirror / Atom feed
From: emilio@elopez.com.ar (Emilio López)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] clk: respect the clock dependencies in of_clk_init
Date: Fri, 07 Feb 2014 15:17:54 -0300	[thread overview]
Message-ID: <52F52352.9010407@elopez.com.ar> (raw)
In-Reply-To: <52F52189.5090506@free-electrons.com>

Hi,

El 07/02/14 15:10, Gregory CLEMENT escribi?:
(snip)
>> ---
>>    drivers/clk/mvebu/common.c | 13 +++++++------
>>    1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
>> index 25ceccf..730625b 100644
>> --- a/drivers/clk/mvebu/common.c
>> +++ b/drivers/clk/mvebu/common.c
>> @@ -119,19 +119,20 @@ void __init mvebu_clk_gating_setup(struct
>> device_node *np,
>>    				   const struct clk_gating_soc_desc *desc)
>>    {
>>    	struct clk_gating_ctrl *ctrl;
>> -	struct clk *clk;
>>    	void __iomem *base;
>> -	const char *default_parent = NULL;
>> +	struct of_phandle_args clkspec;
>> +	const char *default_parent = "tclk";
>>    	int n;
>>
>>    	base = of_iomap(np, 0);
>>    	if (WARN_ON(!base))
>>    		return;
>>
>> -	clk = of_clk_get(np, 0);
>> -	if (!IS_ERR(clk)) {
>> -		default_parent = __clk_get_name(clk);
>> -		clk_put(clk);
>> +	if (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0,
>> &clkspec)) {
>> +		of_property_read_string_index(clkspec.np, "clock-output-names",
>> +					      clkspec.args_count ? clkspec.args[0] : 0,
>> +					      &default_parent);
>> +		of_node_put(clkspec.np);
>
> OK here you duplicate the code from of_clk_get_parent_name, I wonder why
> you didn't use the function.But whatever.

I specifically duplicated it because of_clk_get_parent_name returns the 
node name if there's no clock-output-names. That wouldn't be useful in 
this case.

> Here you will get default_parent = "mvebu-sar" which is the name of the node, you
> can't have "tclk" because this name is not in the device tree, but it will be
> created by the initialization of the core clocks.

No, default_parent would be "tclk" still because clock-output-names 
property doesn't exist. If you ever add such a property, it will 
override "tclk".

Cheers,

Emilio

WARNING: multiple messages have this Message-ID (diff)
From: "Emilio López" <emilio@elopez.com.ar>
To: Gregory CLEMENT <gregory.clement@free-electrons.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	Jason Cooper <jason@lakedaemon.net>
Cc: Mike Turquette <mturquette@linaro.org>,
	Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	Andrew Lunn <andrew@lunn.ch>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [PATCH] clk: respect the clock dependencies in of_clk_init
Date: Fri, 07 Feb 2014 15:17:54 -0300	[thread overview]
Message-ID: <52F52352.9010407@elopez.com.ar> (raw)
In-Reply-To: <52F52189.5090506@free-electrons.com>

Hi,

El 07/02/14 15:10, Gregory CLEMENT escribió:
(snip)
>> ---
>>    drivers/clk/mvebu/common.c | 13 +++++++------
>>    1 file changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/clk/mvebu/common.c b/drivers/clk/mvebu/common.c
>> index 25ceccf..730625b 100644
>> --- a/drivers/clk/mvebu/common.c
>> +++ b/drivers/clk/mvebu/common.c
>> @@ -119,19 +119,20 @@ void __init mvebu_clk_gating_setup(struct
>> device_node *np,
>>    				   const struct clk_gating_soc_desc *desc)
>>    {
>>    	struct clk_gating_ctrl *ctrl;
>> -	struct clk *clk;
>>    	void __iomem *base;
>> -	const char *default_parent = NULL;
>> +	struct of_phandle_args clkspec;
>> +	const char *default_parent = "tclk";
>>    	int n;
>>
>>    	base = of_iomap(np, 0);
>>    	if (WARN_ON(!base))
>>    		return;
>>
>> -	clk = of_clk_get(np, 0);
>> -	if (!IS_ERR(clk)) {
>> -		default_parent = __clk_get_name(clk);
>> -		clk_put(clk);
>> +	if (!of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0,
>> &clkspec)) {
>> +		of_property_read_string_index(clkspec.np, "clock-output-names",
>> +					      clkspec.args_count ? clkspec.args[0] : 0,
>> +					      &default_parent);
>> +		of_node_put(clkspec.np);
>
> OK here you duplicate the code from of_clk_get_parent_name, I wonder why
> you didn't use the function.But whatever.

I specifically duplicated it because of_clk_get_parent_name returns the 
node name if there's no clock-output-names. That wouldn't be useful in 
this case.

> Here you will get default_parent = "mvebu-sar" which is the name of the node, you
> can't have "tclk" because this name is not in the device tree, but it will be
> created by the initialization of the core clocks.

No, default_parent would be "tclk" still because clock-output-names 
property doesn't exist. If you ever add such a property, it will 
override "tclk".

Cheers,

Emilio

  reply	other threads:[~2014-02-07 18:17 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-04 22:59 [PATCH] clk: respect the clock dependencies in of_clk_init Gregory CLEMENT
2014-02-04 22:59 ` Gregory CLEMENT
2014-02-05  5:09 ` Jason Cooper
2014-02-05  5:09   ` Jason Cooper
2014-02-05  8:45 ` Boris BREZILLON
2014-02-05  8:45   ` Boris BREZILLON
2014-02-05  9:48 ` [PATCH] clk: add strict of_clk_init dependency check Boris BREZILLON
2014-02-05  9:48   ` Boris BREZILLON
2014-02-05 14:48   ` Gregory CLEMENT
2014-02-05 14:48     ` Gregory CLEMENT
2014-02-05 15:05     ` Gregory CLEMENT
2014-02-05 15:05       ` Gregory CLEMENT
2014-02-05 15:07       ` Boris BREZILLON
2014-02-05 15:07         ` Boris BREZILLON
2014-02-05 23:11 ` [PATCH] clk: respect the clock dependencies in of_clk_init Sebastian Hesselbarth
2014-02-05 23:11   ` Sebastian Hesselbarth
2014-02-07 13:06 ` Emilio López
2014-02-07 13:06   ` Emilio López
2014-02-07 14:24   ` Jason Cooper
2014-02-07 14:24     ` Jason Cooper
2014-02-07 14:43     ` Ezequiel Garcia
2014-02-07 14:43       ` Ezequiel Garcia
2014-02-07 14:49       ` Gregory CLEMENT
2014-02-07 14:49         ` Gregory CLEMENT
2014-02-07 15:00         ` Emilio López
2014-02-07 15:00           ` Emilio López
2014-02-07 15:12           ` Gregory CLEMENT
2014-02-07 15:12             ` Gregory CLEMENT
2014-02-07 16:16             ` Emilio López
2014-02-07 16:16               ` Emilio López
2014-02-07 18:10               ` Gregory CLEMENT
2014-02-07 18:10                 ` Gregory CLEMENT
2014-02-07 18:17                 ` Emilio López [this message]
2014-02-07 18:17                   ` Emilio López
2014-02-07 23:15         ` Sebastian Hesselbarth
2014-02-07 23:15           ` Sebastian Hesselbarth

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=52F52352.9010407@elopez.com.ar \
    --to=emilio@elopez.com.ar \
    --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.