Skip to content

Commit 743e1f5

Browse files
quic-cangmartinkpetersen
authored andcommitted
scsi: ufs: ufs-qcom: Allow the first init start with the maximum supported gear
During host driver init, the phy_gear is set to the minimum supported gear (HS_G2). Then, during the first power mode change, the negotiated gear, say HS-G4, is updated to the phy_gear variable so that in the second init the updated phy_gear can be used to program the PHY. But the current code only allows update the phy_gear to a higher value. If one wants to start the first init with the maximum support gear, say HS-G4, the phy_gear is not updated to HS-G3 if the device only supports HS-G3. The original check added there is intend to make sure the phy_gear won't be updated when gear is scaled down (during clock scaling). Update the check so that one can start the first init with the maximum support gear without breaking the original fix by checking the ufshcd_state, that is, allow update to phy_gear only if power mode change is invoked from ufshcd_probe_hba(). Reviewed-by: Manivannan Sadhasivam <[email protected]> Reviewed-by: Nitin Rawat <[email protected]> Signed-off-by: Can Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 55820a7 commit 743e1f5

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -916,11 +916,12 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
916916
}
917917

918918
/*
919-
* Update phy_gear only when the gears are scaled to a higher value. This is
920-
* because, the PHY gear settings are backwards compatible and we only need to
921-
* change the PHY gear settings while scaling to higher gears.
919+
* During UFS driver probe, always update the PHY gear to match the negotiated
920+
* gear, so that, if quirk UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH is enabled,
921+
* the second init can program the optimal PHY settings. This allows one to start
922+
* the first init with either the minimum or the maximum support gear.
922923
*/
923-
if (dev_req_params->gear_tx > host->phy_gear)
924+
if (hba->ufshcd_state == UFSHCD_STATE_RESET)
924925
host->phy_gear = dev_req_params->gear_tx;
925926

926927
/* enable the device ref clock before changing to HS mode */

0 commit comments

Comments
 (0)