Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1326532

[v3 02/14] scsi: ufs: avoid spurious UFS host controller interrupts

From Yaniv Gardi <ygardi@codeaurora.org>
Newsgroups linux.kernel
Subject [v3 02/14] scsi: ufs: avoid spurious UFS host controller interrupts
Date 2016-02-04 10:50 +0100
Message-ID <qYoI3-6Oj-29@gated-at.bofh.it> (permalink)
References <qYoI1-6Oj-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


When control reaches to Linux UFS driver during UFS boot mode, UFS host
controller interrupt status/enable registers may have left over
settings.
In order to avoid any spurious interrupts due to these left overs,
it's important to clear these interrupt status/enable registers before
enabling UFS interrupt handling.

Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>

---
 drivers/scsi/ufs/ufshcd.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 65593b3..b0ef94d 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -5837,6 +5837,21 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
 	init_waitqueue_head(&hba->dev_cmd.tag_wq);
 
 	ufshcd_init_clk_gating(hba);
+
+	/*
+	 * In order to avoid any spurious interrupt immediately after
+	 * registering UFS controller interrupt handler, clear any pending UFS
+	 * interrupt status and disable all the UFS interrupts.
+	 */
+	ufshcd_writel(hba, ufshcd_readl(hba, REG_INTERRUPT_STATUS),
+		      REG_INTERRUPT_STATUS);
+	ufshcd_writel(hba, 0, REG_INTERRUPT_ENABLE);
+	/*
+	 * Make sure that UFS interrupts are disabled and any pending interrupt
+	 * status is cleared before registering UFS interrupt handler.
+	 */
+	mb();
+
 	/* IRQ registration */
 	err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba);
 	if (err) {
-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[v3 00/14] add fixes, device quirks, error recovery, Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 05/14] scsi: ufs: separate device and host quirks Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 12/14] scsi: ufs: fix leakage during link off state Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 10/14] scsi: ufs: handle non spec compliant bkops behaviour by device Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 01/14] scsi: ufs-qcom: add number of lanes per direction Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 14/14] scsi: ufs-qcom: set PA_Local_TX_LCC_Enable before link startup Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 02/14] scsi: ufs: avoid spurious UFS host controller interrupts Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 11/14] scsi: ufs: tune UniPro parameters to optimize hibern8 exit time Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 10:50 +0100
  [v3 06/14] scsi: ufs: disable vccq if it's not needed by UFS device Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 11:00 +0100
  [v3 03/14] scsi: ufs: implement scsi host timeout handler Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 11:00 +0100
  [v3 04/14] scsi: ufs: verify hba controller hce reg value Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 11:00 +0100
  [v3 08/14] scsi: ufs: add error recovery after DL NAC error Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 11:00 +0100
  [v3 07/14] scsi: ufs: make error handling bit faster Yaniv Gardi <ygardi@codeaurora.org> - 2016-02-04 11:00 +0100

csiph-web