From 659777c86124c3948f6ebe16274c136977cf5262 Mon Sep 17 00:00:00 2001 From: Faisal Hassan Date: Wed, 21 Aug 2024 16:54:25 +0530 Subject: [PATCH] usb: phy: Resolve NOC error during host mode PM suspend In the host mode suspend scenario, the dwc3 core executes dwc3_core_exit, which suspends the USB PHYs and turn off the clocks. Later, during the dwc3-msm PM suspend, it invokes notify_disconnect to the PHYs. As part of the SS PHY disconnect, it attempts to power down, leading to a NOC error. To address this, a check has been added to enable the clock during the power-down process. Change-Id: I6040c431dea4a693a7226dc3006c099eb43bce43 Signed-off-by: Faisal Hassan --- drivers/usb/phy/phy-msm-ssusb-qmp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/phy/phy-msm-ssusb-qmp.c b/drivers/usb/phy/phy-msm-ssusb-qmp.c index 9299800afc5e..1b138a5476a3 100644 --- a/drivers/usb/phy/phy-msm-ssusb-qmp.c +++ b/drivers/usb/phy/phy-msm-ssusb-qmp.c @@ -850,12 +850,19 @@ static int msm_ssphy_qmp_notify_disconnect(struct usb_phy *uphy, { struct msm_ssphy_qmp *phy = container_of(uphy, struct msm_ssphy_qmp, phy); + bool clk_enabled = phy->clk_enabled; atomic_notifier_call_chain(&uphy->notifier, 0, uphy); if (phy->phy.flags & PHY_HOST_MODE) { + if (!clk_enabled) + msm_ssphy_qmp_enable_clks(phy, true); + writel_relaxed(0x00, phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]); readl_relaxed(phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]); + + if (!clk_enabled) + msm_ssphy_qmp_enable_clks(phy, false); } dev_dbg(uphy->dev, "QMP phy disconnect notification\n");