usb: phy: qmp: Disable LDOs and clocks in error handling path

This change disables regulators and clocks in the error
handling path if phy initialization fails.

Change-Id: I14f67d9704e01e4e047d9f1890b87f3fbd319b3d
Signed-off-by: Pratham Pratap <prathampratap@codeaurora.org>
This commit is contained in:
Pratham Pratap 2020-03-24 19:06:50 +05:30
parent 7a55aabe29
commit ed86e2fece

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
/* /*
* Copyright (c) 2013-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2020, The Linux Foundation. All rights reserved.
*/ */
#include <linux/module.h> #include <linux/module.h>
@ -482,7 +482,7 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)
ret = configure_phy_regs(uphy, reg); ret = configure_phy_regs(uphy, reg);
if (ret) { if (ret) {
dev_err(uphy->dev, "Failed the main PHY configuration\n"); dev_err(uphy->dev, "Failed the main PHY configuration\n");
return ret; goto fail;
} }
/* perform software reset of PHY common logic */ /* perform software reset of PHY common logic */
@ -513,10 +513,19 @@ static int msm_ssphy_qmp_init(struct usb_phy *uphy)
dev_err(uphy->dev, "USB3_PHY_PCS_STATUS:%x\n", dev_err(uphy->dev, "USB3_PHY_PCS_STATUS:%x\n",
readl_relaxed(phy->base + readl_relaxed(phy->base +
phy->phy_reg[USB3_PHY_PCS_STATUS])); phy->phy_reg[USB3_PHY_PCS_STATUS]));
return -EBUSY; ret = -EBUSY;
goto fail;
}; };
return 0; return 0;
fail:
phy->in_suspend = true;
writel_relaxed(0x00,
phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]);
msm_ssphy_qmp_enable_clks(phy, false);
msm_ssusb_qmp_ldo_enable(phy, 0);
return ret;
} }
static int msm_ssphy_qmp_dp_combo_reset(struct usb_phy *uphy) static int msm_ssphy_qmp_dp_combo_reset(struct usb_phy *uphy)