Re: [PATCH v2 1/2] phy: cadence: cdns-dphy: Fix PLL lock and O_CMN_READY polling

From: Devarsh Thakkar
Date: Wed Apr 02 2025 - 09:30:45 EST


Hi Tomi,

Thanks for the review.

On 02/04/25 17:25, Tomi Valkeinen wrote:
<snip>
  /*
   * This is the reference implementation of DPHY hooks. Specific integration of
   * this IP may have to re-implement some of them depending on how they decided
@@ -278,6 +309,8 @@ static const struct cdns_dphy_ops j721e_dphy_ops = {
      .get_wakeup_time_ns = cdns_dphy_j721e_get_wakeup_time_ns,
      .set_pll_cfg = cdns_dphy_j721e_set_pll_cfg,
      .set_psm_div = cdns_dphy_j721e_set_psm_div,
+    .wait_for_pll_lock = cdns_dphy_j721e_wait_for_pll_lock,
+    .wait_for_cmn_ready = cdns_dphy_j721e_wait_for_cmn_ready,
  };
  static int cdns_dphy_config_from_opts(struct phy *phy,
@@ -373,6 +406,14 @@ static int cdns_dphy_configure(struct phy *phy, union phy_configure_opts *opts)
            FIELD_PREP(DPHY_BAND_CFG_RIGHT_BAND, band_ctrl);
      writel(reg, dphy->regs + DPHY_BAND_CFG);
+    ret = cdns_dphy_wait_for_pll_lock(dphy);
+    if (ret)
+        dev_err(&dphy->phy->dev, "Failed to lock PLL with err %d\n", ret);
+
+    ret = cdns_dphy_wait_for_cmn_ready(dphy);
+    if (ret)
+        dev_err(&dphy->phy->dev, "O_CMN_READY signal failed to assert with err %d\n", ret);
+

Shouldn't these return an error? Or what's the reason these are ok (and if so, should the prints be dev_dbg?)


Yes, I think it would be better if we can return error and fail if timeout happen. I will fix it in next revision.

Regards
Devarsh

 Tomi

      return 0;
  }