Message ID | 20250502042432.88434-1-quic_ziqichen@quicinc.com |
---|---|
Headers | show |
Series | Bug fixes for UFS multi-frequency scaling on Qcom platform | expand |
Hi Avri, On 5/2/2025 1:10 PM, Avri Altman wrote: >> The vop freq_to_gear() may return a gear greater than the negotiated max >> gear, return the negotiated max gear if the mapped gear is greater than it. >> >> Tested-by: Neil Armstrong <neil.armstrong@linaro.org> >> Signed-off-by: Ziqi Chen <quic_ziqichen@quicinc.com> >> --- >> drivers/ufs/host/ufs-qcom.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index >> 46cca52aa6f1..f5ea703d8ef5 100644 >> --- a/drivers/ufs/host/ufs-qcom.c >> +++ b/drivers/ufs/host/ufs-qcom.c >> @@ -1938,9 +1938,11 @@ static u32 ufs_qcom_freq_to_gear_speed(struct >> ufs_hba *hba, unsigned long freq) >> break; >> default: >> dev_err(hba->dev, "%s: Unsupported clock freq : %lu\n", >> __func__, freq); >> - break; >> + return gear; > Mayby return 0 so it is clear that you are not returning a gear > >> } >> >> + gear = min_t(u32, gear, hba->max_pwr_info.info.gear_rx); > return min_t(u32, gear, hba->max_pwr_info.info.gear_rx); > Thanks, the way you suggested is more concise. I will update and use this way. Ziqi > Thanks, > Avri >> + >> return gear; >> } >> >> -- >> 2.34.1 >> >
This series fixes a few corner cases introduced by multi-frequency scaling feature on some old Qcom platforms design. 1. On some platforms, the frequency tables for unipro clock and the core clock are different, which has led to errors when handling the unipro clock. 2. On some platforms, the maximum gear supported by the host may exceed the maximum gear supported by connected UFS device. Therefore, this should be taken into account when find mapped gear for frequency. This series has been tested on below platforms - sm8550 mtp + UFS3.1 SM8650 MTP + UFS3.1 QCS6490 BR3GEN2 + UFS2.2 For change "scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear()" Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on RB3GEN2 For change "scsi: ufs: qcom: Map devfreq OPP freq to UniPro Core Clock freq" "scsi: ufs: qcom: Call ufs_qcom_cfg_timers() in clock scaling path" The original pathes of these two changes are tested by: Luca Weiss <luca.weiss@fairphone.com> on SM6350, but we have reworked the code logic later. Can Guo (2): scsi: ufs: qcom: Map devfreq OPP freq to UniPro Core Clock freq scsi: ufs: qcom: Call ufs_qcom_cfg_timers() in clock scaling path Ziqi Chen (1): scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear() drivers/ufs/host/ufs-qcom.c | 134 +++++++++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 31 deletions(-)