Message ID | 20250203081109.1614395-2-quic_ziqichen@quicinc.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Support Multi-frequency scale for UFS | expand |
On Mon, 2025-02-03 at 16:11 +0800, Ziqi Chen wrote: > From: Can Guo <quic_cang@quicinc.com> > > Instead of only two frequencies, if OPP V2 is used, the UFS devfreq > clock > scaling may scale the clock among multiple frequencies, so just > passing > up/down to vop clk_scale_notify() is not enough to cover the > intermediate > clock freqs between the min and max freqs. Hence pass the target_freq > , > which will be used in successive commits, to clk_scale_notify() to > allow > the vop to perform corresponding configurations with regard to the > clock > freqs. > > Signed-off-by: Can Guo <quic_cang@quicinc.com> > Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> > Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> I have reviewed patches [1/8], [2/8], [3/8], [4/8] in the v2, since you just changed coding types, and typos , but no logic change in v3. Add my review tag agaion: Reviewed-by: Bean Huo <beanhuo@micron.com>
On 2/3/25 12:11 AM, Ziqi Chen wrote: > Instead of only two frequencies, if OPP V2 is used, the UFS devfreq clock > scaling may scale the clock among multiple frequencies, so just passing > up/down to vop clk_scale_notify() is not enough to cover the intermediate > clock freqs between the min and max freqs. Hence pass the target_freq , > which will be used in successive commits, to clk_scale_notify() to allow > the vop to perform corresponding configurations with regard to the clock > freqs. Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Hi Bean, Thanks for your review ~ -Ziqi On 2/3/2025 5:37 PM, Bean Huo wrote: > On Mon, 2025-02-03 at 16:11 +0800, Ziqi Chen wrote: >> From: Can Guo <quic_cang@quicinc.com> >> >> Instead of only two frequencies, if OPP V2 is used, the UFS devfreq >> clock >> scaling may scale the clock among multiple frequencies, so just >> passing >> up/down to vop clk_scale_notify() is not enough to cover the >> intermediate >> clock freqs between the min and max freqs. Hence pass the target_freq >> , >> which will be used in successive commits, to clk_scale_notify() to >> allow >> the vop to perform corresponding configurations with regard to the >> clock >> freqs. >> >> Signed-off-by: Can Guo <quic_cang@quicinc.com> >> Co-developed-by: Ziqi Chen <quic_ziqichen@quicinc.com> >> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> > > I have reviewed patches [1/8], [2/8], [3/8], [4/8] in the v2, since you > just changed coding types, and typos , but no logic change in v3. Add > my review tag agaion: > > Reviewed-by: Bean Huo <beanhuo@micron.com>
diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h index 9ffd94ddf8c7..0549b65f71ed 100644 --- a/drivers/ufs/core/ufshcd-priv.h +++ b/drivers/ufs/core/ufshcd-priv.h @@ -117,11 +117,12 @@ static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba) return ufshcd_readl(hba, REG_UFS_VERSION); } -static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, - bool up, enum ufs_notify_change_status status) +static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, bool up, + unsigned long target_freq, + enum ufs_notify_change_status status) { if (hba->vops && hba->vops->clk_scale_notify) - return hba->vops->clk_scale_notify(hba, up, status); + return hba->vops->clk_scale_notify(hba, up, target_freq, status); return 0; } diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c index acc3607bbd9c..8d295cc827cc 100644 --- a/drivers/ufs/core/ufshcd.c +++ b/drivers/ufs/core/ufshcd.c @@ -1157,7 +1157,7 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, unsigned long freq, int ret = 0; ktime_t start = ktime_get(); - ret = ufshcd_vops_clk_scale_notify(hba, scale_up, PRE_CHANGE); + ret = ufshcd_vops_clk_scale_notify(hba, scale_up, freq, PRE_CHANGE); if (ret) goto out; @@ -1168,7 +1168,7 @@ static int ufshcd_scale_clks(struct ufs_hba *hba, unsigned long freq, if (ret) goto out; - ret = ufshcd_vops_clk_scale_notify(hba, scale_up, POST_CHANGE); + ret = ufshcd_vops_clk_scale_notify(hba, scale_up, freq, POST_CHANGE); if (ret) { if (hba->use_pm_opp) ufshcd_opp_set_rate(hba, diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c index 135cd78109e2..977dd0caaef6 100644 --- a/drivers/ufs/host/ufs-mediatek.c +++ b/drivers/ufs/host/ufs-mediatek.c @@ -1643,6 +1643,7 @@ static void ufs_mtk_clk_scale(struct ufs_hba *hba, bool scale_up) } static int ufs_mtk_clk_scale_notify(struct ufs_hba *hba, bool scale_up, + unsigned long target_freq, enum ufs_notify_change_status status) { if (!ufshcd_is_clkscaling_supported(hba)) diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 68040b2ab5f8..b6eef975dc46 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -1333,8 +1333,9 @@ static int ufs_qcom_clk_scale_down_post_change(struct ufs_hba *hba) return ufs_qcom_set_core_clk_ctrl(hba, false); } -static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, - bool scale_up, enum ufs_notify_change_status status) +static int ufs_qcom_clk_scale_notify(struct ufs_hba *hba, bool scale_up, + unsigned long target_freq, + enum ufs_notify_change_status status) { struct ufs_qcom_host *host = ufshcd_get_variant(hba); int err; diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h index d7aca9e61684..f51d425696e7 100644 --- a/include/ufs/ufshcd.h +++ b/include/ufs/ufshcd.h @@ -344,8 +344,8 @@ struct ufs_hba_variant_ops { void (*exit)(struct ufs_hba *); u32 (*get_ufs_hci_version)(struct ufs_hba *); int (*set_dma_mask)(struct ufs_hba *); - int (*clk_scale_notify)(struct ufs_hba *, bool, - enum ufs_notify_change_status); + int (*clk_scale_notify)(struct ufs_hba *, bool, unsigned long, + enum ufs_notify_change_status); int (*setup_clocks)(struct ufs_hba *, bool, enum ufs_notify_change_status); int (*hce_enable_notify)(struct ufs_hba *,