diff options
author | Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 2024-04-03 18:50:04 +0530 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2024-04-08 15:08:45 -0400 |
commit | 33507b3964f136ea1592718cb81885c8f9354f65 (patch) | |
tree | 300fcb971cee3748d0bb8e431b968c28c78630a4 /drivers/ufs | |
parent | 83ef2ab4bdd7c8b39d85aa17a8c362b41665981e (diff) | |
download | lwn-33507b3964f136ea1592718cb81885c8f9354f65.tar.gz lwn-33507b3964f136ea1592718cb81885c8f9354f65.zip |
scsi: ufs: qcom: Add sanity checks for gear/lane values during ICC scaling
Let's add the checks to warn the user if the ICC scaling is not supported
for the gear/lane values and also fallback to the max value if that's the
case.
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20240403-ufs-icc-fix-v2-2-958412a5eb45@linaro.org
Reviewed-by: Andrew Halaney <ahalaney@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/ufs')
-rw-r--r-- | drivers/ufs/host/ufs-qcom.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c index 1439c1df0481..3a91255036dd 100644 --- a/drivers/ufs/host/ufs-qcom.c +++ b/drivers/ufs/host/ufs-qcom.c @@ -687,6 +687,16 @@ static struct __ufs_qcom_bw_table ufs_qcom_get_bw_table(struct ufs_qcom_host *ho int gear = max_t(u32, p->gear_rx, p->gear_tx); int lane = max_t(u32, p->lane_rx, p->lane_tx); + if (WARN_ONCE(gear > QCOM_UFS_MAX_GEAR, + "ICC scaling for UFS Gear (%d) not supported. Using Gear (%d) bandwidth\n", + gear, QCOM_UFS_MAX_GEAR)) + gear = QCOM_UFS_MAX_GEAR; + + if (WARN_ONCE(lane > QCOM_UFS_MAX_LANE, + "ICC scaling for UFS Lane (%d) not supported. Using Lane (%d) bandwidth\n", + lane, QCOM_UFS_MAX_LANE)) + lane = QCOM_UFS_MAX_LANE; + if (ufshcd_is_hs_mode(p)) { if (p->hs_rate == PA_HS_MODE_B) return ufs_qcom_bw_table[MODE_HS_RB][gear][lane]; |