Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1489ed2e authored by Subhash Jadavani's avatar Subhash Jadavani Committed by Gerrit - the friendly Code Review server
Browse files

scsi: ufs: UFS device spec version for G4 and low voltage support



UFS HS-G4 and low voltage support features are supported in UFS
device specification version 3.0. To enable these features, driver
is not just checking the specification version but it also reads
the HS-G4 capability. Checking HS-G4 capability is not required so
this change removes the check.

Change-Id: I1e712aeabaa63fb742809a8f9c2dced94a71f5a8
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent ff6b1143
Loading
Loading
Loading
Loading
+2 −37
Original line number Diff line number Diff line
@@ -476,7 +476,6 @@ static int ufshcd_config_vreg(struct device *dev,
		struct ufs_vreg *vreg, bool on);
static int ufshcd_enable_vreg(struct device *dev, struct ufs_vreg *vreg);
static int ufshcd_disable_vreg(struct device *dev, struct ufs_vreg *vreg);
static bool ufshcd_is_g4_supported(struct ufs_hba *hba);

#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
static struct devfreq_simple_ondemand_data ufshcd_ondemand_data = {
@@ -8141,7 +8140,7 @@ static int ufshcd_set_low_vcc_level(struct ufs_hba *hba,
	struct ufs_vreg *vreg = hba->vreg_info.vcc;

	/* Check if device supports the low voltage VCC feature */
	if (dev_desc->wspecversion < 0x300 && !ufshcd_is_g4_supported(hba))
	if (dev_desc->wspecversion < 0x300)
		return 0;

	/*
@@ -8691,34 +8690,6 @@ static int ufs_read_device_desc_data(struct ufs_hba *hba)
	return err;
}

/**
 * ufshcd_is_g4_supported - check if device supports HS-G4
 * @hba: per-adapter instance
 *
 * Returns True if device supports HS-G4, False otherwise.
 */
static bool ufshcd_is_g4_supported(struct ufs_hba *hba)
{
	int ret;
	u32 tx_hsgear = 0;

	/* check device capability */
	ret = ufshcd_dme_peer_get(hba,
			UIC_ARG_MIB_SEL(TX_HSGEAR_CAPABILITY,
			UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
			&tx_hsgear);
	if (ret) {
		dev_err(hba->dev, "%s: Failed getting peer TX_HSGEAR_CAPABILITY. err = %d\n",
			__func__, ret);
		return false;
	}

	if (tx_hsgear == UFS_HS_G4)
		return true;
	else
		return false;
}

/**
 * ufshcd_probe_hba - probe hba to detect device and initialize
 * @hba: per-adapter instance
@@ -8771,13 +8742,7 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
		goto out;
	}

	/*
	 * Note: Some UFS 3.0 devices may still advertise UFS specification
	 * version as 2.1. So let's also read the TX_HSGEAR_CAPABILITY from
	 * device to know if device support HS-G4 or not.
	 */
	if ((card.wspecversion >= 0x300 || ufshcd_is_g4_supported(hba)) &&
	    !hba->reinit_g4_rate_A) {
	if (card.wspecversion >= 0x300 && !hba->reinit_g4_rate_A) {
		unsigned long flags;
		int err;