linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: DooHyun Hwang <dh0421.hwang@samsung.com>
To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, stanley.chu@mediatek.com,
	cang@codeaurora.org, asutoshd@codeaurora.org, beanhuo@micron.com,
	jaegeuk@kernel.org, adrian.hunter@intel.com, satyat@google.com
Cc: grant.jung@samsung.com, jt77.jang@samsung.com,
	junwoo80.lee@samsung.com, jangsub.yi@samsung.com,
	sh043.lee@samsung.com, cw9316.lee@samsung.com,
	sh8267.baek@samsung.com, wkon.kim@samsung.com,
	DooHyun Hwang <dh0421.hwang@samsung.com>
Subject: [PATCH 3/3] scsi: ufs: reset the ufs device before link startup retry
Date: Fri,  5 Feb 2021 10:36:33 +0900	[thread overview]
Message-ID: <20210205013633.16243-3-dh0421.hwang@samsung.com> (raw)
In-Reply-To: <20210205013633.16243-1-dh0421.hwang@samsung.com>

If the link startup command fails, trigger hardware reset to reset
the UFS device before link startup retry.

Signed-off-by: DooHyun Hwang <dh0421.hwang@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 32cb3b0dcbcf..a87e98631a72 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -4644,7 +4644,15 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
 				       (u32)ret);
 
 		if (link_startup_again) {
+			int err = 0;
+
 			link_startup_again = false;
+
+			/* Reset the attached device before retrying */
+			err = ufshcd_vops_device_reset(hba);
+			if (err && (err != -EOPNOTSUPP))
+				ufshcd_update_evt_hist(hba, UFS_EVT_DEV_RESET, err);
+
 			retries = DME_LINKSTARTUP_RETRIES;
 			goto link_startup;
 		}
-- 
2.29.0


      parent reply	other threads:[~2021-02-05  1:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210205014904epcas1p1b8cf04408ff6f5ef9ebd5c95b8a99f27@epcas1p1.samsung.com>
2021-02-05  1:36 ` [PATCH 1/3] scsi: ufs: retry link startup if that fails and device state is not active DooHyun Hwang
     [not found]   ` <CGME20210205014906epcas1p4273577a5af2d2a0786ddf794cd32d494@epcas1p4.samsung.com>
2021-02-05  1:36     ` [PATCH 2/3] scsi: ufs: set device state to power-off before 1st link startup DooHyun Hwang
     [not found]   ` <CGME20210205014910epcas1p3bcaa909ace0684150973ccc3a35bb0de@epcas1p3.samsung.com>
2021-02-05  1:36     ` DooHyun Hwang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210205013633.16243-3-dh0421.hwang@samsung.com \
    --to=dh0421.hwang@samsung.com \
    --cc=adrian.hunter@intel.com \
    --cc=alim.akhtar@samsung.com \
    --cc=asutoshd@codeaurora.org \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=cang@codeaurora.org \
    --cc=cw9316.lee@samsung.com \
    --cc=grant.jung@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=jangsub.yi@samsung.com \
    --cc=jejb@linux.ibm.com \
    --cc=jt77.jang@samsung.com \
    --cc=junwoo80.lee@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=satyat@google.com \
    --cc=sh043.lee@samsung.com \
    --cc=sh8267.baek@samsung.com \
    --cc=stanley.chu@mediatek.com \
    --cc=wkon.kim@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).