Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Acked-by: Hauke Mehrtens <hauke@hauke-m.de>
Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: <stable@vger.kernel.org> # v5.7+
Link: https://lore.kernel.org/r/20210107224901.2102479-1-dev@kresin.me
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Mathias Kresin and committed by
Vinod Koul
36acd5e2 c1883654

+9 -1
+9 -1
drivers/phy/lantiq/phy-lantiq-rcu-usb2.c
··· 124 124 reset_control_deassert(priv->phy_reset); 125 125 126 126 ret = clk_prepare_enable(priv->phy_gate_clk); 127 - if (ret) 127 + if (ret) { 128 128 dev_err(dev, "failed to enable PHY gate\n"); 129 + return ret; 130 + } 131 + 132 + /* 133 + * at least the xrx200 usb2 phy requires some extra time to be 134 + * operational after enabling the clock 135 + */ 136 + usleep_range(100, 200); 129 137 130 138 return ret; 131 139 }