mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mriganka Chakravarty <mrigankac@google.com>
To: Alim Akhtar <alim.akhtar@samsung.com>,
	Avri Altman <avri.altman@wdc.com>,
	 Bart Van Assche <bvanassche@acm.org>,
	Peter Wang <peter.wang@mediatek.com>,
	 Manivannan Sadhasivam <mani@kernel.org>,
	"Bao D . Nguyen" <quic_nguyenb@quicinc.com>,
	 Eric Biggers <ebiggers@google.com>,
	Can Guo <quic_cang@quicinc.com>,
	 Neil Armstrong <neil.armstrong@linaro.org>
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	 manugautam@google.com, vamshigajjela@google.com,
	 Mriganka Chakravarty <mrigankac@google.com>
Subject: [PATCH] ufs: scsi: core: Send a NOP OUT to device before disabling AHIT
Date: Tue, 17 Jun 2025 07:37:02 +0000	[thread overview]
Message-ID: <20250617073702.1207412-1-mrigankac@google.com> (raw)

Synopsis databook recommends that the host must send a NOP OUT to device
before disabling AHIT(setting AHIT.AH8ITV to 0), if already programmed
to a non-zero value.

Signed-off-by: Mriganka Chakravarty <mrigankac@google.com>
---
 drivers/ufs/core/ufshcd.c | 10 ++++++++++
 include/ufs/ufshcd.h      |  7 +++++++
 2 files changed, 17 insertions(+)

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 4410e7d93b7d..f9a2d15ab2ee 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -4507,9 +4507,19 @@ EXPORT_SYMBOL_GPL(ufshcd_uic_hibern8_exit);
 
 static void ufshcd_configure_auto_hibern8(struct ufs_hba *hba)
 {
+	u32 reg_ahit;
+
 	if (!ufshcd_is_auto_hibern8_supported(hba))
 		return;
 
+	if (hba->quirks & UFSHCD_QUIRK_SEND_NOP_BEFORE_AHIT_DISABLE) {
+		reg_ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER);
+		if (hba->ahit == 0 &&
+		    FIELD_GET(UFSHCI_AHIBERN8_TIMER_MASK, reg_ahit) != 0)
+			ufshcd_exec_dev_cmd(hba, DEV_CMD_TYPE_NOP,
+					    hba->nop_out_timeout);
+	}
+
 	ufshcd_writel(hba, hba->ahit, REG_AUTO_HIBERNATE_IDLE_TIMER);
 }
 
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 9b3515cee711..b069d15c1c71 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -689,6 +689,13 @@ enum ufshcd_quirks {
 	 * single doorbell mode.
 	 */
 	UFSHCD_QUIRK_BROKEN_LSDBS_CAP			= 1 << 25,
+
+	/*
+	 * This quirk indicates that host must send a NOP OUT to device before
+	 * disabling AHIT(setting AHIT.AH8ITV to 0), if already programmed to a
+	 * non-zero value.
+	 */
+	UFSHCD_QUIRK_SEND_NOP_BEFORE_AHIT_DISABLE	= 1 << 31,
 };
 
 enum ufshcd_caps {
-- 
2.50.0.rc2.692.g299adb8693-goog


             reply	other threads:[~2025-06-17  7:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  7:37 Mriganka Chakravarty [this message]
2025-06-18  4:08 ` Peter Wang (王信友)

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=20250617073702.1207412-1-mrigankac@google.com \
    --to=mrigankac@google.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=ebiggers@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manugautam@google.com \
    --cc=neil.armstrong@linaro.org \
    --cc=peter.wang@mediatek.com \
    --cc=quic_cang@quicinc.com \
    --cc=quic_nguyenb@quicinc.com \
    --cc=vamshigajjela@google.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

all inboxes | Powered by JetHome®