[PATCH v14 33/38] phy: rockchip: usbdp: Add phy reset notification support
Sebastian Reichel <[email protected]>
| Newsgroups | org.kernel.vger.linux-usb,org.infradead.lists.linux-arm-kernel,org.infradead.lists.linux-phy,org.infradead.lists.linux-rockchip,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260813-rockchip-usbdp-cleanup-v14-33-b5ad9c68fa11@collabora.com> |
To resolve issues with running into permanent "cmn ana lcpll lock timeout" errors after a few device replugs, add support for reset notifications, which will be handled by the DWC3 driver to gracefully handle the PHY being disabled. This avoids corrupting the controller's internal state and the PIPE interface between the USB3 controller and the PHY, thus fixing the issue. Tested-by: Igor Paunovic <[email protected]> # Orange Pi 5 Plus Signed-off-by: Sebastian Reichel <[email protected]> --- drivers/phy/rockchip/phy-rockchip-usbdp.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-usbdp.c b/drivers/phy/rockchip/phy-rockchip-usbdp.c index 59b836a3796c..21f282216aef 100644 --- a/drivers/phy/rockchip/phy-rockchip-usbdp.c +++ b/drivers/phy/rockchip/phy-rockchip-usbdp.c @@ -1005,24 +1005,39 @@ static int rk_udphy_power_on(struct rk_udphy *udphy, u8 mode) } if (udphy->status == UDPHY_MODE_NONE) { + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_PRE_RESET); + + rk_udphy_u3_port_disable(udphy, true); + udelay(10); + ret = rk_udphy_setup(udphy); - if (ret) + if (ret) { + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_POST_RESET); return ret; + } if (!udphy->hs && udphy->mode & UDPHY_MODE_USB) rk_udphy_u3_port_disable(udphy, false); udphy->phy_needs_reinit = false; + + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_POST_RESET); } else if (udphy->phy_needs_reinit) { + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_PRE_RESET); + rk_udphy_u3_port_disable(udphy, true); udelay(10); ret = rk_udphy_init(udphy); - if (ret) + if (ret) { + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_POST_RESET); return ret; + } if (!udphy->hs && udphy->mode & UDPHY_MODE_USB) rk_udphy_u3_port_disable(udphy, false); udphy->phy_needs_reinit = false; + + phy_notify_reset(udphy->phy_u3, PHY_NOTIFY_POST_RESET); } udphy->status |= mode; -- 2.53.0