From ba8a6e65a7bb27181ff822efb8e772d087c36e4c Mon Sep 17 00:00:00 2001 From: William Wu Date: Tue, 19 Jul 2022 18:24:18 +0800 Subject: [PATCH] phy: rockchip: inno_usb2: only reset phy if deassert iddq for rk3588 The current code always reset the usb2 phy in the rk3588_usb2phy_tuning(), this cause the usb core reset the device which connected to the usb2 host interface during pm resume. Actually, it only needs to reset the phy when it exit from iddq mode, so add this patch to reset phy more reasonably, and avoid reset usb device during pm resume. Signed-off-by: William Wu Change-Id: I296636321d0cbe6b7ee7be9bd1614237a34312e9 --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index cac7c4c0495e..caa5a776a3d2 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -2692,18 +2692,26 @@ static int rk3568_vbus_detect_control(struct rockchip_usb2phy *rphy, bool en) static int rk3588_usb2phy_tuning(struct rockchip_usb2phy *rphy) { + unsigned int reg; int ret = 0; - /* Deassert SIDDQ to power on analog block */ - ret = regmap_write(rphy->grf, 0x0008, - GENMASK(29, 29) | 0x0000); + /* Read the SIDDQ control register */ + ret = regmap_read(rphy->grf, 0x0008, ®); if (ret) return ret; - /* Do reset after exit IDDQ mode */ - ret = rockchip_usb2phy_reset(rphy); - if (ret) - return ret; + if (reg & BIT(13)) { + /* Deassert SIDDQ to power on analog block */ + ret = regmap_write(rphy->grf, 0x0008, + GENMASK(29, 29) | 0x0000); + if (ret) + return ret; + + /* Do reset after exit IDDQ mode */ + ret = rockchip_usb2phy_reset(rphy); + if (ret) + return ret; + } if (rphy->phy_cfg->reg == 0x0000) { /*