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

Commit f7ec4238 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents a4a6b5b1 1489ed2e
Loading
Loading
Loading
Loading
+10 −41
Original line number Diff line number Diff line
@@ -407,6 +407,7 @@ static struct ufs_dev_fix ufs_fixups[] = {
		UFS_DEVICE_NO_FASTAUTO),
	UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE),
	UFS_FIX(UFS_VENDOR_SAMSUNG, UFS_ANY_MODEL, UFS_DEVICE_NO_VCCQ),
	UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL,
		UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM),
	UFS_FIX(UFS_VENDOR_TOSHIBA, UFS_ANY_MODEL,
@@ -475,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 = {
@@ -8140,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;

	/*
@@ -8690,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
@@ -8770,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;

@@ -8808,10 +8774,13 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
	ufshcd_tune_unipro_params(hba);

	ufshcd_apply_pm_quirks(hba);
	if (card.wspecversion < 0x300) {
		ret = ufshcd_set_vccq_rail_unused(hba,
		(hba->dev_info.quirks & UFS_DEVICE_NO_VCCQ) ? true : false);
			(hba->dev_info.quirks & UFS_DEVICE_NO_VCCQ) ?
			true : false);
		if (ret)
			goto out;
	}

	/* UFS device is also active now */
	ufshcd_set_ufs_dev_active(hba);