mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <rafal@milecki.pl>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: linux-clk@vger.kernel.org,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Broadcom internal kernel review list 
	<bcm-kernel-feedback-list@broadcom.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: iproc: Do not rely on node name for correct PLL setup
Date: Mon, 05 Sep 2022 09:15:28 +0200	[thread overview]
Message-ID: <d2ad5cda0e9786e43d5cd235e5dcec59@milecki.pl> (raw)
In-Reply-To: <2cd712a5ae4fc0bf93e5b16ea640f1dc@milecki.pl>

On 2022-09-04 17:00, Rafał Miłecki wrote:
> On 2022-08-03 04:58, Florian Fainelli wrote:
>> After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block
>> description") a warning from clk-iproc-pll.c was generated due to a
>> duplicate PLL name as well as the console stopped working. Upon closer
>> inspection it became clear that iproc_pll_clk_setup() used the Device
>> Tree node unit name as an unique identifier as well as a parent name 
>> to
>> parent all clocks under the PLL.
>> 
>> BCM5301X was the first platform on which that got noticed because of 
>> the
>> DT node unit name renaming but the same assumptions hold true for any
>> user of the iproc_pll_clk_setup() function.
>> 
>> The first 'clock-output-names' property is always guaranteed to be
>> unique as well as providing the actual desired PLL clock name, so we
>> utilize that to register the PLL and as a parent name of all children
>> clock.
>> 
>> Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Acked-by: Rafał Miłecki <rafal@milecki.pl>
> 
> 
> Thanks for looking into this!
> 
> In the past I debugged this too and even developed a simple fix:
> clk & clock-controller@ DT nodes: __clk_core_init: clk
> clock-controller already initialized
> https://www.spinics.net/lists/linux-clk/msg63855.html
> 
> For some reason my old fix didn't work with usbclk clock.

I compared your changes with my old attempt and found the missing bit. I
forgot about updating parent_name.

FWIW something like below would work too.

Thanks again for taking care of this old regression.


diff --git a/drivers/clk/bcm/clk-iproc-pll.c 
b/drivers/clk/bcm/clk-iproc-pll.c
index 33da30f99..af9ca32b8 100644
--- a/drivers/clk/bcm/clk-iproc-pll.c
+++ b/drivers/clk/bcm/clk-iproc-pll.c
@@ -783,7 +783,7 @@ void iproc_pll_clk_setup(struct device_node *node,
  	iclk = &iclk_array[0];
  	iclk->pll = pll;

-	init.name = node->name;
+	init.name = node->full_name;
  	init.ops = &iproc_pll_ops;
  	init.flags = 0;
  	parent_name = of_clk_get_parent_name(node, 0);
@@ -809,7 +809,7 @@ void iproc_pll_clk_setup(struct device_node *node,
  		const char *clk_name;

  		memset(&init, 0, sizeof(init));
-		parent_name = node->name;
+		parent_name = node->full_name;

  		ret = of_property_read_string_index(node, "clock-output-names",
  						    i, &clk_name);

  reply	other threads:[~2022-09-05  9:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03  2:58 Florian Fainelli
2022-09-03 18:41 ` Florian Fainelli
2022-09-04 15:00 ` Rafał Miłecki
2022-09-05  7:15   ` Rafał Miłecki [this message]
2022-09-05  7:16 ` Rafał Miłecki

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=d2ad5cda0e9786e43d5cd235e5dcec59@milecki.pl \
    --to=rafal@milecki.pl \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rjui@broadcom.com \
    --cc=sboyd@kernel.org \
    --cc=sbranden@broadcom.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

all inboxes | Powered by JetHome®