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

Commit 37dfcbf1 authored by peter.wuw's avatar peter.wuw Committed by Harshit Agarwal
Browse files

fix err state caused by selector

Change-Id: I84e521029b5a39c8f7d01322fcc49f8182a8f6c7
parent 7635db6f
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
@@ -277,19 +277,12 @@ static int ufsf_read_unit_desc(struct ufsf_feature *ufsf, int lun, u8 selector)
	return ret;
}

void ufsf_device_check(struct ufs_hba *hba)
int is_samsung_feature(struct ufs_hba *hba)
{
	struct ufsf_feature *ufsf = &hba->ufsf;
	int ret, lun;
	u32 status;
	int is_samsung_feature = 0;
	struct Scsi_Host *shost;
	struct scsi_device *sdev;

	ufsf->slave_conf_cnt = 0;

	ufsf->hba = hba;

	shost = hba->host;
	shost_for_each_device(sdev, shost) {
		if ((strncmp(sdev->vendor, "SAMSUNG", 7) == 0)
@@ -297,8 +290,20 @@ void ufsf_device_check(struct ufs_hba *hba)
				|| (strncmp(sdev->rev, "1500", 4) == 0)))
			is_samsung_feature = 1;
	}
	return is_samsung_feature;
}

void ufsf_device_check(struct ufs_hba *hba)
{
	struct ufsf_feature *ufsf = &hba->ufsf;
	int ret, lun;
	u32 status;

	ufsf->slave_conf_cnt = 0;

	ufsf->hba = hba;

	if (is_samsung_feature == 0) {
	if (!is_samsung_feature(hba)) {
#if defined(CONFIG_UFSHPB)
		ufsf->ufshpb_state = HPB_FAILED;
#endif
+1 −0
Original line number Diff line number Diff line
@@ -165,6 +165,7 @@ struct ufsf_feature {
struct ufs_hba;
struct ufshcd_lrb;

int is_samsung_feature(struct ufs_hba *hba);
void ufsf_device_check(struct ufs_hba *hba);
int ufsf_check_query(__u32 opcode);
int ufsf_query_ioctl(struct ufsf_feature *ufsf, int lun, void __user *buffer,
+12 −2
Original line number Diff line number Diff line
@@ -6842,14 +6842,19 @@ static int ufshcd_disable_ee(struct ufs_hba *hba, u16 mask)
{
	int err = 0;
	u32 val;
	int sel = 0;

	if (!(hba->ee_ctrl_mask & mask))
		goto out;

	val = hba->ee_ctrl_mask & ~mask;
	val &= MASK_EE_STATUS;
#ifdef CONFIG_UFSFEATURE
	if (is_samsung_feature(hba))
		sel = 1;
#endif
	err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
			QUERY_ATTR_IDN_EE_CONTROL, 0, 1, &val);
			QUERY_ATTR_IDN_EE_CONTROL, 0, sel, &val);
	if (!err)
		hba->ee_ctrl_mask &= ~mask;
out:
@@ -6870,14 +6875,19 @@ static int ufshcd_enable_ee(struct ufs_hba *hba, u16 mask)
{
	int err = 0;
	u32 val;
	int sel = 0;

	if (hba->ee_ctrl_mask & mask)
		goto out;

	val = hba->ee_ctrl_mask | mask;
	val &= MASK_EE_STATUS;
#ifdef CONFIG_UFSFEATURE
	if (is_samsung_feature(hba))
		sel = 1;
#endif
	err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
			QUERY_ATTR_IDN_EE_CONTROL, 0, 0, &val);
			QUERY_ATTR_IDN_EE_CONTROL, 0, sel, &val);
	if (!err)
		hba->ee_ctrl_mask |= mask;
out: