Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit c270986

Browse files
Mani-Sadhasivammartinkpetersen
authored andcommitted
scsi: ufs: ufs-qcom: Factor out the logic finding the HS Gear
In the preparation of adding support for new gears, move the logic that finds the gear for each platform to a new function. This helps with code readability and also allows the logic to be used in other places of the driver in future. While at it, make it clear that this driver only supports symmetric gear setting (hs_tx_gear == hs_rx_gear). Reviewed-by: Andrew Halaney <[email protected]> Tested-by: Andrew Halaney <[email protected]> # Qdrive3/sa8540p-ride Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 96a7141 commit c270986

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

drivers/ufs/host/ufs-qcom.c

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,25 @@ static int ufs_qcom_host_reset(struct ufs_hba *hba)
269269
return 0;
270270
}
271271

272+
static u32 ufs_qcom_get_hs_gear(struct ufs_hba *hba)
273+
{
274+
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
275+
276+
if (host->hw_ver.major == 0x1) {
277+
/*
278+
* HS-G3 operations may not reliably work on legacy QCOM
279+
* UFS host controller hardware even though capability
280+
* exchange during link startup phase may end up
281+
* negotiating maximum supported gear as G3.
282+
* Hence downgrade the maximum supported gear to HS-G2.
283+
*/
284+
return UFS_HS_G2;
285+
}
286+
287+
/* Default is HS-G3 */
288+
return UFS_HS_G3;
289+
}
290+
272291
static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
273292
{
274293
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
@@ -683,19 +702,8 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
683702
ufshcd_init_pwr_dev_param(&ufs_qcom_cap);
684703
ufs_qcom_cap.hs_rate = UFS_QCOM_LIMIT_HS_RATE;
685704

686-
if (host->hw_ver.major == 0x1) {
687-
/*
688-
* HS-G3 operations may not reliably work on legacy QCOM
689-
* UFS host controller hardware even though capability
690-
* exchange during link startup phase may end up
691-
* negotiating maximum supported gear as G3.
692-
* Hence downgrade the maximum supported gear to HS-G2.
693-
*/
694-
if (ufs_qcom_cap.hs_tx_gear > UFS_HS_G2)
695-
ufs_qcom_cap.hs_tx_gear = UFS_HS_G2;
696-
if (ufs_qcom_cap.hs_rx_gear > UFS_HS_G2)
697-
ufs_qcom_cap.hs_rx_gear = UFS_HS_G2;
698-
}
705+
/* This driver only supports symmetic gear setting i.e., hs_tx_gear == hs_rx_gear */
706+
ufs_qcom_cap.hs_tx_gear = ufs_qcom_cap.hs_rx_gear = ufs_qcom_get_hs_gear(hba);
699707

700708
ret = ufshcd_get_pwr_dev_param(&ufs_qcom_cap,
701709
dev_max_params,

0 commit comments

Comments
 (0)