Commit d2ac7bef authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

usb: dwc3: fix PHY disable sequence

Generic PHYs must be powered-off before they can be tore down.

Similarly, suspending legacy PHYs after having powered them off makes no
sense.

Fix the dwc3_core_exit() (e.g. called during suspend) and open-coded
dwc3_probe() error-path sequences that got this wrong.

Note that this makes dwc3_core_exit() match the dwc3_core_init() error
path with respect to powering off the PHYs.

Fixes: 03c1fd62 ("usb: dwc3: core: add phy cleanup for probe error handling")
Fixes: c499ff71 ("usb: dwc3: core: re-factor init and exit paths")
Cc: stable@vger.kernel.org      # 4.8
Reviewed-by: default avatarAndrew Halaney <ahalaney@redhat.com>
Reviewed-by: default avatarMatthias Kaehlcke <mka@chromium.org>
Reviewed-by: default avatarManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: default avatarJohan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20220804151001.23612-2-johan+linaro@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2aa48857
...@@ -833,15 +833,16 @@ static void dwc3_core_exit(struct dwc3 *dwc) ...@@ -833,15 +833,16 @@ static void dwc3_core_exit(struct dwc3 *dwc)
{ {
dwc3_event_buffers_cleanup(dwc); dwc3_event_buffers_cleanup(dwc);
usb_phy_set_suspend(dwc->usb2_phy, 1);
usb_phy_set_suspend(dwc->usb3_phy, 1);
phy_power_off(dwc->usb2_generic_phy);
phy_power_off(dwc->usb3_generic_phy);
usb_phy_shutdown(dwc->usb2_phy); usb_phy_shutdown(dwc->usb2_phy);
usb_phy_shutdown(dwc->usb3_phy); usb_phy_shutdown(dwc->usb3_phy);
phy_exit(dwc->usb2_generic_phy); phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy); phy_exit(dwc->usb3_generic_phy);
usb_phy_set_suspend(dwc->usb2_phy, 1);
usb_phy_set_suspend(dwc->usb3_phy, 1);
phy_power_off(dwc->usb2_generic_phy);
phy_power_off(dwc->usb3_generic_phy);
dwc3_clk_disable(dwc); dwc3_clk_disable(dwc);
reset_control_assert(dwc->reset); reset_control_assert(dwc->reset);
} }
...@@ -1879,16 +1880,16 @@ static int dwc3_probe(struct platform_device *pdev) ...@@ -1879,16 +1880,16 @@ static int dwc3_probe(struct platform_device *pdev)
dwc3_debugfs_exit(dwc); dwc3_debugfs_exit(dwc);
dwc3_event_buffers_cleanup(dwc); dwc3_event_buffers_cleanup(dwc);
usb_phy_shutdown(dwc->usb2_phy);
usb_phy_shutdown(dwc->usb3_phy);
phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy);
usb_phy_set_suspend(dwc->usb2_phy, 1); usb_phy_set_suspend(dwc->usb2_phy, 1);
usb_phy_set_suspend(dwc->usb3_phy, 1); usb_phy_set_suspend(dwc->usb3_phy, 1);
phy_power_off(dwc->usb2_generic_phy); phy_power_off(dwc->usb2_generic_phy);
phy_power_off(dwc->usb3_generic_phy); phy_power_off(dwc->usb3_generic_phy);
usb_phy_shutdown(dwc->usb2_phy);
usb_phy_shutdown(dwc->usb3_phy);
phy_exit(dwc->usb2_generic_phy);
phy_exit(dwc->usb3_generic_phy);
dwc3_ulpi_exit(dwc); dwc3_ulpi_exit(dwc);
err4: err4:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment