Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Tony Lindgren <tony@atomide.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>,
	Mike Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	linux-clk@vger.kernel.org,
	Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	'Linux Samsung SOC' <linux-samsung-soc@vger.kernel.org>,
	linux-amlogic@lists.infradead.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 3/3] clk: Drop the rate range on clk_put
Date: Thu, 31 Mar 2022 17:31:34 +0200	[thread overview]
Message-ID: <20220331153134.h3alp24hzquajkly@houat> (raw)
In-Reply-To: <YkXCGlrok0niwlyg@atomide.com>


[-- Attachment #1.1: Type: text/plain, Size: 3443 bytes --]

Hi Tony,

On Thu, Mar 31, 2022 at 06:00:42PM +0300, Tony Lindgren wrote:
> * Maxime Ripard <maxime@cerno.tech> [220331 09:52]:
> > On Thu, Mar 31, 2022 at 12:42:10PM +0300, Tony Lindgren wrote:
> > > It seems the dts assigned-clock-parents no longer works now?
> > 
> > That would make some kind of sense, __set_clk_parents calls clk_put on
> > both the assigned clock and its parent.
> > 
> > Could you see what parent (and why?) it tries to enforce then?
> 
> It picks the other option available for the mux clock that only has
> two options. No idea why, but if you have some debug patch in mind I
> can give it a try.
> 
> > It looks like the gpt1_fck driver might favor another parent for that
> > rate, which, if it's an invalid configuration, shouldn't really happen?
> 
> Hmm there's a gate clock and a mux clock, there's not really a rate
> selection available here for the sources.

If I followed the OMAP driver properly, clk_mux_determine_rate_flags is
doing the heavy lifting, could you run your test with

-- >8 --

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 91f863b7a824..c2ab1be62f96 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -552,6 +552,12 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
 	unsigned long best = 0;
 	struct clk_rate_request parent_req = *req;

+	pr_crit("%s: requested rate %lu\n", __func__, req->rate);
+
+	parent = core->parent;
+	pr_crit("%s: current parent %s\n", __func__, parent->name);
+	pr_crit("%s: current parent rate %lu\n", __func__, clk_core_get_rate_nolock(parent));
+
 	/* if NO_REPARENT flag set, pass through to current parent */
 	if (core->flags & CLK_SET_RATE_NO_REPARENT) {
 		parent = core->parent;
@@ -578,6 +584,11 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
 		if (!parent)
 			continue;

+		pr_crit("%s: Trying parent %s (%lu)\n",
+			__func__,
+			parent->name,
+			clk_core_get_rate_nolock(parent));
+
 		if (core->flags & CLK_SET_RATE_PARENT) {
 			parent_req = *req;
 			ret = __clk_determine_rate(parent->hw, &parent_req);
@@ -603,6 +614,11 @@ int clk_mux_determine_rate_flags(struct clk_hw *hw,
 	req->best_parent_rate = best;
 	req->rate = best;

+	pr_crit("%s: Best parent %s (%lu)\n",
+		__func__,
+		best_parent->name,
+		best);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(clk_mux_determine_rate_flags);
@@ -2201,8 +2217,12 @@ static int clk_core_set_rate_nolock(struct clk_core *core,
 	if (!core)
 		return 0;

+	pr_crit("%s: rate %lu\n", __func__, req_rate);
+
 	rate = clk_core_req_round_rate_nolock(core, req_rate);

+	pr_crit("%s: rounded rate %lu\n", __func__, req_rate);
+
 	/* bail early if nothing to do */
 	if (rate == clk_core_get_rate_nolock(core))
 		return 0;
@@ -2367,6 +2387,8 @@ static int clk_set_rate_range_nolock(struct clk *clk,
 		goto out;
 	}

+	pr_crit("%s: core req rate %lu\n", __func__, clk->core->req_rate);
+
 	/*
 	 * Since the boundaries have been changed, let's give the
 	 * opportunity to the provider to adjust the clock rate based on
@@ -2385,6 +2407,9 @@ static int clk_set_rate_range_nolock(struct clk *clk,
 	 *   this corner case when determining the rate
 	 */
 	rate = clamp(clk->core->req_rate, min, max);
+
+	pr_crit("%s: clamped rate %lu\n", __func__, rate);
+
 	ret = clk_core_set_rate_nolock(clk->core, rate);
 	if (ret) {
 		/* rollback the changes */

-- >8 --

Thanks!
Maxime

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2022-03-31 15:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20220325161144.1901695-1-maxime@cerno.tech>
     [not found] ` <20220325161144.1901695-4-maxime@cerno.tech>
     [not found]   ` <CGME20220330080612eucas1p195caaf35d900412de762a27ae02b7b9e@eucas1p1.samsung.com>
     [not found]     ` <366a0232-bb4a-c357-6aa8-636e398e05eb@samsung.com>
     [not found]       ` <20220330084710.3r6b5pjspz5hdmy6@houat>
2022-03-31  9:42         ` [PATCH v2 3/3] clk: Drop the rate range on clk_put Tony Lindgren
2022-03-31  9:54           ` Maxime Ripard
2022-03-31 15:00             ` Tony Lindgren
2022-03-31 15:31               ` Maxime Ripard [this message]
2022-03-31 17:00                 ` Tony Lindgren
2022-03-31 21:58                   ` Stephen Boyd
2022-04-01 12:28                     ` Maxime Ripard
2022-04-03  2:14                       ` Stephen Boyd
2022-04-01 11:55                 ` (EXT) " Alexander Stein
2022-04-01 12:27                   ` Maxime Ripard
2022-04-01 12:59                     ` (EXT) " Alexander Stein
2022-04-01 13:04                       ` Maxime Ripard
2022-04-01 13:07                         ` (EXT) " Alexander Stein
2022-04-01 13:34                           ` Maxime Ripard
2022-04-01 13:49                             ` (EXT) " Alexander Stein
2022-04-01 14:55                               ` Maxime Ripard
2022-04-04  7:06                                 ` (EXT) " Alexander Stein
2022-04-04  7:27                                   ` Maxime Ripard
2022-04-04 10:54                                     ` (EXT) " Alexander Stein
2022-04-07  8:09                                       ` Maxime Ripard
2022-04-02 17:01                     ` Maxime Ripard
2022-04-07  7:53           ` Maxime Ripard
2022-04-07  8:03             ` Tony Lindgren
2022-04-07 11:08               ` Tony Lindgren
2022-04-07 13:45                 ` Maxime Ripard
2022-04-08  5:03                   ` Tony Lindgren

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=20220331153134.h3alp24hzquajkly@houat \
    --to=maxime@cerno.tech \
    --cc=dmitry.osipenko@collabora.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=tony@atomide.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