Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amelie Delaunay and committed by
Vinod Koul
64962724 56bf858e

+6
+6
drivers/phy/st/phy-stm32-usbphyc.c
··· 470 470 static int stm32_usbphyc_remove(struct platform_device *pdev) 471 471 { 472 472 struct stm32_usbphyc *usbphyc = dev_get_drvdata(&pdev->dev); 473 + int port; 474 + 475 + /* Ensure PHYs are not active, to allow PLL disabling */ 476 + for (port = 0; port < usbphyc->nphys; port++) 477 + if (usbphyc->phys[port]->active) 478 + stm32_usbphyc_phy_exit(usbphyc->phys[port]->phy); 473 479 474 480 clk_disable_unprepare(usbphyc->clk); 475 481