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

Commit 23df2316 authored by Subhash Jadavani's avatar Subhash Jadavani
Browse files

scsi: ufs: clear unit attention after every new device probe



We are currently clearing the UNIT ATTENTION condition on UFS DEVICE
well-known logical unit only after the first device probe. This has
worked for embedded UFS devices but won't work for removable UFS devices.
This change takes the safer option of clearing the UNIT ATTENTION condition
after every new device probe which should work with both removable and
embedded UFS devices.

Change-Id: Ic2632aa1667a0e58a1ce248bfd6c99d1be2c4788
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
parent a56e6a30
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -513,6 +513,8 @@ struct ufs_dev_info {

	/* Keeps information if any of the LU is power on write protected */
	bool is_lu_power_on_wp;
	/* is Unit Attention Condition cleared on UFS Device LUN? */
	unsigned is_ufs_dev_wlun_ua_cleared:1;
};

#endif /* End of Header */
+2 −3
Original line number Diff line number Diff line
@@ -7003,7 +7003,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
	/* UFS device is also active now */
	ufshcd_set_ufs_dev_active(hba);
	ufshcd_force_reset_auto_bkops(hba);
	hba->wlun_dev_clr_ua = true;

	if (ufshcd_get_max_pwr_mode(hba)) {
		dev_err(hba->dev,
@@ -7947,12 +7946,12 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba,
	 * handling context.
	 */
	hba->host->eh_noresume = 1;
	if (hba->wlun_dev_clr_ua) {
	if (!hba->dev_info.is_ufs_dev_wlun_ua_cleared) {
		ret = ufshcd_send_request_sense(hba, sdp);
		if (ret)
			goto out;
		/* Unit attention condition is cleared now */
		hba->wlun_dev_clr_ua = false;
		hba->dev_info.is_ufs_dev_wlun_ua_cleared = 1;
	}

	cmd[4] = pwr_mode << 4;