scsi: ufs-qcom: phy/hcd: Refactoring phy clock handling
Add phy clock enable code to phy_power_on/off callbacks, and remove explicit calls to enable these phy clocks from the ufs-qcom hcd driver. Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org> Reviewed-by: Subhash Jadavani <subhashj@codeaurora.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:

committed by
Martin K. Petersen

szülő
9c7ce698ba
commit
feb3d79800
@@ -1114,17 +1114,8 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
|
||||
return 0;
|
||||
|
||||
if (on && (status == POST_CHANGE)) {
|
||||
err = ufs_qcom_phy_enable_iface_clk(host->generic_phy);
|
||||
if (err)
|
||||
goto out;
|
||||
phy_power_on(host->generic_phy);
|
||||
|
||||
err = ufs_qcom_phy_enable_ref_clk(host->generic_phy);
|
||||
if (err) {
|
||||
dev_err(hba->dev, "%s enable phy ref clock failed, err=%d\n",
|
||||
__func__, err);
|
||||
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
|
||||
goto out;
|
||||
}
|
||||
/* enable the device ref clock for HS mode*/
|
||||
if (ufshcd_is_hs_mode(&hba->pwr_info))
|
||||
ufs_qcom_dev_ref_clk_ctrl(host, true);
|
||||
@@ -1133,13 +1124,14 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
|
||||
ufs_qcom_update_bus_bw_vote(host);
|
||||
|
||||
} else if (!on && (status == PRE_CHANGE)) {
|
||||
|
||||
/* M-PHY RMMI interface clocks can be turned off */
|
||||
ufs_qcom_phy_disable_iface_clk(host->generic_phy);
|
||||
if (!ufs_qcom_is_link_active(hba))
|
||||
if (!ufs_qcom_is_link_active(hba)) {
|
||||
/* disable device ref_clk */
|
||||
ufs_qcom_dev_ref_clk_ctrl(host, false);
|
||||
|
||||
/* powering off PHY during aggressive clk gating */
|
||||
phy_power_off(host->generic_phy);
|
||||
}
|
||||
|
||||
vote = host->bus_vote.min_bw_vote;
|
||||
}
|
||||
|
||||
@@ -1148,7 +1140,6 @@ static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on,
|
||||
dev_err(hba->dev, "%s: set bus vote failed %d\n",
|
||||
__func__, err);
|
||||
|
||||
out:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user