Skip to content

Commit 516ceaa

Browse files
petegriffinmartinkpetersen
authored andcommitted
scsi: ufs: exynos: Allow UFS Gear 4
UFS Gear 4 offers faster speeds, and better power usage so lets enable it. Currently ufshcd_init_host_params() sets UFS_HS_G3 as a default, so even if the device supports G4 we end up negotiating down to G3. For SoCs like gs101 which have a UFS major controller version of 3 or above advertise Gear 4. This then allows a Gear 4 link on Pixel 6. For earlier controller versions keep the current default behaviour of reporting G3. Signed-off-by: Peter Griffin <peter.griffin@linaro.org> Link: https://lore.kernel.org/r/20241031150033.3440894-4-peter.griffin@linaro.org Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent afd613c commit 516ceaa

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

drivers/ufs/host/ufs-exynos.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,21 @@ static void exynos_ufs_config_sync_pattern_mask(struct exynos_ufs *ufs,
766766
exynos_ufs_disable_ov_tm(hba);
767767
}
768768

769+
#define UFS_HW_VER_MAJOR_MASK GENMASK(15, 8)
770+
771+
static u32 exynos_ufs_get_hs_gear(struct ufs_hba *hba)
772+
{
773+
u8 major;
774+
775+
major = FIELD_GET(UFS_HW_VER_MAJOR_MASK, hba->ufs_version);
776+
777+
if (major >= 3)
778+
return UFS_HS_G4;
779+
780+
/* Default is HS-G3 */
781+
return UFS_HS_G3;
782+
}
783+
769784
static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba,
770785
struct ufs_pa_layer_attr *dev_max_params,
771786
struct ufs_pa_layer_attr *dev_req_params)
@@ -783,6 +798,10 @@ static int exynos_ufs_pre_pwr_mode(struct ufs_hba *hba,
783798

784799
ufshcd_init_host_params(&host_params);
785800

801+
/* This driver only support symmetric gear setting e.g. hs_tx_gear == hs_rx_gear */
802+
host_params.hs_tx_gear = exynos_ufs_get_hs_gear(hba);
803+
host_params.hs_rx_gear = exynos_ufs_get_hs_gear(hba);
804+
786805
ret = ufshcd_negotiate_pwr_params(&host_params, dev_max_params, dev_req_params);
787806
if (ret) {
788807
pr_err("%s: failed to determine capabilities\n", __func__);

0 commit comments

Comments
 (0)