From: hgchu Date: Fri, 12 Jan 2018 00:17:26 +0000 (+0900) Subject: scsi: ufs: add quirks for specific ufshci X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=86b7a91c6c3d06185bb3243383b7c8fc187a4389;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git scsi: ufs: add quirks for specific ufshci Change-Id: I4f69c3f4a465b90b31472ffe838c185298f840c4 Signed-off-by: hgchu --- diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index d344fef01f1d..d10b52c0cf56 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -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 */ diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index ad34bcba1b71..96d579b1257c 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -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.