scsi: ufs: add quirks for specific ufshci
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 00:17:26 +0000 (09:17 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:08 +0000 (17:20 +0900)
Change-Id: I4f69c3f4a465b90b31472ffe838c185298f840c4
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h

index d344fef01f1db7e3156f55233d86d20c323f652c..d10b52c0cf56f1877d2e53d6d6c13f1207719015 100644 (file)
@@ -639,7 +639,31 @@ 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);
+       u32 clear;
+
+       if (hba->quirks & UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR)
+               clear = (1 << pos);
+       else
+               clear = ~(1 << pos);
+
+       ufshcd_writel(hba, clear, 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)
+{
+       u32 clear;
+
+       if (hba->quirks & UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR)
+               clear = (1 << pos);
+       else
+               clear = ~(1 << pos);
+
+       ufshcd_writel(hba, clear, REG_UTP_TASK_REQ_LIST_CLEAR);
 }
 
 /**
@@ -5374,7 +5398,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 */
index ad34bcba1b71a8e83865b27c66048afcd42c1e60..96d579b1257cf298e05c05b2b9114628f8975670 100644 (file)
@@ -592,6 +592,7 @@ struct ufs_hba {
         */
        #define UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION             UFS_BIT(5)
 
+       #define UFSHCD_QUIRK_BROKEN_REQ_LIST_CLR                UFS_BIT(6)
        /*
         * This quirk needs to be enabled if the host contoller regards
         * resolution of the values of PRDTO and PRDTL in UTRD as byte.