Skip to contentSkip to conversation

phy: lantiq: rcu-usb2: wait after clock enable

PATCH Applied Mathias Kresin 4 participants 4 messages Jan 7, 2021 – Jan 13, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: lantiq: rcu-usb2: wait after clock enable

Commit 65dc2e725286 ("usb: dwc2: Update Core Reset programming flow.") revealed that the phy isn't ready immediately after enabling it's clocks. The dwc2_check_core_version() fails and the dwc2 usb driver errors out.

Add a short delay to let the phy get up and running. There isn't any documentation how much time is required, the value was chosen based on tests.

---
 drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c +9 -1
index a7d126192cf1..29d246ea24b4 100644
@@ -124,8 +124,16 @@ static int ltq_rcu_usb2_phy_power_on(struct phy *phy)
 	reset_control_deassert(priv->phy_reset);
 
 	ret = clk_prepare_enable(priv->phy_gate_clk);
-	if (ret)
+	if (ret) {
 		dev_err(dev, "failed to enable PHY gate\n");
+		return ret;
+	}
+
+	/*
+	 * at least the xrx200 usb2 phy requires some extra time to be
+	 * operational after enabling the clock
+	 */
+	usleep_range(100, 200);
 
 	return ret;
 }
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Mathias Kresin

Commit 65dc2e725286 ("usb: dwc2: Update Core Reset programming flow.") revealed that the phy isn't ready immediately after enabling it's clocks. The dwc2_check_core_version() fails and the dwc2 usb driver errors out.

Add a short delay to let the phy get up and running. There isn't any documentation how much time is required, the value was chosen based on tests.

I do not know how long you have to wait here, but this looks ok, when it works.

Hauke

Quoted 27 lines
---
  drivers/phy/lantiq/phy-lantiq-rcu-usb2.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c +9 -1
index a7d126192cf1..29d246ea24b4 100644
@@ -124,8 +124,16 @@ static int ltq_rcu_usb2_phy_power_on(struct phy *phy)
  	reset_control_deassert(priv->phy_reset);
 
  	ret = clk_prepare_enable(priv->phy_gate_clk);
-	if (ret)
+	if (ret) {
  		dev_err(dev, "failed to enable PHY gate\n");
+		return ret;
+	}
+
+	/*
+	 * at least the xrx200 usb2 phy requires some extra time to be
+	 * operational after enabling the clock
+	 */
+	usleep_range(100, 200);
 
  	return ret;
  }
Acked-by on v1 1/1
#2 lore raw
In reply to Mathias Kresin
Quoted 6 lines · Mathias Kresin

Commit 65dc2e725286 ("usb: dwc2: Update Core Reset programming flow.") revealed that the phy isn't ready immediately after enabling it's clocks. The dwc2_check_core_version() fails and the dwc2 usb driver errors out.

Quoted 6 lines

Add a short delay to let the phy get up and running. There isn't any documentation how much time is required, the value was chosen based on tests.

maintainer Applied
#3 lore raw
In reply to Mathias Kresin
Quoted 8 lines · Mathias Kresin

Commit 65dc2e725286 ("usb: dwc2: Update Core Reset programming flow.") revealed that the phy isn't ready immediately after enabling it's clocks. The dwc2_check_core_version() fails and the dwc2 usb driver errors out.

Add a short delay to let the phy get up and running. There isn't any documentation how much time is required, the value was chosen based on tests.

Applied, thanks

Signature · 1 line
~Vinod