devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ajay Neeli <ajay.neeli@amd.com>
To: <martin.petersen@oracle.com>,
	<James.Bottomley@HansenPartnership.com>, <robh@kernel.org>,
	<krzk+dt@kernel.org>, <conor+dt@kernel.org>,
	<pedrom.sousa@synopsys.com>
Cc: <alim.akhtar@samsung.com>, <avri.altman@wdc.com>,
	<bvanassche@acm.org>, <linux-scsi@vger.kernel.org>,
	<devicetree@vger.kernel.org>, <git@amd.com>,
	<michal.simek@amd.com>, <srinivas.goud@amd.com>,
	<radhey.shyam.pandey@amd.com>,
	Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>,
	Ajay Neeli <ajay.neeli@amd.com>
Subject: [PATCH 4/5] ufs: core: Add vendor specific ops to handle interrupts
Date: Fri, 19 Sep 2025 18:08:34 +0530	[thread overview]
Message-ID: <20250919123835.17899-5-ajay.neeli@amd.com> (raw)
In-Reply-To: <20250919123835.17899-1-ajay.neeli@amd.com>

From: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>

Some vendors will define their own interrupts, current interrupt service
routine handles only interrupts defined by the JEDEC standard.
Add provision to handle vendor specific interrupts by defining vendor
specific vops.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Signed-off-by: Ajay Neeli <ajay.neeli@amd.com>
---
 drivers/ufs/core/ufshcd-priv.h | 8 ++++++++
 drivers/ufs/core/ufshcd.c      | 3 +++
 include/ufs/ufshcd.h           | 2 ++
 include/ufs/ufshci.h           | 3 +++
 4 files changed, 16 insertions(+)

diff --git a/drivers/ufs/core/ufshcd-priv.h b/drivers/ufs/core/ufshcd-priv.h
index d0a2c96..04a31f0 100644
--- a/drivers/ufs/core/ufshcd-priv.h
+++ b/drivers/ufs/core/ufshcd-priv.h
@@ -118,6 +118,14 @@ static inline u32 ufshcd_vops_get_ufs_hci_version(struct ufs_hba *hba)
 	return ufshcd_readl(hba, REG_UFS_VERSION);
 }
 
+static inline irqreturn_t ufshcd_vops_isr(struct ufs_hba *hba, u32 intr_status)
+{
+	if (hba->vops && hba->vops->isr)
+		return hba->vops->isr(hba, intr_status);
+
+	return 0;
+}
+
 static inline int ufshcd_vops_clk_scale_notify(struct ufs_hba *hba, bool up,
 					       unsigned long target_freq,
 					       enum ufs_notify_change_status status)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 5442bb8..7a6dde8 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -7069,6 +7069,9 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
 	if (intr_status & MCQ_CQ_EVENT_STATUS)
 		retval |= ufshcd_handle_mcq_cq_events(hba);
 
+	if (intr_status & UFSHCD_VENDOR_IS_MASK)
+		retval |= ufshcd_vops_isr(hba, intr_status);
+
 	return retval;
 }
 
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 1d39437..64c958e 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -337,6 +337,7 @@ struct ufs_pwr_mode_info {
  * @config_esi: called to config Event Specific Interrupt
  * @config_scsi_dev: called to configure SCSI device parameters
  * @freq_to_gear_speed: called to map clock frequency to the max supported gear speed
+ * @isr: called to handle vendor specific interrupts
  */
 struct ufs_hba_variant_ops {
 	const char *name;
@@ -386,6 +387,7 @@ struct ufs_hba_variant_ops {
 	int	(*config_esi)(struct ufs_hba *hba);
 	void	(*config_scsi_dev)(struct scsi_device *sdev);
 	u32	(*freq_to_gear_speed)(struct ufs_hba *hba, unsigned long freq);
+	irqreturn_t	(*isr)(struct ufs_hba *hba, u32 intr_status);
 };
 
 /* clock gating state  */
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index 612500a..2844772 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -185,6 +185,9 @@ static inline u32 ufshci_version(u32 major, u32 minor)
 #define CRYPTO_ENGINE_FATAL_ERROR		0x40000
 #define MCQ_CQ_EVENT_STATUS			0x100000
 
+/* Other than above mentioned bits are treated as Vendor specific status bits */
+#define UFSHCD_VENDOR_IS_MASK			0xFFE8F000
+
 #define UFSHCD_UIC_HIBERN8_MASK	(UIC_HIBERNATE_ENTER |\
 				UIC_HIBERNATE_EXIT)
 
-- 
1.8.3.1


  parent reply	other threads:[~2025-09-19 12:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-19 12:38 [PATCH 0/5] ufs: Add support for AMD Versal Gen2 UFS Ajay Neeli
2025-09-19 12:38 ` [PATCH 1/5] dt-bindings: ufs: amd-versal2: Add support for AMD Versal Gen 2 UFS Host Controller Ajay Neeli
2025-09-22 19:46   ` Rob Herring
2025-10-06 12:30     ` Neeli, Ajay
2025-09-19 12:38 ` [PATCH 2/5] firmware: xilinx: Add support for secure read/write ioctl interface Ajay Neeli
2025-09-19 12:38 ` [PATCH 3/5] firmware: xilinx: Add APIs for UFS PHY initialization Ajay Neeli
2025-09-19 12:38 ` Ajay Neeli [this message]
2025-09-19 17:34   ` [PATCH 4/5] ufs: core: Add vendor specific ops to handle interrupts Bart Van Assche
2025-10-06 12:30     ` Neeli, Ajay
2025-09-19 12:38 ` [PATCH 5/5] ufs: amd-versal2: Add AMD Versal Gen 2 UFS support Ajay Neeli
2025-09-19 17:44   ` Bart Van Assche
2025-10-06 12:45     ` Neeli, Ajay

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=20250919123835.17899-5-ajay.neeli@amd.com \
    --to=ajay.neeli@amd.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=bvanassche@acm.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=git@amd.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=michal.simek@amd.com \
    --cc=pedrom.sousa@synopsys.com \
    --cc=radhey.shyam.pandey@amd.com \
    --cc=robh@kernel.org \
    --cc=sai.krishna.potthuri@amd.com \
    --cc=srinivas.goud@amd.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).