summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmelie Delaunay <amelie.delaunay@foss.st.com>2021-01-05 10:05:24 +0100
committerVinod Koul <vkoul@kernel.org>2021-01-13 20:40:21 +0530
commit649627245cc439fddef2096bf646cb3558e13803 (patch)
tree746a035836ec9ab14c51ff1cc86aadcc8c88151d
parent56bf858edd17bd4a320aca1a10aea7dbfb0c6699 (diff)
phy: stm32: ensure phy are no more active when removing the driver
To ensure a good balancing of regulators, and allow PLL disabling when the driver is removed, call stm32_usbphyc_phy_exit on each ports to set phys inactive and disable PLL. Signed-off-by: Amelie Delaunay <amelie.delaunay@foss.st.com> Link: https://lore.kernel.org/r/20210105090525.23164-6-amelie.delaunay@foss.st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
-rw-r--r--drivers/phy/st/phy-stm32-usbphyc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c
index 33367a325612..8b11d95b2c20 100644
--- a/drivers/phy/st/phy-stm32-usbphyc.c
+++ b/drivers/phy/st/phy-stm32-usbphyc.c
@@ -470,6 +470,12 @@ clk_disable:
static int stm32_usbphyc_remove(struct platform_device *pdev)
{
struct stm32_usbphyc *usbphyc = dev_get_drvdata(&pdev->dev);
+ int port;
+
+ /* Ensure PHYs are not active, to allow PLL disabling */
+ for (port = 0; port < usbphyc->nphys; port++)
+ if (usbphyc->phys[port]->active)
+ stm32_usbphyc_phy_exit(usbphyc->phys[port]->phy);
clk_disable_unprepare(usbphyc->clk);