public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: <a-christidis@ti•com>
To: Nishanth Menon <nm@ti•com>, Tero Kristo <kristo@kernel•org>,
	"Santosh Shilimkar" <ssantosh@kernel•org>,
	Michael Turquette <mturquette@baylibre•com>,
	Stephen Boyd <sboyd@kernel•org>,
	Brian Masney <bmasney@redhat•com>
Cc: <linux-arm-kernel@lists•infradead.org>,
	<linux-kernel@vger•kernel.org>, <linux-clk@vger•kernel.org>,
	Michael Walle <mwalle@kernel•org>,
	Kevin Hilman <khilman@baylibre•com>, Randolph Sapp <rs@ti•com>,
	Antonios Christidis <a-christidis@ti•com>
Subject: [PATCH v2] clk: keystone: don't cache clock rate
Date: Thu, 7 May 2026 11:09:34 -0500	[thread overview]
Message-ID: <20260507-clk-sci-v2-1-38f59b48777a@ti.com> (raw)

From: Michael Walle <mwalle@kernel•org>

The TISCI firmware will return 0 if the clock or consumer is not
enabled although there is a stored value in the firmware. IOW a call to
set rate will work but at get rate will always return 0 if the clock is
disabled.
The clk framework will try to cache the clock rate when it's requested
by a consumer. If the clock or consumer is not enabled at that point,
the cached value is 0, which is wrong. Thus, disable the cache
altogether.

Signed-off-by: Michael Walle <mwalle@kernel•org>
Reviewed-by: Kevin Hilman <khilman@baylibre•com>
Reviewed-by: Randolph Sapp <rs@ti•com>
Reviewed-by: Nishanth Menon <nm@ti•com>
Signed-off-by: Antonios Christidis <a-christidis@ti•com>
---
v2:
- Resent as part of series [1], separated from series per reviewer feedback [2]
- Original patch was sent here [3]
    
[1]: https://lore.kernel.org/all/20260224-gpu_dts-v1-5-cc5ddffe140c@ti.com/
[2]: https://lore.kernel.org/all/20260225010507.flvt775fs5kfe7ez@unknotted/
[3]: https://lore.kernel.org/all/20260109120728.2wku6akxof2ddn4h@tastiness/
---
 drivers/clk/keystone/sci-clk.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 9d5071223f4c..0a1565fdbb3b 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -333,6 +333,14 @@ static int _sci_clk_build(struct sci_clk_provider *provider,
 
 	init.ops = &sci_clk_ops;
 	init.num_parents = sci_clk->num_parents;
+
+	/*
+	 * A clock rate query to the SCI firmware will return 0 if either the
+	 * clock itself is disabled or the attached device/consumer is disabled.
+	 * This makes it inherently unsuitable for the caching of the clk
+	 * framework.
+	 */
+	init.flags = CLK_GET_RATE_NOCACHE;
 	sci_clk->hw.init = &init;
 
 	ret = devm_clk_hw_register(provider->dev, &sci_clk->hw);

---
base-commit: 17c7841d09ee7d33557fd075562d9289b6018c90
change-id: 20260507-clk-sci-175f398ecdc0

Best regards,
-- 
Antonios Christidis <a-christidis@ti•com>



             reply	other threads:[~2026-05-07 16:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 16:09 a-christidis [this message]
2026-05-11 14:36 ` [PATCH v2] clk: keystone: don't cache clock rate Brian Masney
2026-05-12 10:48   ` Nishanth Menon
2026-05-12 14:51     ` Brian Masney
2026-05-12 17:16       ` Nishanth Menon
2026-06-03 16:00         ` Nishanth Menon
2026-06-03 16:49           ` Brian Masney
2026-06-04  2:59 ` Nishanth Menon

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=20260507-clk-sci-v2-1-38f59b48777a@ti.com \
    --to=a-christidis@ti$(echo .)com \
    --cc=bmasney@redhat$(echo .)com \
    --cc=khilman@baylibre$(echo .)com \
    --cc=kristo@kernel$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    --cc=linux-clk@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=mturquette@baylibre$(echo .)com \
    --cc=mwalle@kernel$(echo .)org \
    --cc=nm@ti$(echo .)com \
    --cc=rs@ti$(echo .)com \
    --cc=sboyd@kernel$(echo .)org \
    --cc=ssantosh@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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