From: Christian Marangi <ansuelsmth@gmail.com>
To: Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney+clk@redhat.com>,
Jerome Brunet <jbrunet+clk@baylibre.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Felix Fietkau <nbd@nbd.name>,
linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Christian Marangi <ansuelsmth@gmail.com>
Subject: [PATCH v16 3/8] clk: en7523: don't call PCI clk OPs for early unprepare
Date: Mon, 30 Nov 2026 02:25:01 +0100 [thread overview]
Message-ID: <20261130012507.660547-4-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20261130012507.660547-1-ansuelsmth@gmail.com>
It's wrong to call clk OPs before actually registering a clock. This was
done for the PCI early unprepare.
Rework the function to a more internal helper also in preparation for
global spinlock protection.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/clk/clk-en7523.c | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-en7523.c b/drivers/clk/clk-en7523.c
index ae34506ce211..ba66ac6de13b 100644
--- a/drivers/clk/clk-en7523.c
+++ b/drivers/clk/clk-en7523.c
@@ -150,6 +150,7 @@ struct en_clk_soc_data {
const struct clk_ops pcie_ops;
int (*hw_init)(struct platform_device *pdev,
struct clk_hw_onecell_data *clk_data);
+ void (*pci_unprepare)(struct en_clk_gate *cg);
};
static const u32 gsw_base[] = { 400000000, 500000000 };
@@ -620,9 +621,8 @@ static int en7523_pci_prepare(struct clk_hw *hw)
return 0;
}
-static void en7523_pci_unprepare(struct clk_hw *hw)
+static void __en7523_pci_unprepare(struct en_clk_gate *cg)
{
- struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw);
void __iomem *np_base = cg->base;
u32 val;
@@ -631,6 +631,13 @@ static void en7523_pci_unprepare(struct clk_hw *hw)
writel(val, np_base + REG_PCI_CONTROL);
}
+static void en7523_pci_unprepare(struct clk_hw *hw)
+{
+ struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw);
+
+ __en7523_pci_unprepare(cg);
+}
+
static struct clk_hw *en7523_register_pcie_clk(struct device *dev,
void __iomem *np_base)
{
@@ -648,8 +655,8 @@ static struct clk_hw *en7523_register_pcie_clk(struct device *dev,
cg->base = np_base;
cg->hw.init = &init;
- if (init.ops->unprepare)
- init.ops->unprepare(&cg->hw);
+ if (soc_data->pci_unprepare)
+ soc_data->pci_unprepare(cg);
if (devm_clk_hw_register(dev, &cg->hw))
return NULL;
@@ -1220,6 +1227,7 @@ static const struct en_clk_soc_data en7523_data = {
.unprepare = en7523_pci_unprepare,
},
.hw_init = en7523_clk_hw_init,
+ .pci_unprepare = __en7523_pci_unprepare,
};
static const struct en_clk_soc_data en7581_data = {
@@ -1241,6 +1249,7 @@ static const struct en_clk_soc_data en751221_data = {
.unprepare = en7523_pci_unprepare,
},
.hw_init = en751221_clk_hw_init,
+ .pci_unprepare = __en7523_pci_unprepare,
};
static const struct of_device_id of_match_clk_en7523[] = {
--
2.55.0
next prev parent reply other threads:[~2026-11-30 1:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 1:24 [PATCH v16 0/8] clk: add support for Airoha AN7583 clock Christian Marangi
2026-11-30 1:24 ` [PATCH v16 1/8] dt-bindings: clock: airoha: Document support for " Christian Marangi
2026-11-30 1:25 ` [PATCH v16 2/8] clk: en7523: use devm variant for clk_hw_register and fixed clock Christian Marangi
2026-11-30 1:25 ` Christian Marangi [this message]
2026-11-30 1:25 ` [PATCH v16 4/8] clk: en7523: protect concurrent access to reset and PCI register Christian Marangi
2026-11-30 1:25 ` [PATCH v16 5/8] clk: en7523: convert to full clk_hw implementation for en7581 Christian Marangi
2026-11-30 1:25 ` [PATCH v16 6/8] clk: en7523: add support for .set_rate " Christian Marangi
2026-11-30 1:25 ` [PATCH v16 7/8] clk: en7523: generalize register clocks function Christian Marangi
2026-11-30 1:25 ` [PATCH v16 8/8] clk: en7523: add support for Airoha AN7583 clock Christian Marangi
2026-11-30 1:35 ` sashiko-bot
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=20261130012507.660547-4-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=bmasney+clk@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jbrunet+clk@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@nbd.name \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox