mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
phy: qcom-ufs: make ref_clk as optional
Per newer UFS PHY design, some platforms may not have the ON/OFF control for reference clock, hence this clock may be optional. Change-Id: I26edd35970e88a8d17edded399b63c5d3cc7f5d9 Signed-off-by: Can Guo <[email protected]>
This commit is contained in:
parent
427b10e68e
commit
a686b527a3
1 changed files with 25 additions and 10 deletions
|
|
@ -219,10 +219,12 @@ skip_txrx_clk:
|
|||
__ufs_qcom_phy_clk_get(phy_common->dev, "ref_clk_parent",
|
||||
&phy_common->ref_clk_parent, false);
|
||||
|
||||
err = ufs_qcom_phy_clk_get(phy_common->dev, "ref_clk",
|
||||
&phy_common->ref_clk);
|
||||
if (err)
|
||||
goto out;
|
||||
/*
|
||||
* Some platforms may not have the ON/OFF control for reference clock,
|
||||
* hence this clock may be optional.
|
||||
*/
|
||||
__ufs_qcom_phy_clk_get(phy_common->dev, "ref_clk",
|
||||
&phy_common->ref_clk, false);
|
||||
|
||||
/*
|
||||
* "ref_aux_clk" is optional and only supported by certain
|
||||
|
|
@ -408,11 +410,17 @@ static int ufs_qcom_phy_enable_ref_clk(struct ufs_qcom_phy *phy)
|
|||
}
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(phy->ref_clk);
|
||||
if (ret) {
|
||||
dev_err(phy->dev, "%s: ref_clk enable failed %d\n",
|
||||
__func__, ret);
|
||||
goto out_disable_parent;
|
||||
/*
|
||||
* "ref_clk" is optional clock hence make sure that clk reference
|
||||
* is available before trying to enable the clock.
|
||||
*/
|
||||
if (phy->ref_clk) {
|
||||
ret = clk_prepare_enable(phy->ref_clk);
|
||||
if (ret) {
|
||||
dev_err(phy->dev, "%s: ref_clk enable failed %d\n",
|
||||
__func__, ret);
|
||||
goto out_disable_parent;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -476,7 +484,14 @@ static void ufs_qcom_phy_disable_ref_clk(struct ufs_qcom_phy *phy)
|
|||
*/
|
||||
if (phy->ref_aux_clk)
|
||||
clk_disable_unprepare(phy->ref_aux_clk);
|
||||
clk_disable_unprepare(phy->ref_clk);
|
||||
|
||||
/*
|
||||
* "ref_clk" is optional clock hence make sure that clk
|
||||
* reference is available before trying to disable the clock.
|
||||
*/
|
||||
if (phy->ref_clk)
|
||||
clk_disable_unprepare(phy->ref_clk);
|
||||
|
||||
/*
|
||||
* "ref_clk_parent" is optional clock hence make sure that clk
|
||||
* reference is available before trying to disable the clock.
|
||||
|
|
|
|||
Loading…
Reference in a new issue