]>
Commit | Line | Data |
---|---|---|
335f7cc0 SL |
1 | From 9b5da146eb938010b9efcbd24719e62a9e374e2e Mon Sep 17 00:00:00 2001 |
2 | From: Sasha Levin <sashal@kernel.org> | |
3 | Date: Tue, 23 Jan 2024 14:28:57 -0500 | |
4 | Subject: scsi: ufs: qcom: Avoid re-init quirk when gears match | |
5 | ||
6 | From: Eric Chanudet <echanude@redhat.com> | |
7 | ||
8 | [ Upstream commit 10a39667a117daf0c1baaebcbe589715ee79178b ] | |
9 | ||
10 | On sa8775p-ride, probing the HBA will go through the | |
11 | UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH path although the power info is | |
12 | the same during the second init. | |
13 | ||
14 | The REINIT quirk only applies starting with controller v4. For these, | |
15 | ufs_qcom_get_hs_gear() reads the highest supported gear when setting the | |
16 | host_params. After the negotiation, if the host and device are on the same | |
17 | gear, it is the highest gear supported between the two. Skip REINIT to save | |
18 | some time. | |
19 | ||
20 | Signed-off-by: Eric Chanudet <echanude@redhat.com> | |
21 | Link: https://lore.kernel.org/r/20240123192854.1724905-4-echanude@redhat.com | |
22 | Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | |
23 | Tested-by: Andrew Halaney <ahalaney@redhat.com> # sa8775p-ride | |
24 | Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> | |
25 | Signed-off-by: Sasha Levin <sashal@kernel.org> | |
26 | --- | |
27 | drivers/ufs/host/ufs-qcom.c | 13 +++++++++++-- | |
28 | 1 file changed, 11 insertions(+), 2 deletions(-) | |
29 | ||
30 | diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c | |
31 | index 3d43c7ac7a3f8..f532e2c004a25 100644 | |
32 | --- a/drivers/ufs/host/ufs-qcom.c | |
33 | +++ b/drivers/ufs/host/ufs-qcom.c | |
34 | @@ -738,8 +738,17 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba, | |
35 | * the second init can program the optimal PHY settings. This allows one to start | |
36 | * the first init with either the minimum or the maximum support gear. | |
37 | */ | |
38 | - if (hba->ufshcd_state == UFSHCD_STATE_RESET) | |
39 | - host->phy_gear = dev_req_params->gear_tx; | |
40 | + if (hba->ufshcd_state == UFSHCD_STATE_RESET) { | |
41 | + /* | |
42 | + * Skip REINIT if the negotiated gear matches with the | |
43 | + * initial phy_gear. Otherwise, update the phy_gear to | |
44 | + * program the optimal gear setting during REINIT. | |
45 | + */ | |
46 | + if (host->phy_gear == dev_req_params->gear_tx) | |
47 | + hba->quirks &= ~UFSHCD_QUIRK_REINIT_AFTER_MAX_GEAR_SWITCH; | |
48 | + else | |
49 | + host->phy_gear = dev_req_params->gear_tx; | |
50 | + } | |
51 | ||
52 | /* enable the device ref clock before changing to HS mode */ | |
53 | if (!ufshcd_is_hs_mode(&hba->pwr_info) && | |
54 | -- | |
55 | 2.43.0 | |
56 |