[PATCH 3/6] usb: host: ehci-msm: Disable clocks after all register accesses

Stephan Gerhold stephan.gerhold at linaro.org
Mon Apr 7 11:54:23 CEST 2025


We need the USB clocks to do accesses like
  wait_for_bit_le32(&ehci->usbcmd, CMD_RESET, ...)
so we should disable them only after all of them are done.

At the moment this works only because the clock driver doesn't actually
disabling these clocks in U-Boot.

Fixes: 9b3a9f896e66 ("ehci: msm: bring up iface + core clocks")
Signed-off-by: Stephan Gerhold <stephan.gerhold at linaro.org>
---
 drivers/usb/host/ehci-msm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-msm.c b/drivers/usb/host/ehci-msm.c
index 60b2dc44d3d35ddc5b8cf37f70bbccd91c5e962c..bf46e89104ecd594587eb9132b8d10d566feb766 100644
--- a/drivers/usb/host/ehci-msm.c
+++ b/drivers/usb/host/ehci-msm.c
@@ -110,9 +110,6 @@ static int ehci_usb_remove(struct udevice *dev)
 	/* Stop controller. */
 	clrbits_le32(&ehci->usbcmd, CMD_RUN);
 
-	clk_disable_unprepare(&p->iface_clk);
-	clk_disable_unprepare(&p->core_clk);
-
 	ret = generic_shutdown_phy(&p->phy);
 	if (ret)
 		return ret;
@@ -130,6 +127,8 @@ static int ehci_usb_remove(struct udevice *dev)
 		return -ETIMEDOUT;
 	}
 
+	clk_disable_unprepare(&p->iface_clk);
+	clk_disable_unprepare(&p->core_clk);
 	return 0;
 }
 

-- 
2.47.2



More information about the U-Boot mailing list