From 8a5f2be5f6a13ebbced6de71e5134856a00e40dc Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Fri, 13 Oct 2017 11:37:18 +0800
Subject: [PATCH] MLK-16581-1 phy: mixel-lvds: Get PHY clock rate before
 setting it's rate

Due to i.MX8 clock issue, we need to get PHY clock rate
before setting it's rate when system resumes back from
PM sleep mode, otherwise, we'll fail to set the clock rate.
So, this is a workaround and it can be removed when
the clock issue is properly fixed.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit f9709fbf36495c7139ac55a0ecc01b30303b427b)
---
 drivers/phy/phy-mixel-lvds.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/phy/phy-mixel-lvds.c b/drivers/phy/phy-mixel-lvds.c
index 824b251020a49e..31188884f3317f 100644
--- a/drivers/phy/phy-mixel-lvds.c
+++ b/drivers/phy/phy-mixel-lvds.c
@@ -96,6 +96,13 @@ void mixel_phy_lvds_set_phy_speed(struct phy *phy, unsigned long phy_clk_rate)
 	mutex_unlock(&priv->lock);
 	clk_disable_unprepare(priv->phy_clk);
 
+	/*
+	 * To workaround setting clock rate failure issue
+	 * when the system resumes back from PM sleep mode,
+	 * we need to get the clock rate before setting it's
+	 * rate, otherwise, setting the clock rate will fail.
+	 */
+	clk_get_rate(priv->phy_clk);
 	clk_set_rate(priv->phy_clk, phy_clk_rate);
 }
 EXPORT_SYMBOL_GPL(mixel_phy_lvds_set_phy_speed);
-- 
GitLab