[PATCH] phy: starfive: jh7110-dphy: fail init when the PLL does not lock
From: Pengpeng Hou
Date: Wed Jun 24 2026 - 10:40:29 EST
stf_dphy_hw_reset() polls the DPHY PLL unlock bit when bringing the PHY
out of reset, but only logs a timeout. stf_dphy_init() then continues
and returns success even though the PHY lock condition was not observed.
Return the poll error from the reset helper and propagate it from the PHY
init path. Also make the timeout message describe the failed lock
condition.
Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
---
drivers/phy/starfive/phy-jh7110-dphy-tx.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
index c64d1c91b..66473a533 100644
--- a/drivers/phy/starfive/phy-jh7110-dphy-tx.c
+++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c
@@ -209,7 +209,7 @@ static u32 stf_dphy_get_config_index(u32 bitrate)
return 0;
}
-static void stf_dphy_hw_reset(struct stf_dphy *dphy, int assert)
+static int stf_dphy_hw_reset(struct stf_dphy *dphy, int assert)
{
int rc;
u32 status = 0;
@@ -224,8 +224,12 @@ static void stf_dphy_hw_reset(struct stf_dphy *dphy, int assert)
!(FIELD_GET(STF_DPHY_RGS_CDTX_PLL_UNLOCK, status)),
STF_DPHY_HW_DELAY_US, STF_DPHY_HW_TIMEOUT_US);
if (rc)
- dev_err(dphy->dev, "MIPI dphy-tx # PLL Locked\n");
+ dev_err(dphy->dev, "MIPI dphy-tx PLL failed to lock\n");
+
+ return rc;
}
+
+ return 0;
}
static int stf_dphy_configure(struct phy *phy, union phy_configure_opts *opts)
@@ -313,7 +317,9 @@ static int stf_dphy_init(struct phy *phy)
struct stf_dphy *dphy = phy_get_drvdata(phy);
int ret;
- stf_dphy_hw_reset(dphy, 1);
+ ret = stf_dphy_hw_reset(dphy, 1);
+ if (ret)
+ return ret;
writel(FIELD_PREP(STF_DPHY_SCFG_PPI_C_READY_SEL, 0) |
FIELD_PREP(STF_DPHY_SCFG_DSI_TXREADY_ESC_SEL, 0),
@@ -350,7 +356,9 @@ static int stf_dphy_exit(struct phy *phy)
clk_disable_unprepare(dphy->txesc_clk);
- stf_dphy_hw_reset(dphy, 0);
+ ret = stf_dphy_hw_reset(dphy, 0);
+ if (ret)
+ return ret;
return 0;
}
--
2.50.1 (Apple Git-155)