mbox series

[v3,0/3] Bug fixes for UFS multi-frequency scaling on Qcom platform

Message ID 20250509075029.3776419-1-quic_ziqichen@quicinc.com
Headers show
Series Bug fixes for UFS multi-frequency scaling on Qcom platform | expand

Message

Ziqi Chen May 9, 2025, 7:50 a.m. UTC
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()"
Reported-by: Neil Armstrong <neil.armstrong@linaro.org>
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"

Reported-by: Luca Weiss <luca.weiss@fairphone.com>
Closes: https://lore.kernel.org/linux-arm-msm/D9FZ9U3AEXW4.1I12FX3YQ3JPW@fairphone.com/
Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sm7225-fairphone-fp4


v1 - > v2:
Change "scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear()":
1. Instead of return 'gear', return '0' directly if didn't find mapped gear
2. Derectly return min_t(gear,max_gear) instead assign to 'gear' then return it.

v2 - > v3:
Change "scsi: ufs: qcom: Check gear against max gear in vop freq_to_gear()":
  Replace hard code '0' with enum 'UFS_HS_DONT_CHANGE'.

Change "scsi: ufs: qcom: Map devfreq OPP freq to UniPro Core Clock freq"
1. Skip calling ufs_qcom_opp_freq_to_clk_freq() if freq is ULONG_MAX to avoid useless error prints.
2. Correct indentation size to follow Linux kernel coding style.

Change 'scsi: ufs: qcom: Call ufs_qcom_cfg_timers() in clock scaling path':
Skip calling ufs_qcom_opp_freq_to_clk_freq() if freq is ULONG_MAX to avoid useless prints.


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 | 136 +++++++++++++++++++++++++++---------
 1 file changed, 103 insertions(+), 33 deletions(-)