From: Jiawen Liu <liu1298662399@gmail.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: Neil Armstrong <neil.armstrong@linaro.org>,
Manivannan Sadhasivam <mani@kernel.org>,
linux-phy@lists.infradead.org
Subject: [PATCH] phy: cadence: cdns-dphy: Handle TX clock enable failures
Date: Sun, 29 Nov 2026 19:25:33 +0000 [thread overview]
Message-ID: <179598033780.2.12207855005478822008.pattern-ext-083.10@gmail.com> (raw)
On TI K3, the Cadence DSI bridge calls phy_power_on() during display
bring-up. Either D-PHY clock can fail to prepare if its TI SCI firmware
request fails.
cdns_dphy_power_on() ignores both clk_prepare_enable() return values.
This loses the original error and can lead to PHY register access
without a required clock. Cleanup may then release a clock reference
that was never acquired, triggering common clock framework warnings.
Return the original error before programming the PHY. If enabling the
PLL reference clock fails, release only the PSM clock. Later failures
after both clocks are enabled release them in reverse order.
Verification included static review
of the clock and PHY core paths, git diff --check, checkpatch.pl on the
diff, and a warning-free W=1 arm64 driver object build with the TI SCI
clock provider enabled. No runtime or hardware reproduction was performed.
Fixes: 7a343c8bf4b5 ("phy: Add Cadence D-PHY support")
Signed-off-by: Jiawen Liu <liu1298662399@gmail.com>
---
drivers/phy/cadence/cdns-dphy.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/phy/cadence/cdns-dphy.c b/drivers/phy/cadence/cdns-dphy.c
index 483e35c82a113..ceba1154f8f24 100644
--- a/drivers/phy/cadence/cdns-dphy.c
+++ b/drivers/phy/cadence/cdns-dphy.c
@@ -374,8 +374,13 @@ static int cdns_dphy_power_on(struct phy *phy)
if (!dphy->is_configured || dphy->is_powered)
return -EINVAL;
- clk_prepare_enable(dphy->psm_clk);
- clk_prepare_enable(dphy->pll_ref_clk);
+ ret = clk_prepare_enable(dphy->psm_clk);
+ if (ret)
+ return ret;
+
+ ret = clk_prepare_enable(dphy->pll_ref_clk);
+ if (ret)
+ goto err_disable_psm_clk;
/*
* Configure the internal PSM clk divider so that the DPHY has a
@@ -436,6 +441,7 @@ static int cdns_dphy_power_on(struct phy *phy)
err_power_on:
clk_disable_unprepare(dphy->pll_ref_clk);
+err_disable_psm_clk:
clk_disable_unprepare(dphy->psm_clk);
return ret;
--
2.34.1
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
reply other threads:[~2026-11-29 19:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=179598033780.2.12207855005478822008.pattern-ext-083.10@gmail.com \
--to=liu1298662399@gmail.com \
--cc=linux-phy@lists.infradead.org \
--cc=mani@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=vkoul@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