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


Groups > linux.kernel > #1265360

[PATCH v5 04/11] scsi: ufs: add quirk to fix mishandling utrlclr/utmrlclr

From Alim Akhtar <alim.akhtar@samsung.com>
Newsgroups linux.kernel
Subject [PATCH v5 04/11] scsi: ufs: add quirk to fix mishandling utrlclr/utmrlclr
Date 2015-11-09 06:30 +0100
Message-ID <qsNbI-292-17@gated-at.bofh.it> (permalink)
References <qsNbI-292-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Seungwon Jeon <essuuj@gmail.com>

In the right behavior, setting the bit to '0' indicates clear and
'1' indicates no change. If host contoller handles this the other way,
UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR can be used.

Signed-off-by: Seungwon Jeon <essuuj@gmail.com>
Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/scsi/ufs/ufshcd.c |   21 +++++++++++++++++++--
 drivers/scsi/ufs/ufshcd.h |    5 +++++
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 587a9c8fbfe9..2b16eb363203 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -356,7 +356,24 @@ static inline void ufshcd_put_tm_slot(struct ufs_hba *hba, int slot)
  */
 static inline void ufshcd_utrl_clear(struct ufs_hba *hba, u32 pos)
 {
-	ufshcd_writel(hba, ~(1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+	if (hba->quirks & UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR)
+		ufshcd_writel(hba, (1 << pos), REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+	else
+		ufshcd_writel(hba, ~(1 << pos),
+				REG_UTP_TRANSFER_REQ_LIST_CLEAR);
+}
+
+/**
+ * ufshcd_utmrl_clear - Clear a bit in UTRMLCLR register
+ * @hba: per adapter instance
+ * @pos: position of the bit to be cleared
+ */
+static inline void ufshcd_utmrl_clear(struct ufs_hba *hba, u32 pos)
+{
+	if (hba->quirks & UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR)
+		ufshcd_writel(hba, (1 << pos), REG_UTP_TASK_REQ_LIST_CLEAR);
+	else
+		ufshcd_writel(hba, ~(1 << pos), REG_UTP_TASK_REQ_LIST_CLEAR);
 }
 
 /**
@@ -3685,7 +3702,7 @@ static int ufshcd_clear_tm_cmd(struct ufs_hba *hba, int tag)
 		goto out;
 
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	ufshcd_writel(hba, ~(1 << tag), REG_UTP_TASK_REQ_LIST_CLEAR);
+	ufshcd_utmrl_clear(hba, tag);
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
 
 	/* poll for max. 1 sec to clear door bell register by h/w */
diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h
index 6cd542a803d5..d625d01110b0 100644
--- a/drivers/scsi/ufs/ufshcd.h
+++ b/drivers/scsi/ufs/ufshcd.h
@@ -474,6 +474,11 @@ struct ufs_hba {
 	 */
 	#define UFSHCI_QUIRK_BYTE_ALIGN_UTRD			UFS_BIT(6)
 
+	/*
+	 * Cleaer handling for transfer/task request list is just opposite.
+	 */
+	#define UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR		UFS_BIT(7)
+
 	unsigned int quirks;	/* Deviations from standard UFSHCI spec. */
 
 	wait_queue_head_t tm_wq;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

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


Thread

[PATCH v5 00/11] exynos-ufs: add support for Exynos Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 06/11] scsi: ufs: add quirk to enable host controller  without hce Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 01/11] Documentation: samsung-phy: Add dt bindings for UFS Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 02/11] phy: exynos-ufs: add UFS PHY driver for EXYNOS SoC Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 04/11] scsi: ufs: add quirk to fix mishandling  utrlclr/utmrlclr Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 03/11] scsi: ufs: add quirk to contain unconformable utrd  field Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:30 +0100
  [PATCH v5 08/11] scsi: ufs: add add specific callback for hibern8 Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:40 +0100
  [PATCH v5 09/11] scsi: ufs: make ufshcd_config_pwr_mode of non-static  func Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:40 +0100
  [PATCH v5 10/11] Documentation: devicetree: ufs: Add DT bindings for  exynos UFS host controller Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:40 +0100
    Re: [PATCH v5 10/11] Documentation: devicetree: ufs: Add DT bindings  for exynos UFS host controller Rob Herring <robh@kernel.org> - 2015-11-09 17:30 +0100
      Re: [PATCH v5 10/11] Documentation: devicetree: ufs: Add DT bindings  for exynos UFS host controller Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-10 09:40 +0100
  [PATCH v5 07/11] scsi: ufs: add specific callback for nexus type Alim Akhtar <alim.akhtar@samsung.com> - 2015-11-09 06:40 +0100
  Re: [PATCH v5 00/11] exynos-ufs: add support for Exynos Alim Akhtar <alim.akhtar@gmail.com> - 2015-11-16 02:10 +0100

csiph-web