From a63d297ffde253d34f7b6ed3dfd1dd78c10c2f09 Mon Sep 17 00:00:00 2001 From: Algea Cao Date: Mon, 21 Mar 2022 17:50:40 +0800 Subject: [PATCH] phy: rockchip-samsung-hdptx-hdmi: Reset apb when disable phy Signed-off-by: Algea Cao Change-Id: I85cd210e2f22a7e8a3bbbf5b468adbf0160a676c --- drivers/phy/rockchip/phy-rockchip-samsung-hdptx-hdmi.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx-hdmi.c b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx-hdmi.c index f105b0519642..875b1ead4d15 100644 --- a/drivers/phy/rockchip/phy-rockchip-samsung-hdptx-hdmi.c +++ b/drivers/phy/rockchip/phy-rockchip-samsung-hdptx-hdmi.c @@ -1023,10 +1023,15 @@ static void hdptx_phy_disable(struct rockchip_hdptx_phy *hdptx) { u32 val; + /* reset phy and apb, or phy locked flag may keep 1 */ reset_control_assert(hdptx->phy_reset); udelay(20); reset_control_deassert(hdptx->phy_reset); + reset_control_assert(hdptx->apb_reset); + udelay(20); + reset_control_deassert(hdptx->apb_reset); + hdptx_write(hdptx, LANE_REG0300, 0x82); hdptx_write(hdptx, SB_REG010F, 0xc1); hdptx_write(hdptx, SB_REG0110, 0x1); @@ -1973,9 +1978,10 @@ static int rockchip_hdptx_phy_power_off(struct phy *phy) if (hdptx->count) return 0; - if (hdptx_grf_read(hdptx, GRF_HDPTX_STATUS) & HDPTX_O_PLL_LOCK_DONE) - hdptx_phy_disable(hdptx); + if (!(hdptx_grf_read(hdptx, GRF_HDPTX_STATUS) & HDPTX_O_PLL_LOCK_DONE)) + return 0; + hdptx_phy_disable(hdptx); clk_bulk_disable(hdptx->nr_clks, hdptx->clks); return 0;