The commit 84de44e5e71e ("usb: dwc3-generic: fix ref clock lookup
indexing wrong clk_bulk array") introduced a clk_enable() call for the
ref clock.

However, clk_enable() may return -ENOSYS when a clock driver does not
implement the .enable ops, i.e., for most Rockchip SoCs where most/all
clocks typically are un-gated out of system reset.

The new clk_enable() call may cause USB to fail on such platforms, e.g.:

  => ums mmc 0
  UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0x3a3e000
  dwc3-generic-peripheral usb@fcc00000: failed to enable ref clock: -38
  dwc3-generic-peripheral usb@fcc00000: failed to enable ref clock: -38
  No USB device found
  Couldn't init USB controller.

Ignore -ENOSYS errors from clk_enable() to restore DWC3 to a working
state on affected platforms.

Fixes: 84de44e5e71e ("usb: dwc3-generic: fix ref clock lookup indexing wrong 
clk_bulk array")
Signed-off-by: Jonas Karlman <[email protected]>
---
 drivers/usb/dwc3/dwc3-generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 93912d9c7f6a..3f6e3d408508 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -90,7 +90,7 @@ static int dwc3_generic_probe(struct udevice *dev,
                priv->ref_clk = clk;
 
                rc = clk_enable(&priv->ref_clk);
-               if (rc) {
+               if (rc && rc != -ENOSYS) {
                        dev_err(dev, "failed to enable ref clock: %d\n", rc);
                        return rc;
                }
-- 
2.55.0

Reply via email to