Skip to content

Commit 10a3966

Browse files
eric-chmartinkpetersen
authored andcommitted
scsi: ufs: qcom: Avoid re-init quirk when gears match
On sa8775p-ride, probing the HBA will go through the UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH path although the power info is the same during the second init. The REINIT quirk only applies starting with controller v4. For these, ufs_qcom_get_hs_gear() reads the highest supported gear when setting the host_params. After the negotiation, if the host and device are on the same gear, it is the highest gear supported between the two. Skip REINIT to save some time. Signed-off-by: Eric Chanudet <echanude@redhat.com> Link: https://lore.kernel.org/r/20240123192854.1724905-4-echanude@redhat.com Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 883a8b4 commit 10a3966

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,8 +738,17 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
738738
* the second init can program the optimal PHY settings. This allows one to start
739739
* the first init with either the minimum or the maximum support gear.
740740
*/
741-
if (hba->ufshcd_state == UFSHCD_STATE_RESET)
742-
host->phy_gear = dev_req_params->gear_tx;
741+
if (hba->ufshcd_state == UFSHCD_STATE_RESET) {
742+
/*
743+
* Skip REINIT if the negotiated gear matches with the
744+
* initial phy_gear. Otherwise, update the phy_gear to
745+
* program the optimal gear setting during REINIT.
746+
*/
747+
if (host->phy_gear == dev_req_params->gear_tx)
748+
hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH;
749+
else
750+
host->phy_gear = dev_req_params->gear_tx;
751+
}
743752

744753
/* enable the device ref clock before changing to HS mode */
745754
if (!ufshcd_is_hs_mode(&hba->pwr_info) &&

0 commit comments

Comments
 (0)